]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add a test case for IPv6StableSecretAddress= 19852/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Jun 2021 18:12:56 +0000 (03:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Jun 2021 19:56:52 +0000 (04:56 +0900)
test/test-network/conf/25-link-local-addressing-yes.network
test/test-network/systemd-networkd-tests.py

index 8268da5aa8692ea2181e79f1ad593ac2517f4dd2..f21d4d2328c84d41440a289d51bc098e287ee59e 100644 (file)
@@ -4,3 +4,4 @@ Name=test1
 [Network]
 LinkLocalAddressing=yes
 IPv6AcceptRA=no
+IPv6StableSecretAddress=0123:4567:89ab:cdef:0123:4567:89ab:cdef
index f55020db7c6bd99835ae790f673a8e51068391a5..33090b565d83e673951ac4e9681357b5b153ff51 100755 (executable)
@@ -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')