summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-30 09:59:58 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-30 09:59:58 +0100
commit56cacc0624a458206ad03c8add0fb19feda8b2ab (patch)
tree8dc269d516f82fc5ae2b1b4c941d3dc6693af92f /smoketest/scripts/cli
parente2599181251a9b7b5223a159c17ea40cb9068ef7 (diff)
downloadvyos-1x-56cacc0624a458206ad03c8add0fb19feda8b2ab.tar.gz
vyos-1x-56cacc0624a458206ad03c8add0fb19feda8b2ab.zip
smoketest: dhcpv6: add client smoketests
(cherry-picked form commit 99f4140d1c5b1813c75790a8a99aae8fa84d13ee)
Diffstat (limited to 'smoketest/scripts/cli')
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py37
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bonding.py1
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bridge.py1
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_ethernet.py1
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_pseudo_ethernet.py1
5 files changed, 41 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index 6a68bcc26..f96739183 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -59,6 +59,7 @@ class BasicInterfaceTest:
_test_qinq = False
_test_ipv6 = False
_test_ipv6_pd = False
+ _test_ipv6_dhcpc6 = False
_test_mirror = False
_base_path = []
@@ -401,6 +402,42 @@ class BasicInterfaceTest:
tmp = read_file(f'/proc/sys/net/ipv6/conf/{interface}/dad_transmits')
self.assertEqual(dad_transmits, tmp)
+ def test_dhcpv6_client_options(self):
+ if not self._test_ipv6_dhcpc6:
+ self.skipTest('not supported')
+
+ duid_base = 10
+ for interface in self._interfaces:
+ duid = '00:01:00:01:27:71:db:f0:00:50:00:00:00:{}'.format(duid_base)
+ path = self._base_path + [interface]
+ for option in self._options.get(interface, []):
+ self.session.set(path + option.split())
+
+ # Enable DHCPv6 client
+ self.session.set(path + ['address', 'dhcpv6'])
+ self.session.set(path + ['dhcpv6-options', 'rapid-commit'])
+ self.session.set(path + ['dhcpv6-options', 'parameters-only'])
+ self.session.set(path + ['dhcpv6-options', 'duid', duid])
+ duid_base += 1
+
+ self.session.commit()
+
+ duid_base = 10
+ for interface in self._interfaces:
+ duid = '00:01:00:01:27:71:db:f0:00:50:00:00:00:{}'.format(duid_base)
+ dhcpc6_config = read_file(f'/run/dhcp6c/dhcp6c.{interface}.conf')
+ self.assertIn(f'interface {interface} ' + '{', dhcpc6_config)
+ self.assertIn(f' request domain-name-servers;', dhcpc6_config)
+ self.assertIn(f' request domain-name;', dhcpc6_config)
+ self.assertIn(f' information-only;', dhcpc6_config)
+ self.assertIn(f' send ia-na 0;', dhcpc6_config)
+ self.assertIn(f' send rapid-commit;', dhcpc6_config)
+ self.assertIn(f' send client-id {duid};', dhcpc6_config)
+ self.assertIn('};', dhcpc6_config)
+ duid_base += 1
+
+ # Check for running process
+ self.assertTrue(process_named_running('dhcp6c'))
def test_dhcpv6pd_auto_sla_id(self):
if not self._test_ipv6_pd:
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py
index 234992b23..b65d97d30 100755
--- a/smoketest/scripts/cli/test_interfaces_bonding.py
+++ b/smoketest/scripts/cli/test_interfaces_bonding.py
@@ -30,6 +30,7 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest):
cls._test_ip = True
cls._test_ipv6 = True
cls._test_ipv6_pd = True
+ cls._test_ipv6_dhcpc6 = True
cls._test_mtu = True
cls._test_vlan = True
cls._test_qinq = True
diff --git a/smoketest/scripts/cli/test_interfaces_bridge.py b/smoketest/scripts/cli/test_interfaces_bridge.py
index 854d870be..5e7b2bbd2 100755
--- a/smoketest/scripts/cli/test_interfaces_bridge.py
+++ b/smoketest/scripts/cli/test_interfaces_bridge.py
@@ -32,6 +32,7 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
cls._test_ip = True
cls._test_ipv6 = True
cls._test_ipv6_pd = True
+ cls._test_ipv6_dhcpc6 = True
cls._test_vlan = True
cls._base_path = ['interfaces', 'bridge']
cls._mirror_interfaces = ['dum21354']
diff --git a/smoketest/scripts/cli/test_interfaces_ethernet.py b/smoketest/scripts/cli/test_interfaces_ethernet.py
index 623a8887c..772ff248f 100755
--- a/smoketest/scripts/cli/test_interfaces_ethernet.py
+++ b/smoketest/scripts/cli/test_interfaces_ethernet.py
@@ -40,6 +40,7 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
cls._test_ip = True
cls._test_ipv6 = True
cls._test_ipv6_pd = True
+ cls._test_ipv6_dhcpc6 = True
cls._test_mtu = True
cls._test_vlan = True
cls._test_qinq = True
diff --git a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py
index 54cd8566b..f4cb4cdc9 100755
--- a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py
+++ b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py
@@ -24,6 +24,7 @@ class PEthInterfaceTest(BasicInterfaceTest.BaseTest):
cls._test_ip = True
cls._test_ipv6 = True
cls._test_ipv6_pd = True
+ cls._test_ipv6_dhcpc6 = True
cls._test_mtu = True
cls._test_vlan = True
cls._test_qinq = True