summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli')
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py5
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_loopback.py11
2 files changed, 14 insertions, 2 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index fbedca3f3..8b25d85e6 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -18,9 +18,10 @@ import json
from binascii import hexlify
-from netifaces import ifaddresses
from netifaces import AF_INET
from netifaces import AF_INET6
+from netifaces import ifaddresses
+from netifaces import interfaces
from vyos.configsession import ConfigSession
from vyos.ifconfig import Interface
@@ -96,7 +97,7 @@ class BasicInterfaceTest:
# Ethernet is handled in its derived class
if 'ethernet' not in self._base_path:
for intf in self._interfaces:
- self.assertFalse(os.path.isdir('/sys/class/net/{intf}'))
+ self.assertTrue(intf not in interfaces())
def test_span_mirror(self):
if not self._mirror_interfaces:
diff --git a/smoketest/scripts/cli/test_interfaces_loopback.py b/smoketest/scripts/cli/test_interfaces_loopback.py
index 79225a1bd..e3538fc59 100755
--- a/smoketest/scripts/cli/test_interfaces_loopback.py
+++ b/smoketest/scripts/cli/test_interfaces_loopback.py
@@ -17,6 +17,8 @@
import unittest
from base_interfaces_test import BasicInterfaceTest
+from netifaces import interfaces
+
from vyos.validate import is_intf_addr_assigned
class LoopbackInterfaceTest(BasicInterfaceTest.BaseTest):
@@ -27,6 +29,15 @@ class LoopbackInterfaceTest(BasicInterfaceTest.BaseTest):
self._base_path = ['interfaces', 'loopback']
self._interfaces = ['lo']
+ def tearDown(self):
+ self.session.delete(self._base_path)
+ self.session.commit()
+ del self.session
+
+ # loopback interface must persist!
+ for intf in self._interfaces:
+ self.assertTrue(intf in interfaces())
+
def test_add_single_ip_address(self):
super().test_add_single_ip_address()
for addr in self._loopback_addresses: