summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-25 19:31:42 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-25 19:31:43 +0100
commit44fd56bb825c641b4b34ec1e952674d1fb2894c8 (patch)
tree76c40e1d60db9e36fd521d06d5b88dde20cb0a1b
parent99f4140d1c5b1813c75790a8a99aae8fa84d13ee (diff)
downloadvyos-1x-44fd56bb825c641b4b34ec1e952674d1fb2894c8.tar.gz
vyos-1x-44fd56bb825c641b4b34ec1e952674d1fb2894c8.zip
smoketest: dhcpc6: fix UnboundLocalError
UnboundLocalError: local variable 'client_base' referenced before assignment
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index 8fa757967..1426e80c2 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -406,8 +406,9 @@ class BasicInterfaceTest:
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:' + read_file(f'/sys/class/net/{interface}/address')
+ 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())
@@ -417,11 +418,13 @@ class BasicInterfaceTest:
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:' + read_file(f'/sys/class/net/{interface}/address')
+ 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)
@@ -431,6 +434,7 @@ class BasicInterfaceTest:
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'))