diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-03-30 21:57:13 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-03-30 23:10:19 +0200 |
commit | 9da1b20e40b9f524a27d27e73a9a13d937a49aa6 (patch) | |
tree | da885760c5851336a53b18f99a719c0a48b6e041 /smoketest/scripts/cli/test_system_ipv6.py | |
parent | 24ffc55877ac1b791f876fd454473d0fd9ab750b (diff) | |
download | vyos-1x-9da1b20e40b9f524a27d27e73a9a13d937a49aa6.tar.gz vyos-1x-9da1b20e40b9f524a27d27e73a9a13d937a49aa6.zip |
smoketest: T4319: verify correct assignment of loopback IP addresses
(cherry picked from commit a33b737b753843501c86eee744aef75137d2b64e)
Diffstat (limited to 'smoketest/scripts/cli/test_system_ipv6.py')
-rwxr-xr-x | smoketest/scripts/cli/test_system_ipv6.py | 19 |
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 |