From 4681ab55478e6fe07a6dbfc85eb1ec56a98dbb71 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 9 Jun 2021 03:12:56 +0900 Subject: [PATCH] test-network: add a test case for IPv6StableSecretAddress= --- .../conf/25-link-local-addressing-yes.network | 1 + test/test-network/systemd-networkd-tests.py | 21 +++---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/test/test-network/conf/25-link-local-addressing-yes.network b/test/test-network/conf/25-link-local-addressing-yes.network index 8268da5aa86..f21d4d2328c 100644 --- a/test/test-network/conf/25-link-local-addressing-yes.network +++ b/test/test-network/conf/25-link-local-addressing-yes.network @@ -4,3 +4,4 @@ Name=test1 [Network] LinkLocalAddressing=yes IPv6AcceptRA=no +IPv6StableSecretAddress=0123:4567:89ab:cdef:0123:4567:89ab:cdef diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index f55020db7c6..33090b565d8 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -2619,24 +2619,9 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): 3: generate stable privacy addresses, using a random secret if unset ''' - test1_addr_gen_mode = '' - if os.path.exists(os.path.join(os.path.join(network_sysctl_ipv6_path, 'test1'), 'stable_secret')): - with open(os.path.join(os.path.join(network_sysctl_ipv6_path, 'test1'), 'stable_secret')) as f: - try: - f.readline() - except IOError: - # if stable_secret is unset, then EIO is returned - test1_addr_gen_mode = '0' - else: - test1_addr_gen_mode = '2' - else: - test1_addr_gen_mode = '0' - - if os.path.exists(os.path.join(os.path.join(network_sysctl_ipv6_path, 'test1'), 'addr_gen_mode')): - self.assertEqual(read_ipv6_sysctl_attr('test1', 'addr_gen_mode'), test1_addr_gen_mode) - - if os.path.exists(os.path.join(os.path.join(network_sysctl_ipv6_path, 'dummy98'), 'addr_gen_mode')): - self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'addr_gen_mode'), '1') + self.assertEqual(read_ipv6_sysctl_attr('test1', 'stable_secret'), '0123:4567:89ab:cdef:0123:4567:89ab:cdef') + self.assertEqual(read_ipv6_sysctl_attr('test1', 'addr_gen_mode'), '2') + self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'addr_gen_mode'), '1') def test_link_local_addressing_remove_ipv6ll(self): copy_unit_to_networkd_unit_path('26-link-local-addressing-ipv6.network', '12-dummy.netdev') -- 2.47.3