summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_interfaces_loopback.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-16 16:37:22 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-16 18:05:13 +0100
commitb373d3841608838fd28f98691cb14e42c128c216 (patch)
tree4d0cd4e2bf7b9bd53b7e384a6016dfe31fdd20a3 /smoketest/scripts/cli/test_interfaces_loopback.py
parent630800af3f9498c766f264927b57fcc606a6169a (diff)
downloadvyos-1x-b373d3841608838fd28f98691cb14e42c128c216.tar.gz
vyos-1x-b373d3841608838fd28f98691cb14e42c128c216.zip
smoketest: loopback: interface can not be deleted, it must always exist
Commit 35b049aa ("smoketest: interfaces: verify deletion of interfaces") validated that when the test completed (tearDown()) there must be no interfaces left registered for the tests. This is invalid for the loopback interface as it can not be deleted from the system.
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_loopback.py')
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_loopback.py11
1 files changed, 11 insertions, 0 deletions
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: