summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_system_ipv6.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-03-30 21:57:13 +0200
committerChristian Poessinger <christian@poessinger.com>2022-03-30 21:57:13 +0200
commita33b737b753843501c86eee744aef75137d2b64e (patch)
tree83c9df3be7c32aa005c79a0069a8713d8f329aef /smoketest/scripts/cli/test_system_ipv6.py
parent60f009defadb9d36bf84def1e839cb11a0b3d619 (diff)
downloadvyos-1x-a33b737b753843501c86eee744aef75137d2b64e.tar.gz
vyos-1x-a33b737b753843501c86eee744aef75137d2b64e.zip
smoketest: T4319: verify correct assignment of loopback IP addresses
Diffstat (limited to 'smoketest/scripts/cli/test_system_ipv6.py')
-rwxr-xr-xsmoketest/scripts/cli/test_system_ipv6.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_system_ipv6.py b/smoketest/scripts/cli/test_system_ipv6.py
index 3112d2e46..6fe58701b 100755
--- a/smoketest/scripts/cli/test_system_ipv6.py
+++ b/smoketest/scripts/cli/test_system_ipv6.py
@@ -17,7 +17,11 @@
import unittest
from base_vyostest_shim import VyOSUnitTestSHIM
+
+from vyos.template import is_ipv4
from vyos.util import read_file
+from vyos.util import is_ipv6_enabled
+from vyos.validate import is_intf_addr_assigned
base_path = ['system', 'ipv6']
@@ -42,6 +46,14 @@ class TestSystemIPv6(VyOSUnitTestSHIM.TestCase):
self.assertEqual(read_file(file_forwarding), '0')
def test_system_ipv6_disable(self):
+ # Verify previous "enable" state
+ self.assertEqual(read_file(file_disable), '0')
+ self.assertTrue(is_ipv6_enabled())
+
+ loopbacks = ['127.0.0.1', '::1']
+ for addr in loopbacks:
+ self.assertTrue(is_intf_addr_assigned('lo', addr))
+
# Do not assign any IPv6 address on interfaces, this requires a reboot
# which can not be tested, but we can read the config file :)
self.cli_set(base_path + ['disable'])
@@ -49,6 +61,13 @@ class TestSystemIPv6(VyOSUnitTestSHIM.TestCase):
# Verify configuration file
self.assertEqual(read_file(file_disable), '1')
+ self.assertFalse(is_ipv6_enabled())
+
+ for addr in loopbacks:
+ if is_ipv4(addr):
+ self.assertTrue(is_intf_addr_assigned('lo', addr))
+ else:
+ self.assertFalse(is_intf_addr_assigned('lo', addr))
def test_system_ipv6_strict_dad(self):
# This defaults to 1