summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-01-03 20:52:09 +0100
committerChristian Breunig <christian@breunig.cc>2026-01-04 08:19:00 +0100
commita5995051bc271907df66618dfb6d7afe62bab551 (patch)
tree8f92f7688206f6c2cb0d183949625eff72b5d00f /smoketest/scripts/cli
parent76830afc8703a3f9f6be7500cb92aa9b6e255425 (diff)
downloadvyos-1x-a5995051bc271907df66618dfb6d7afe62bab551.tar.gz
vyos-1x-a5995051bc271907df66618dfb6d7afe62bab551.zip
ethernet: T8142: do not raise ValueError for non-existing interfaces
Call verify_interface_exists() with state_required=True to ensure the interface exists physically and is recognized by the kernel, rather than relying on its presence in the CLI configuration. Unlike bridge or bond interfaces, Ethernet interfaces are not virtual and must be physically present. Ethtool() instance can only be created when the physical interface exists, otherwise a ValueError is raised.
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_ethernet.py10
1 files changed, 6 insertions, 4 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: