summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_service_router-advert.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-03-12 16:58:25 +0100
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-03-13 10:14:54 +0000
commit306e83a66e2e580417d87e3871200cad6c09cb49 (patch)
tree25986c25ba2e035cad57b579e2ac1e7f861ab77f /smoketest/scripts/cli/test_service_router-advert.py
parentc8528d080786a4be9436fa71c9ec969b9c3719fd (diff)
downloadvyos-1x-306e83a66e2e580417d87e3871200cad6c09cb49.tar.gz
vyos-1x-306e83a66e2e580417d87e3871200cad6c09cb49.zip
radvd: T6118: add nat64prefix support RFC8781
Add support for pref64 option, as defined in RFC8781. The prefix valid lifetime must not be smaller than the "interface interval max" definition which defaults to 600. set service router-advert interface eth1 nat64prefix 64:ff9b::/96 (cherry picked from commit f1ead5c6a16aba00699b8a5b9c18ef6cffe8cc4d)
Diffstat (limited to 'smoketest/scripts/cli/test_service_router-advert.py')
-rwxr-xr-xsmoketest/scripts/cli/test_service_router-advert.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_router-advert.py b/smoketest/scripts/cli/test_service_router-advert.py
index 5fc2019fd..d1ff25a58 100755
--- a/smoketest/scripts/cli/test_service_router-advert.py
+++ b/smoketest/scripts/cli/test_service_router-advert.py
@@ -195,6 +195,34 @@ class TestServiceRADVD(VyOSUnitTestSHIM.TestCase):
for src in ra_src:
self.assertIn(f' {src};', config)
+ def test_nat64prefix(self):
+ nat64prefix = '64:ff9b::/96'
+ nat64prefix_invalid = '64:ff9b::/44'
+
+ self.cli_set(base_path + ['nat64prefix', nat64prefix])
+
+ # and another invalid prefix
+ # Invalid NAT64 prefix length for "2001:db8::/34", can only be one of:
+ # /32, /40, /48, /56, /64, /96
+ self.cli_set(base_path + ['nat64prefix', nat64prefix_invalid])
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_delete(base_path + ['nat64prefix', nat64prefix_invalid])
+
+ # NAT64 valid-lifetime must not be smaller then "interval max"
+ self.cli_set(base_path + ['nat64prefix', nat64prefix, 'valid-lifetime', '500'])
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_delete(base_path + ['nat64prefix', nat64prefix, 'valid-lifetime'])
+
+ # commit changes
+ self.cli_commit()
+
+ config = read_file(RADVD_CONF)
+
+ tmp = f'nat64prefix {nat64prefix}' + ' {'
+ self.assertIn(tmp, config)
+ self.assertIn('AdvValidLifetime 65528;', config) # default
if __name__ == '__main__':
unittest.main(verbosity=2)