summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-01-05 16:54:12 +0100
committerGitHub <noreply@github.com>2026-01-05 16:54:12 +0100
commit1ff4f6d9f8fc6f8b5fafa78f985bb5880f384d76 (patch)
tree62c1467961a4a16ea27ab5df3f2b9902439a75c6
parent06945f0a7079b72ab3844bec77288aea208ac266 (diff)
parenta5995051bc271907df66618dfb6d7afe62bab551 (diff)
downloadvyos-1x-1ff4f6d9f8fc6f8b5fafa78f985bb5880f384d76.tar.gz
vyos-1x-1ff4f6d9f8fc6f8b5fafa78f985bb5880f384d76.zip
Merge pull request #4933 from c-po/eth-fix
ethernet: T8142: do not raise ValueError for non-existing interfaces
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_ethernet.py10
-rwxr-xr-xsrc/conf_mode/interfaces_ethernet.py5
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)