diff options
| -rwxr-xr-x | smoketest/scripts/cli/test_interfaces_ethernet.py | 10 | ||||
| -rwxr-xr-x | src/conf_mode/interfaces_ethernet.py | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_ethernet.py b/smoketest/scripts/cli/test_interfaces_ethernet.py index 6d0b7b772..5b87bd9d1 100755 --- a/smoketest/scripts/cli/test_interfaces_ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_ethernet.py @@ -154,16 +154,18 @@ class EthernetInterfaceTest(BasicInterfaceTest.TestCase): self.assertEqual(int(tmp), 0) def test_non_existing_interface(self): - unknonw_interface = self._base_path + ['eth667'] - self.cli_set(unknonw_interface) + unknonw_interface = 'eth667' + self.cli_set(self._base_path + [unknonw_interface]) # check validate() - interface does not exist - with self.assertRaises(ConfigSessionError): + with self.assertRaises(ConfigSessionError) as cm: self.cli_commit() + self.assertIn(f'Interface "{unknonw_interface}" does not exist!', + str(cm.exception)) # we need to remove this wrong interface from the configuration # manually, else tearDown() will have problem in commit() - self.cli_delete(unknonw_interface) + self.cli_delete(self._base_path + [unknonw_interface]) def test_speed_duplex_verify(self): for interface in self._interfaces: diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py index d926c458c..a85ccf815 100755 --- a/src/conf_mode/interfaces_ethernet.py +++ b/src/conf_mode/interfaces_ethernet.py @@ -386,11 +386,12 @@ def verify(ethernet): if 'deleted' in ethernet: return None - ethtool = Ethtool(ethernet['ifname']) - verify_interface_exists(ethernet, ethernet['ifname']) + ifname = ethernet['ifname'] + verify_interface_exists(ethernet, ifname, state_required=True) verify_eapol(ethernet) verify_mirror_redirect(ethernet) # No need to check speed and duplex keys as both have default values + ethtool = Ethtool(ifname) verify_speed_duplex(ethernet, ethtool) verify_flow_control(ethernet, ethtool) verify_ring_buffer(ethernet, ethtool) |
