Lines Matching refs:self
600 def check_link_exists(self, link): argument
601 self.assertTrue(link_exists(link))
603 def check_link_attr(self, *args): argument
604 self.assertEqual(read_link_attr(*args[:-1]), args[-1])
606 def wait_activated(self, link, state='down', timeout=20, fail_assert=True): argument
620 self.fail(f'Timed out waiting for {link} activated.')
623 …def wait_operstate(self, link, operstate='degraded', setup_state='configured', setup_timeout=5, fa… argument
652 self.fail(f'Timed out waiting for {link} to reach state {operstate}/{setup_state}')
655 …def wait_online(self, links_with_operstate, timeout='20s', bool_any=False, ipv4=False, ipv6=False,… argument
694 self.wait_operstate(link.split(':')[0], None, setup_state, setup_timeout)
696 def wait_address(self, link, address_regex, scope='global', ipv='', timeout_sec=100): argument
704 self.assertRegex(output, address_regex)
706 def wait_address_dropped(self, link, address_regex, scope='global', ipv='', timeout_sec=100): argument
714 self.assertNotRegex(output, address_regex)
735 def setUp(self): argument
736 remove_links(self.links)
739 def tearDown(self): argument
740 remove_links(self.links)
741 remove_unit_from_networkd_path(self.units)
745 def test_altname(self): argument
749 self.wait_online(['dummy98:degraded'])
752 self.assertRegex(output, 'hogehogehogehogehogehoge')
754 def test_reconfigure(self): argument
757 self.wait_online(['dummy98:routable'])
761 self.assertIn('inet 10.1.2.3/16 brd 10.1.255.255 scope global dummy98', output)
762 self.assertIn('inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98', output)
763 self.assertIn('inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98', output)
770 self.wait_online(['dummy98:routable'])
774 self.assertIn('inet 10.1.2.3/16 brd 10.1.255.255 scope global dummy98', output)
775 self.assertIn('inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98', output)
776 self.assertIn('inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98', output)
781 self.wait_operstate('dummy98', 'degraded', setup_state='unmanaged')
785 self.assertNotIn('inet 10.1.2.3/16 brd 10.1.255.255 scope global dummy98', output)
786 self.assertNotIn('inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98', output)
787 self.assertNotIn('inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98', output)
791 self.wait_online(['dummy98:routable'])
795 self.assertIn('inet 10.1.2.3/16 brd 10.1.255.255 scope global dummy98', output)
796 self.assertIn('inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98', output)
797 self.assertIn('inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98', output)
799 def test_reload(self): argument
804 self.wait_operstate('test1', 'off', setup_state='unmanaged')
808 self.wait_online(['test1:degraded'])
812 self.wait_operstate('test1', 'degraded', setup_state='unmanaged')
816 self.wait_operstate('test1', 'degraded', setup_state='unmanaged')
820 self.wait_operstate('test1', 'degraded')
822 def test_glob(self): argument
826 self.wait_online(['test1:degraded'])
829 self.assertRegex(output, '1 lo ')
830 self.assertRegex(output, 'test1')
833 self.assertNotRegex(output, '1 lo ')
834 self.assertRegex(output, 'test1')
837 self.assertNotRegex(output, '1 lo ')
838 self.assertRegex(output, 'test1')
841 self.assertNotRegex(output, '1: lo ')
842 self.assertRegex(output, 'test1')
845 self.assertNotRegex(output, '1: lo ')
846 self.assertRegex(output, 'test1')
848 def test_mtu(self): argument
852 self.wait_online(['test1:degraded'])
855 self.assertRegex(output, 'MTU: 1600')
857 def test_type(self): argument
860 self.wait_online(['test1:degraded'])
864 self.assertRegex(output, 'Type: ether')
868 self.assertRegex(output, 'Type: loopback')
871 def test_udev_link_file(self): argument
874 self.wait_online(['test1:degraded'])
878 self.assertRegex(output, r'Link File: (/usr)?/lib/systemd/network/99-default.link')
879 self.assertRegex(output, r'Network File: /run/systemd/network/11-dummy.network')
883 self.assertRegex(output, r'Link File: n/a')
884 self.assertRegex(output, r'Network File: n/a')
886 def test_delete_links(self): argument
891 self.wait_online(['test1:degraded', 'veth99:degraded', 'veth-peer:degraded'])
894 self.assertFalse(link_exists('test1'))
895 self.assertFalse(link_exists('veth99'))
896 self.assertFalse(link_exists('veth-peer'))
1107 def setUp(self): argument
1108 remove_fou_ports(self.fou_ports)
1109 remove_links(self.links_remove_earlier)
1110 remove_links(self.links)
1113 def tearDown(self): argument
1114 remove_fou_ports(self.fou_ports)
1115 remove_links(self.links_remove_earlier)
1116 remove_links(self.links)
1117 remove_unit_from_networkd_path(self.units)
1120 def test_dropin_and_name_conflict(self): argument
1124 self.wait_online(['dropin-test:off'], setup_state='unmanaged')
1128 self.assertRegex(output, '00:50:56:c0:00:28')
1130 def test_match_udev_property(self): argument
1133 self.wait_online(['dummy98:routable'])
1137 self.assertRegex(output, 'Network File: /run/systemd/network/14-match-udev-property')
1139 def test_wait_online_any(self): argument
1143 self.wait_online(['bridge99', 'test1:degraded'], bool_any=True)
1145 self.wait_operstate('bridge99', '(off|no-carrier)', setup_state='configuring')
1146 self.wait_operstate('test1', 'degraded')
1149 def test_bareudp(self): argument
1153 self.wait_online(['bareudp99:degraded'])
1157 self.assertRegex(output, 'dstport 1000 ')
1158 self.assertRegex(output, 'ethertype ip ')
1161 def test_batadv(self): argument
1165 self.wait_online(['batadv99:degraded'])
1169 self.assertRegex(output, 'batadv')
1171 def test_bridge(self): argument
1175 self.wait_online(['bridge99:no-carrier'])
1178 self.assertEqual(9, round(float(read_link_attr('bridge99', 'bridge', 'hello_time')) / tick))
1179 self.assertEqual(9, round(float(read_link_attr('bridge99', 'bridge', 'max_age')) / tick))
1180 … self.assertEqual(9, round(float(read_link_attr('bridge99', 'bridge', 'forward_delay')) / tick))
1181 … self.assertEqual(9, round(float(read_link_attr('bridge99', 'bridge', 'ageing_time')) / tick))
1182 self.assertEqual(9, int(read_link_attr('bridge99', 'bridge', 'priority')))
1183 self.assertEqual(1, int(read_link_attr('bridge99', 'bridge', 'multicast_querier')))
1184 self.assertEqual(1, int(read_link_attr('bridge99', 'bridge', 'multicast_snooping')))
1185 self.assertEqual(1, int(read_link_attr('bridge99', 'bridge', 'stp_state')))
1186 … self.assertEqual(3, int(read_link_attr('bridge99', 'bridge', 'multicast_igmp_version')))
1190 self.assertRegex(output, 'Priority: 9')
1191 self.assertRegex(output, 'STP: yes')
1192 self.assertRegex(output, 'Multicast IGMP Version: 3')
1196 self.assertIn('vlan_filtering 1 ', output)
1197 self.assertIn('vlan_protocol 802.1ad ', output)
1198 self.assertIn('vlan_default_pvid 9 ', output)
1200 def test_bond(self): argument
1204 self.wait_online(['bond99:off', 'bond98:off'], setup_state='unmanaged')
1206 self.assertEqual('802.3ad 4', read_link_attr('bond99', 'bonding', 'mode'))
1207 … self.assertEqual('layer3+4 1', read_link_attr('bond99', 'bonding', 'xmit_hash_policy'))
1208 self.assertEqual('1000', read_link_attr('bond99', 'bonding', 'miimon'))
1209 self.assertEqual('fast 1', read_link_attr('bond99', 'bonding', 'lacp_rate'))
1210 self.assertEqual('2000', read_link_attr('bond99', 'bonding', 'updelay'))
1211 self.assertEqual('2000', read_link_attr('bond99', 'bonding', 'downdelay'))
1212 self.assertEqual('4', read_link_attr('bond99', 'bonding', 'resend_igmp'))
1213 self.assertEqual('1', read_link_attr('bond99', 'bonding', 'min_links'))
1214 … self.assertEqual('1218', read_link_attr('bond99', 'bonding', 'ad_actor_sys_prio'))
1215 … self.assertEqual('811', read_link_attr('bond99', 'bonding', 'ad_user_port_key'))
1216 … self.assertEqual('00:11:22:33:44:55', read_link_attr('bond99', 'bonding', 'ad_actor_system'))
1218 self.assertEqual('balance-tlb 5', read_link_attr('bond98', 'bonding', 'mode'))
1219 self.assertEqual('1', read_link_attr('bond98', 'bonding', 'tlb_dynamic_lb'))
1223 self.assertIn('Mode: 802.3ad', output)
1224 self.assertIn('Miimon: 1s', output)
1225 self.assertIn('Updelay: 2s', output)
1226 self.assertIn('Downdelay: 2s', output)
1230 self.assertIn('Mode: balance-tlb', output)
1232 def test_vlan(self): argument
1237 self.wait_online(['test1:degraded', 'vlan99:routable'])
1241 self.assertRegex(output, ' mtu 2000 ')
1245 self.assertRegex(output, ' mtu 2000 ')
1246 self.assertRegex(output, 'REORDER_HDR')
1247 self.assertRegex(output, 'LOOSE_BINDING')
1248 self.assertRegex(output, 'GVRP')
1249 self.assertRegex(output, 'MVRP')
1250 self.assertRegex(output, ' id 99 ')
1254 self.assertRegex(output, 'inet 192.168.24.5/24 brd 192.168.24.255 scope global test1')
1255 self.assertRegex(output, 'inet 192.168.25.5/24 brd 192.168.25.255 scope global test1')
1259 self.assertRegex(output, 'inet 192.168.23.5/24 brd 192.168.23.255 scope global vlan99')
1261 def test_macvtap(self): argument
1263 with self.subTest(mode=mode):
1265 self.tearDown()
1272 self.wait_online(['macvtap99:degraded',
1277 self.assertRegex(output, 'macvtap mode ' + mode + ' ')
1279 def test_macvlan(self): argument
1281 with self.subTest(mode=mode):
1283 self.tearDown()
1290 self.wait_online(['macvlan99:degraded',
1295 self.assertRegex(output, ' mtu 2000 ')
1299 self.assertRegex(output, ' mtu 2000 ')
1300 self.assertRegex(output, 'macvlan mode ' + mode + ' ')
1303 self.assertEqual(rc, 0)
1307 self.assertEqual(rc, 0)
1310 self.wait_online(['macvlan99:degraded',
1315 self.assertRegex(output, ' mtu 2000 ')
1319 self.assertRegex(output, ' mtu 2000 ')
1320 self.assertRegex(output, 'macvlan mode ' + mode + ' ')
1323 def test_ipvlan(self): argument
1325 with self.subTest(mode=mode, flag=flag):
1327 self.tearDown()
1334 self.wait_online(['ipvlan99:degraded', 'test1:degraded'])
1338 self.assertRegex(output, 'ipvlan *mode ' + mode.lower() + ' ' + flag)
1341 def test_ipvtap(self): argument
1343 with self.subTest(mode=mode, flag=flag):
1345 self.tearDown()
1352 self.wait_online(['ipvtap99:degraded', 'test1:degraded'])
1356 self.assertRegex(output, 'ipvtap *mode ' + mode.lower() + ' ' + flag)
1358 def test_veth(self): argument
1363 …self.wait_online(['veth99:degraded', 'veth-peer:degraded', 'veth-mtu:degraded', 'veth-mtu-peer:deg…
1367 self.assertRegex(output, 'link/ether 12:34:56:78:9a:bc')
1370 self.assertRegex(output, 'link/ether 12:34:56:78:9a:bd')
1374 self.assertRegex(output, 'link/ether 12:34:56:78:9a:be')
1375 self.assertRegex(output, 'mtu 1800')
1378 self.assertRegex(output, 'link/ether 12:34:56:78:9a:bf')
1379 self.assertRegex(output, 'mtu 1800')
1381 def test_tun(self): argument
1385 self.wait_online(['tun99:off'], setup_state='unmanaged')
1390 self.assertRegex(output, 'tun (type tun pi on vnet_hdr on multi_queue|addrgenmode) ')
1392 def test_tap(self): argument
1396 self.wait_online(['tap99:off'], setup_state='unmanaged')
1401 self.assertRegex(output, 'tun (type tap pi on vnet_hdr on multi_queue|addrgenmode) ')
1404 def test_vrf(self): argument
1408 self.wait_online(['vrf99:carrier'])
1411 def test_vcan(self): argument
1415 self.wait_online(['vcan99:carrier'])
1418 def test_vxcan(self): argument
1422 self.wait_online(['vxcan99:carrier', 'vxcan-peer:carrier'])
1425 def test_wireguard(self): argument
1431 self.wait_online(['wg99:routable', 'wg98:routable', 'wg97:carrier'])
1435 self.assertIn('inet 192.168.124.1/24 scope global wg99', output)
1439 self.assertIn('inet 192.168.123.123/24 scope global wg98', output)
1443 self.assertIn('inet6 fd8d:4d6d:3ccb:500::1/64 scope global', output)
1447 self.assertIn('192.168.26.0/24 proto static metric 123', output)
1451 self.assertIn('fd31:bf08:57cb::/48 proto static metric 123 pref medium', output)
1455 … self.assertIn('fd8d:4d6d:3ccb:500:c79:2339:edce:ece1 proto static metric 123 pref medium', output)
1456 …self.assertIn('fd8d:4d6d:3ccb:500:1dbf:ca8a:32d3:dd81 proto static metric 123 pref medium', output)
1457 …self.assertIn('fd8d:4d6d:3ccb:500:1e54:1415:35d0:a47c proto static metric 123 pref medium', output)
1458 …self.assertIn('fd8d:4d6d:3ccb:500:270d:b5dd:4a3f:8909 proto static metric 123 pref medium', output)
1459 …self.assertIn('fd8d:4d6d:3ccb:500:5660:679d:3532:94d8 proto static metric 123 pref medium', output)
1460 …self.assertIn('fd8d:4d6d:3ccb:500:6825:573f:30f3:9472 proto static metric 123 pref medium', output)
1461 …self.assertIn('fd8d:4d6d:3ccb:500:6f2e:6888:c6fd:dfb9 proto static metric 123 pref medium', output)
1462 … self.assertIn('fd8d:4d6d:3ccb:500:8d4d:bab:7280:a09a proto static metric 123 pref medium', output)
1463 …self.assertIn('fd8d:4d6d:3ccb:500:900c:d437:ec27:8822 proto static metric 123 pref medium', output)
1464 …self.assertIn('fd8d:4d6d:3ccb:500:9742:9931:5217:18d5 proto static metric 123 pref medium', output)
1465 …self.assertIn('fd8d:4d6d:3ccb:500:9c11:d820:2e96:9be0 proto static metric 123 pref medium', output)
1466 …self.assertIn('fd8d:4d6d:3ccb:500:a072:80da:de4f:add1 proto static metric 123 pref medium', output)
1467 … self.assertIn('fd8d:4d6d:3ccb:500:a3f3:df38:19b0:721 proto static metric 123 pref medium', output)
1468 …self.assertIn('fd8d:4d6d:3ccb:500:a94b:cd6a:a32d:90e6 proto static metric 123 pref medium', output)
1469 …self.assertIn('fd8d:4d6d:3ccb:500:b39c:9cdc:755a:ead3 proto static metric 123 pref medium', output)
1470 …self.assertIn('fd8d:4d6d:3ccb:500:b684:4f81:2e3e:132e proto static metric 123 pref medium', output)
1471 …self.assertIn('fd8d:4d6d:3ccb:500:bad5:495d:8e9c:3427 proto static metric 123 pref medium', output)
1472 … self.assertIn('fd8d:4d6d:3ccb:500:bfe5:c3c3:5d77:fcb proto static metric 123 pref medium', output)
1473 …self.assertIn('fd8d:4d6d:3ccb:500:c624:6bf7:4c09:3b59 proto static metric 123 pref medium', output)
1474 … self.assertIn('fd8d:4d6d:3ccb:500:d4f9:5dc:9296:a1a proto static metric 123 pref medium', output)
1475 …self.assertIn('fd8d:4d6d:3ccb:500:dcdd:d33b:90c9:6088 proto static metric 123 pref medium', output)
1476 …self.assertIn('fd8d:4d6d:3ccb:500:e2e1:ae15:103f:f376 proto static metric 123 pref medium', output)
1477 … self.assertIn('fd8d:4d6d:3ccb:500:f349:c4f0:10c1:6b4 proto static metric 123 pref medium', output)
1478 … self.assertIn('fd8d:4d6d:3ccb:c79:2339:edce::/96 proto static metric 123 pref medium', output)
1479 … self.assertIn('fd8d:4d6d:3ccb:1dbf:ca8a:32d3::/96 proto static metric 123 pref medium', output)
1480 … self.assertIn('fd8d:4d6d:3ccb:1e54:1415:35d0::/96 proto static metric 123 pref medium', output)
1481 … self.assertIn('fd8d:4d6d:3ccb:270d:b5dd:4a3f::/96 proto static metric 123 pref medium', output)
1482 … self.assertIn('fd8d:4d6d:3ccb:5660:679d:3532::/96 proto static metric 123 pref medium', output)
1483 … self.assertIn('fd8d:4d6d:3ccb:6825:573f:30f3::/96 proto static metric 123 pref medium', output)
1484 … self.assertIn('fd8d:4d6d:3ccb:6f2e:6888:c6fd::/96 proto static metric 123 pref medium', output)
1485 … self.assertIn('fd8d:4d6d:3ccb:8d4d:bab:7280::/96 proto static metric 123 pref medium', output)
1486 … self.assertIn('fd8d:4d6d:3ccb:900c:d437:ec27::/96 proto static metric 123 pref medium', output)
1487 … self.assertIn('fd8d:4d6d:3ccb:9742:9931:5217::/96 proto static metric 123 pref medium', output)
1488 … self.assertIn('fd8d:4d6d:3ccb:9c11:d820:2e96::/96 proto static metric 123 pref medium', output)
1489 … self.assertIn('fd8d:4d6d:3ccb:a072:80da:de4f::/96 proto static metric 123 pref medium', output)
1490 … self.assertIn('fd8d:4d6d:3ccb:a3f3:df38:19b0::/96 proto static metric 123 pref medium', output)
1491 … self.assertIn('fd8d:4d6d:3ccb:a94b:cd6a:a32d::/96 proto static metric 123 pref medium', output)
1492 … self.assertIn('fd8d:4d6d:3ccb:b39c:9cdc:755a::/96 proto static metric 123 pref medium', output)
1493 … self.assertIn('fd8d:4d6d:3ccb:b684:4f81:2e3e::/96 proto static metric 123 pref medium', output)
1494 … self.assertIn('fd8d:4d6d:3ccb:bad5:495d:8e9c::/96 proto static metric 123 pref medium', output)
1495 … self.assertIn('fd8d:4d6d:3ccb:bfe5:c3c3:5d77::/96 proto static metric 123 pref medium', output)
1496 … self.assertIn('fd8d:4d6d:3ccb:c624:6bf7:4c09::/96 proto static metric 123 pref medium', output)
1497 … self.assertIn('fd8d:4d6d:3ccb:d4f9:5dc:9296::/96 proto static metric 123 pref medium', output)
1498 … self.assertIn('fd8d:4d6d:3ccb:dcdd:d33b:90c9::/96 proto static metric 123 pref medium', output)
1499 … self.assertIn('fd8d:4d6d:3ccb:e2e1:ae15:103f::/96 proto static metric 123 pref medium', output)
1500 … self.assertIn('fd8d:4d6d:3ccb:f349:c4f0:10c1::/96 proto static metric 123 pref medium', output)
1506 self.assertEqual(output, '51820')
1508 self.assertEqual(output, '0x4d2')
1510 self.assertEqual(output, 'EEGlnEPYJV//kbvvIqxKkQwOiS+UENyPncC4bF46ong=')
1512 self.assertIn('9uioxkGzjvGjkse3V35I9AhorWfIjBcrf3UPMS0bw2c=\t192.168.124.3/32', output)
1513 self.assertIn('TTiCUpCxS7zDn/ax4p5W6Evg41r8hOrnWQw2Sq6Nh10=\t192.168.124.2/32', output)
1514 …self.assertIn('lsDtM3AbjxNlauRKzHEPfgS1Zp7cp/VX5Use/P4PQSc=\tfdbc:bae2:7871:e1fe:793:8636::/96 fdb…
1515 …self.assertIn('RDf+LSpeEre7YEIKaxg+wbpsNV7du+ktR99uBEtIiCA=\t192.168.26.0/24 fd31:bf08:57cb::/48',…
1517 self.assertIn('9uioxkGzjvGjkse3V35I9AhorWfIjBcrf3UPMS0bw2c=\toff', output)
1518 self.assertIn('TTiCUpCxS7zDn/ax4p5W6Evg41r8hOrnWQw2Sq6Nh10=\toff', output)
1519 self.assertIn('lsDtM3AbjxNlauRKzHEPfgS1Zp7cp/VX5Use/P4PQSc=\toff', output)
1520 self.assertIn('RDf+LSpeEre7YEIKaxg+wbpsNV7du+ktR99uBEtIiCA=\t20', output)
1522 self.assertIn('9uioxkGzjvGjkse3V35I9AhorWfIjBcrf3UPMS0bw2c=\t(none)', output)
1523 self.assertIn('TTiCUpCxS7zDn/ax4p5W6Evg41r8hOrnWQw2Sq6Nh10=\t(none)', output)
1524 self.assertIn('lsDtM3AbjxNlauRKzHEPfgS1Zp7cp/VX5Use/P4PQSc=\t(none)', output)
1525 … self.assertIn('RDf+LSpeEre7YEIKaxg+wbpsNV7du+ktR99uBEtIiCA=\t192.168.27.3:51820', output)
1527 …self.assertIn('9uioxkGzjvGjkse3V35I9AhorWfIjBcrf3UPMS0bw2c=\t6Fsg8XN0DE6aPQgAX4r2oazEYJOGqyHUz3QRH…
1528 …self.assertIn('TTiCUpCxS7zDn/ax4p5W6Evg41r8hOrnWQw2Sq6Nh10=\tit7nd33chCT/tKT2ZZWfYyp43Zs+6oif72hex…
1529 …self.assertIn('lsDtM3AbjxNlauRKzHEPfgS1Zp7cp/VX5Use/P4PQSc=\tcPLOy1YUrEI0EMMIycPJmOo0aTu3RZnw8bL5m…
1530 …self.assertIn('RDf+LSpeEre7YEIKaxg+wbpsNV7du+ktR99uBEtIiCA=\tIIWIV17wutHv7t4cR6pOT91z6NSz/T8Arh0ya…
1533 self.assertEqual(output, 'CJQUtcS9emY2fLYqDlpSZiE/QJyHkPWr+WHtZLZ90FU=')
1536 self.assertEqual(output, '51821')
1538 self.assertEqual(output, '0x4d3')
1540 def test_geneve(self): argument
1544 self.wait_online(['geneve99:degraded'])
1548 self.assertRegex(output, '192.168.22.1')
1549 self.assertRegex(output, '6082')
1550 self.assertRegex(output, 'udpcsum')
1551 self.assertRegex(output, 'udp6zerocsumrx')
1553 def test_ipip_tunnel(self): argument
1560 …self.wait_online(['ipiptun99:routable', 'ipiptun98:routable', 'ipiptun97:routable', 'ipiptun96:rou…
1564 … self.assertRegex(output, 'ipip (ipip )?remote 192.169.224.239 local 192.168.223.238 dev dummy98')
1567 self.assertRegex(output, 'ipip (ipip )?remote 192.169.224.239 local any dev dummy98')
1570 self.assertRegex(output, 'ipip (ipip )?remote any local 192.168.223.238 dev dummy98')
1573 self.assertRegex(output, 'ipip (ipip )?remote any local any dev dummy98')
1575 def test_gre_tunnel(self): argument
1582 …self.wait_online(['gretun99:routable', 'gretun98:routable', 'gretun97:routable', 'gretun96:routabl…
1586 self.assertRegex(output, 'gre remote 10.65.223.239 local 10.65.223.238 dev dummy98')
1587 self.assertRegex(output, 'ikey 1.2.3.103')
1588 self.assertRegex(output, 'okey 1.2.4.103')
1589 self.assertRegex(output, 'iseq')
1590 self.assertRegex(output, 'oseq')
1593 self.assertRegex(output, 'gre remote 10.65.223.239 local any dev dummy98')
1594 self.assertRegex(output, 'ikey 0.0.0.104')
1595 self.assertRegex(output, 'okey 0.0.0.104')
1596 self.assertNotRegex(output, 'iseq')
1597 self.assertNotRegex(output, 'oseq')
1600 self.assertRegex(output, 'gre remote any local 10.65.223.238 dev dummy98')
1601 self.assertRegex(output, 'ikey 0.0.0.105')
1602 self.assertRegex(output, 'okey 0.0.0.105')
1603 self.assertNotRegex(output, 'iseq')
1604 self.assertNotRegex(output, 'oseq')
1607 self.assertRegex(output, 'gre remote any local any dev dummy98')
1608 self.assertRegex(output, 'ikey 0.0.0.106')
1609 self.assertRegex(output, 'okey 0.0.0.106')
1610 self.assertNotRegex(output, 'iseq')
1611 self.assertNotRegex(output, 'oseq')
1613 def test_ip6gre_tunnel(self): argument
1623 self.check_link_exists('dummy98')
1624 self.check_link_exists('ip6gretun99')
1625 self.check_link_exists('ip6gretun98')
1626 self.check_link_exists('ip6gretun97')
1627 self.check_link_exists('ip6gretun96')
1631 …self.assertRegex(output, 'ip6gre remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 d…
1634 self.assertRegex(output, 'ip6gre remote 2001:473:fece:cafe::5179 local any dev dummy98')
1637 self.assertRegex(output, 'ip6gre remote any local 2a00:ffde:4567:edde::4987 dev dummy98')
1640 self.assertRegex(output, 'ip6gre remote any local any dev dummy98')
1642 def test_gretap_tunnel(self): argument
1647 self.wait_online(['gretap99:routable', 'gretap98:routable', 'dummy98:degraded'])
1651 self.assertRegex(output, 'gretap remote 10.65.223.239 local 10.65.223.238 dev dummy98')
1652 self.assertRegex(output, 'ikey 0.0.0.106')
1653 self.assertRegex(output, 'okey 0.0.0.106')
1654 self.assertRegex(output, 'iseq')
1655 self.assertRegex(output, 'oseq')
1658 self.assertRegex(output, 'gretap remote 10.65.223.239 local any dev dummy98')
1659 self.assertRegex(output, 'ikey 0.0.0.107')
1660 self.assertRegex(output, 'okey 0.0.0.107')
1661 self.assertRegex(output, 'iseq')
1662 self.assertRegex(output, 'oseq')
1664 def test_ip6gretap_tunnel(self): argument
1669 self.wait_online(['ip6gretap99:routable', 'ip6gretap98:routable', 'dummy98:degraded'])
1673 …self.assertRegex(output, 'ip6gretap remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::498…
1676 self.assertRegex(output, 'ip6gretap remote 2001:473:fece:cafe::5179 local any dev dummy98')
1678 def test_vti_tunnel(self): argument
1685 …self.wait_online(['vtitun99:routable', 'vtitun98:routable', 'vtitun97:routable', 'vtitun96:routabl…
1689 self.assertRegex(output, 'vti remote 10.65.223.239 local 10.65.223.238 dev dummy98')
1692 self.assertRegex(output, 'vti remote 10.65.223.239 local any dev dummy98')
1695 self.assertRegex(output, 'vti remote any local 10.65.223.238 dev dummy98')
1698 self.assertRegex(output, 'vti remote any local any dev dummy98')
1700 def test_vti6_tunnel(self): argument
1706 …self.wait_online(['vti6tun99:routable', 'vti6tun98:routable', 'vti6tun97:routable', 'dummy98:degra…
1710 …self.assertRegex(output, 'vti6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev…
1713 self.assertRegex(output, 'vti6 remote 2001:473:fece:cafe::5179 local (any|::) dev dummy98')
1716 self.assertRegex(output, 'vti6 remote (any|::) local 2a00:ffde:4567:edde::4987 dev dummy98')
1718 def test_ip6tnl_tunnel(self): argument
1727 self.wait_online(['ip6tnl99:routable', 'ip6tnl98:routable', 'ip6tnl97:routable',
1733 …self.assertIn('ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev d…
1736 …self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local (any|::) dev dummy98…
1739 …self.assertRegex(output, 'ip6tnl ip6ip6 remote (any|::) local 2a00:ffde:4567:edde::4987 dev dummy9…
1742 self.assertIn('ip6tnl-external@NONE:', output)
1743 self.assertIn('ip6tnl external ', output)
1746 …self.assertIn('ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local 2002:da8:1:0:1034:56ff:fe78:9ab…
1750 self.assertIn('inet6 2002:da8:1:0:1034:56ff:fe78:9abc/64 scope global dynamic', output)
1754 self.assertIn('default dev ip6tnl-slaac proto static', output)
1756 def test_sit_tunnel(self): argument
1763 …self.wait_online(['sittun99:routable', 'sittun98:routable', 'sittun97:routable', 'sittun96:routabl…
1767 … self.assertRegex(output, "sit (ip6ip )?remote 10.65.223.239 local 10.65.223.238 dev dummy98")
1770 self.assertRegex(output, "sit (ip6ip )?remote 10.65.223.239 local any dev dummy98")
1773 self.assertRegex(output, "sit (ip6ip )?remote any local 10.65.223.238 dev dummy98")
1776 self.assertRegex(output, "sit (ip6ip )?remote any local any dev dummy98")
1778 def test_isatap_tunnel(self): argument
1782 self.wait_online(['isataptun99:routable', 'dummy98:degraded'])
1786 self.assertRegex(output, "isatap ")
1788 def test_6rd_tunnel(self): argument
1792 self.wait_online(['sittun99:routable', 'dummy98:degraded'])
1796 self.assertRegex(output, '6rd-prefix 2602::/24')
1799 def test_erspan_tunnel(self): argument
1804 self.wait_online(['erspan99:routable', 'erspan98:routable', 'dummy98:degraded'])
1808 self.assertRegex(output, 'erspan remote 172.16.1.100 local 172.16.1.200')
1809 self.assertRegex(output, 'ikey 0.0.0.101')
1810 self.assertRegex(output, 'okey 0.0.0.101')
1811 self.assertRegex(output, 'iseq')
1812 self.assertRegex(output, 'oseq')
1815 self.assertRegex(output, 'erspan remote 172.16.1.100 local any')
1816 self.assertRegex(output, '102')
1817 self.assertRegex(output, 'ikey 0.0.0.102')
1818 self.assertRegex(output, 'okey 0.0.0.102')
1819 self.assertRegex(output, 'iseq')
1820 self.assertRegex(output, 'oseq')
1822 def test_tunnel_independent(self): argument
1826 self.wait_online(['ipiptun99:carrier'])
1828 def test_tunnel_independent_loopback(self): argument
1832 self.wait_online(['ipiptun99:carrier'])
1835 def test_xfrm(self): argument
1841 self.wait_online(['dummy98:degraded', 'xfrm98:degraded', 'xfrm99:degraded'])
1845 self.assertIn('xfrm98@dummy98:', output)
1846 self.assertIn('xfrm if_id 0x98 ', output)
1850 self.assertIn('xfrm99@lo:', output)
1851 self.assertIn('xfrm if_id 0x99 ', output)
1854 def test_fou(self): argument
1857 self.assertTrue(is_module_available('fou'))
1864 …self.wait_online(['ipiptun96:off', 'sittun96:off', 'gretun96:off', 'gretap96:off'], setup_state='u…
1868 self.assertRegex(output, 'port 55555 ipproto 4')
1869 self.assertRegex(output, 'port 55556 ipproto 47')
1873 self.assertRegex(output, 'encap fou encap-sport auto encap-dport 55555')
1876 self.assertRegex(output, 'encap fou encap-sport auto encap-dport 55555')
1879 self.assertRegex(output, 'encap fou encap-sport 1001 encap-dport 55556')
1882 self.assertRegex(output, 'encap fou encap-sport auto encap-dport 55556')
1884 def test_vxlan(self): argument
1893 self.wait_online(['test1:degraded', 'veth99:routable', 'veth-peer:degraded',
1898 self.assertIn('999', output)
1899 self.assertIn('5555', output)
1900 self.assertIn('l2miss', output)
1901 self.assertIn('l3miss', output)
1902 self.assertIn('udpcsum', output)
1903 self.assertIn('udp6zerocsumtx', output)
1904 self.assertIn('udp6zerocsumrx', output)
1905 self.assertIn('remcsumtx', output)
1906 self.assertIn('remcsumrx', output)
1907 self.assertIn('gbp', output)
1911 self.assertIn('00:11:22:33:44:55 dst 10.0.0.5 self permanent', output)
1912 self.assertIn('00:11:22:33:44:66 dst 10.0.0.6 self permanent', output)
1913 self.assertIn('00:11:22:33:44:77 dst 10.0.0.7 via test1 self permanent', output)
1917 self.assertIn('VNI: 999', output)
1918 self.assertIn('Destination Port: 5555', output)
1919 self.assertIn('Underlying Device: test1', output)
1923 … self.assertIn('00:00:00:00:00:00 dst fe80::23b:d2ff:fe95:967f via test1 self permanent', output)
1924 … self.assertIn('00:00:00:00:00:00 dst fe80::27c:16ff:fec0:6c74 via test1 self permanent', output)
1925 … self.assertIn('00:00:00:00:00:00 dst fe80::2a2:e4ff:fef9:2269 via test1 self permanent', output)
1929 self.assertIn('vxlan id 4831584 local 2002:da8:1:0:1034:56ff:fe78:9abc dev veth99', output)
1933 self.assertIn('inet6 2002:da8:1:0:1034:56ff:fe78:9abc/64 scope global dynamic', output)
1936 def test_macsec(self): argument
1941 self.wait_online(['dummy98:degraded', 'macsec99:routable'])
1945 self.assertRegex(output, 'macsec99@dummy98')
1946 self.assertRegex(output, 'macsec sci [0-9a-f]*000b')
1947 self.assertRegex(output, 'encrypt on')
1951 self.assertRegex(output, 'encrypt on')
1952 self.assertRegex(output, 'TXSC: [0-9a-f]*000b on SA 1')
1953 self.assertRegex(output, '0: PN [0-9]*, state on, key 01000000000000000000000000000000')
1954 self.assertRegex(output, '1: PN [0-9]*, state on, key 02030000000000000000000000000000')
1955 self.assertRegex(output, 'RXSC: c619528fe6a00100, state on')
1956 self.assertRegex(output, '0: PN [0-9]*, state on, key 02030405000000000000000000000000')
1957 self.assertRegex(output, '1: PN [0-9]*, state on, key 02030405060000000000000000000000')
1958 self.assertRegex(output, '2: PN [0-9]*, state off, key 02030405060700000000000000000000')
1959 self.assertRegex(output, '3: PN [0-9]*, state off, key 02030405060708000000000000000000')
1960 self.assertNotRegex(output, 'key 02030405067080900000000000000000')
1961 self.assertRegex(output, 'RXSC: 8c16456c83a90002, state on')
1962 self.assertRegex(output, '0: PN [0-9]*, state off, key 02030400000000000000000000000000')
1964 def test_nlmon(self): argument
1968 self.wait_online(['nlmon99:carrier'])
1971 def test_ifb(self): argument
1975 self.wait_online(['ifb99:degraded'])
1995 def setUp(self): argument
1996 remove_l2tp_tunnels(self.l2tp_tunnel_ids)
1997 remove_links(self.links)
2000 def tearDown(self): argument
2001 remove_l2tp_tunnels(self.l2tp_tunnel_ids)
2002 remove_links(self.links)
2003 remove_unit_from_networkd_path(self.units)
2007 def test_l2tp_udp(self): argument
2012 self.wait_online(['test1:routable', 'l2tp-ses1:degraded', 'l2tp-ses2:degraded'])
2016 self.assertRegex(output, "Tunnel 10, encap UDP")
2017 self.assertRegex(output, "From 192.168.30.100 to 192.168.30.101")
2018 self.assertRegex(output, "Peer tunnel 11")
2019 self.assertRegex(output, "UDP source / dest ports: 3000/4000")
2020 self.assertRegex(output, "UDP checksum: enabled")
2024 self.assertRegex(output, "Session 15 in tunnel 10")
2025 self.assertRegex(output, "Peer session 16, tunnel 11")
2026 self.assertRegex(output, "interface name: l2tp-ses1")
2030 self.assertRegex(output, "Session 17 in tunnel 10")
2031 self.assertRegex(output, "Peer session 18, tunnel 11")
2032 self.assertRegex(output, "interface name: l2tp-ses2")
2035 def test_l2tp_ip(self): argument
2040 self.wait_online(['test1:routable', 'l2tp-ses3:degraded', 'l2tp-ses4:degraded'])
2044 self.assertRegex(output, "Tunnel 10, encap IP")
2045 self.assertRegex(output, "From 192.168.30.100 to 192.168.30.101")
2046 self.assertRegex(output, "Peer tunnel 12")
2050 self.assertRegex(output, "Session 25 in tunnel 10")
2051 self.assertRegex(output, "Peer session 26, tunnel 12")
2052 self.assertRegex(output, "interface name: l2tp-ses3")
2056 self.assertRegex(output, "Session 27 in tunnel 10")
2057 self.assertRegex(output, "Peer session 28, tunnel 12")
2058 self.assertRegex(output, "interface name: l2tp-ses4")
2150 def setUp(self): argument
2152 remove_routing_policy_rule_tables(self.routing_policy_rule_tables)
2153 remove_routes(self.routes)
2154 remove_links(self.links)
2158 def tearDown(self): argument
2160 remove_routing_policy_rule_tables(self.routing_policy_rule_tables)
2161 remove_routes(self.routes)
2162 remove_links(self.links)
2163 remove_unit_from_networkd_path(self.units)
2164 remove_networkd_conf_dropin(self.networkd_conf_dropins)
2168 def test_address_static(self): argument
2171 self.assertEqual(rc, 0)
2173 self.assertEqual(rc, 0)
2175 self.assertEqual(rc, 0)
2176 self.wait_address('dummy98', '2001:db8:0:f101::15/128', ipv='-6')
2178 self.assertEqual(rc, 0)
2179 self.wait_address('dummy98', '10.3.2.3/16 brd 10.3.255.250', ipv='-4')
2184 self.wait_online(['dummy98:routable'])
2188 self.assertIn('inet 10.1.2.3/16 brd 10.1.255.255 scope global dummy98', output)
2189 self.assertIn('inet 10.1.2.4/16 brd 10.1.255.255 scope global secondary dummy98', output)
2190 self.assertIn('inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98', output)
2191 self.assertIn('inet 10.7.8.9/16 brd 10.7.255.255 scope link deprecated dummy98', output)
2192 self.assertIn('inet 10.8.8.1/16 scope global dummy98', output)
2193 self.assertIn('inet 10.8.8.2/16 brd 10.8.8.128 scope global secondary dummy98', output)
2194 … self.assertRegex(output, 'inet 10.9.0.1/16 (metric 128 |)brd 10.9.255.255 scope global dummy98')
2198 self.assertIn(f'inet 10.3.3.{i}/16 brd 10.3.255.255', output)
2201 self.assertNotIn('10.10.0.1/16', output)
2202 self.assertNotIn('10.10.0.2/16', output)
2205 self.assertIn('inet 10.3.2.3/16 brd 10.3.255.255 scope global 32', output)
2208 self.assertIn('inet 10.4.2.3 peer 10.4.2.4/16 scope global 33', output)
2211 self.assertRegex(output, r'inet 192.168.[0-9]*.1/24 brd 192.168.[0-9]*.255 scope global 34')
2214 self.assertRegex(output, r'inet 172.[0-9]*.0.1/16 brd 172.[0-9]*.255.255 scope global 35')
2218 self.assertIn('10.9.0.0/16 proto kernel scope link src 10.9.0.1 metric 128', output)
2222 self.assertIn('inet6 2001:db8:0:f101::15/64 scope global', output)
2223 self.assertIn('inet6 2001:db8:0:f101::16/64 scope global', output)
2224 self.assertIn('inet6 2001:db8:0:f102::15/64 scope global', output)
2225 self.assertIn('inet6 2001:db8:0:f102::16/64 scope global', output)
2226 self.assertIn('inet6 2001:db8:0:f103::20 peer 2001:db8:0:f103::10/128 scope global', output)
2227 self.assertIn('inet6 2001:db8:1:f101::1/64 scope global deprecated', output)
2228 self.assertRegex(output, r'inet6 fd[0-9a-f:]*1/64 scope global')
2232 self.assertEqual(call('ip address change 10.7.8.9/16 dev dummy98 preferred_lft forever'), 0)
2233 …self.assertEqual(call('ip address change 2001:db8:1:f101::1/64 dev dummy98 preferred_lft forever')…
2236 self.assertNotIn('deprecated', output)
2239 self.assertNotIn('deprecated', output)
2243 self.wait_online(['dummy98:routable'])
2248 self.assertIn('inet 10.7.8.9/16 brd 10.7.255.255 scope link deprecated dummy98', output)
2251 self.assertIn('inet6 2001:db8:1:f101::1/64 scope global deprecated', output)
2256 self.assertIn(f'inet 10.3.3.{i}/16 brd 10.3.255.255', output)
2261 def test_address_ipv4acd(self): argument
2271 self.wait_online(['veth99:routable'])
2275 self.assertNotIn('192.168.100.10/24', output)
2276 self.assertIn('192.168.100.11/24', output)
2282 self.assertTrue(rc == 1)
2286 self.assertNotIn('192.168.100.10/24', output)
2287 self.assertIn('192.168.100.11/24', output)
2289 def test_address_peer_ipv4(self): argument
2299 self.wait_online(['dummy98:routable'])
2302 self.assertIn('inet 100.64.0.1 peer 100.64.0.2/32 scope global', output)
2305 def test_prefix_route(self): argument
2315 self.wait_online(['dummy98:routable', 'test1:routable', 'vrf99:carrier'])
2320 self.assertRegex(output, 'local 10.20.22.1 proto kernel scope host src 10.20.22.1')
2321 self.assertRegex(output, '10.20.33.0/24 proto kernel scope link src 10.20.33.1')
2322 self.assertRegex(output, 'local 10.20.33.1 proto kernel scope host src 10.20.33.1')
2323 … self.assertRegex(output, 'broadcast 10.20.33.255 proto kernel scope link src 10.20.33.1')
2324 self.assertRegex(output, 'local 10.20.44.1 proto kernel scope host src 10.20.44.1')
2325 self.assertRegex(output, 'local 10.20.55.1 proto kernel scope host src 10.20.55.1')
2326 … self.assertRegex(output, 'broadcast 10.20.55.255 proto kernel scope link src 10.20.55.1')
2332 self.assertRegex(output, 'local fdde:11:22::1 proto kernel metric 0 pref medium')
2334 self.assertRegex(output, 'local fdde:11:33::1 proto kernel metric 0 pref medium')
2335 self.assertRegex(output, 'fdde:11:33::/64 proto kernel metric 256 pref medium')
2336 self.assertRegex(output, 'local fdde:11:44::1 proto kernel metric 0 pref medium')
2337 self.assertRegex(output, 'local fdde:11:55::1 proto kernel metric 0 pref medium')
2338 self.assertRegex(output, 'fe80::/64 proto kernel metric 256 pref medium')
2339 self.assertRegex(output, 'ff00::/8 (proto kernel )?metric 256 (linkdown )?pref medium')
2346 self.assertRegex(output, '10.21.33.0/24 proto kernel scope link src 10.21.33.1')
2350 self.assertRegex(output, 'local 10.21.22.1 proto kernel scope host src 10.21.22.1')
2351 self.assertRegex(output, 'local 10.21.33.1 proto kernel scope host src 10.21.33.1')
2352 … self.assertRegex(output, 'broadcast 10.21.33.255 proto kernel scope link src 10.21.33.1')
2353 self.assertRegex(output, 'local 10.21.44.1 proto kernel scope host src 10.21.44.1')
2354 self.assertRegex(output, 'local 10.21.55.1 proto kernel scope host src 10.21.55.1')
2355 … self.assertRegex(output, 'broadcast 10.21.55.255 proto kernel scope link src 10.21.55.1')
2359 self.assertRegex(output, 'fdde:12:22::1 proto kernel metric 256 pref medium')
2360 self.assertRegex(output, 'fdde:12:33::/64 proto kernel metric 256 pref medium')
2361 self.assertRegex(output, 'fe80::/64 proto kernel metric 256 pref medium')
2365 self.assertRegex(output, 'local fdde:12:22::1 proto kernel metric 0 pref medium')
2366 self.assertRegex(output, 'local fdde:12:33::1 proto kernel metric 0 pref medium')
2367 self.assertRegex(output, 'local fdde:12:44::1 proto kernel metric 0 pref medium')
2368 self.assertRegex(output, 'local fdde:12:55::1 proto kernel metric 0 pref medium')
2369 self.assertRegex(output, 'ff00::/8 (proto kernel )?metric 256 (linkdown )?pref medium')
2371 def test_configure_without_carrier(self): argument
2374 self.wait_operstate('test1', 'off', '')
2379 self.wait_online(['test1:no-carrier'])
2384 with self.subTest(carrier=carrier):
2387 self.wait_online([f'test1:{routable_map[carrier]}:{routable_map[carrier]}'])
2391 self.assertRegex(output, '192.168.0.15')
2392 self.assertRegex(output, '192.168.0.1')
2393 self.assertRegex(output, routable_map[carrier])
2395 def test_configure_without_carrier_yes_ignore_carrier_loss_no(self): argument
2398 self.wait_operstate('test1', 'off', '')
2403 self.wait_online(['test1:no-carrier'])
2408 with self.subTest(carrier=carrier, have_config=have_config):
2411 self.wait_online([f'test1:{routable_map[carrier]}:{routable_map[carrier]}'])
2416 self.assertRegex(output, '192.168.0.15')
2417 self.assertRegex(output, '192.168.0.1')
2419 self.assertNotRegex(output, '192.168.0.15')
2420 self.assertNotRegex(output, '192.168.0.1')
2421 self.assertRegex(output, routable_map[carrier])
2423 def test_routing_policy_rule(self): argument
2426 self.wait_online(['test1:degraded'])
2430 self.assertRegex(output, '111:')
2431 self.assertRegex(output, 'from 192.168.100.18')
2432 self.assertRegex(output, r'tos (0x08|throughput)\s')
2433 self.assertRegex(output, 'iif test1')
2434 self.assertRegex(output, 'oif test1')
2435 self.assertRegex(output, 'lookup 7')
2439 self.assertRegex(output, '101:')
2440 self.assertRegex(output, 'from all')
2441 self.assertRegex(output, 'iif test1')
2442 self.assertRegex(output, 'lookup 9')
2446 self.assertRegex(output, '100:')
2447 self.assertRegex(output, 'from all')
2448 self.assertRegex(output, 'iif test1')
2449 self.assertRegex(output, 'lookup 8')
2453 self.assertRegex(output, '102:')
2454 self.assertRegex(output, 'from 0.0.0.0/8')
2455 self.assertRegex(output, 'iif test1')
2456 self.assertRegex(output, 'lookup 10')
2461 def test_routing_policy_rule_issue_11280(self): argument
2468 self.wait_online(['test1:degraded', 'dummy98:degraded'])
2473 …self.assertRegex(output, '111: from 192.168.100.18 tos (0x08|throughput) iif test1 oif test1 looku…
2477 …self.assertRegex(output, '112: from 192.168.101.18 tos (0x08|throughput) iif dummy98 oif dummy98 l…
2481 def test_routing_policy_rule_reconfigure(self): argument
2484 self.wait_online(['test1:degraded'])
2488 self.assertIn('10111: from all fwmark 0x3f3 lookup 1011', output)
2489 self.assertIn('10112: from all oif test1 lookup 1011', output)
2490 self.assertIn('10113: from all iif test1 lookup 1011', output)
2491 self.assertIn('10114: from 192.168.8.254 lookup 1011', output)
2495 self.assertIn('10112: from all oif test1 lookup 1011', output)
2500 self.wait_online(['test1:degraded'])
2504 self.assertIn('10111: from all fwmark 0x3f3 lookup 1011', output)
2505 self.assertIn('10112: from all oif test1 lookup 1011', output)
2506 self.assertIn('10113: from all iif test1 lookup 1011', output)
2507 self.assertIn('10114: from 192.168.8.254 lookup 1011', output)
2511 self.assertNotIn('10112: from all oif test1 lookup 1011', output)
2512 self.assertIn('10113: from all iif test1 lookup 1011', output)
2522 self.assertEqual(output, '')
2526 self.assertEqual(output, '')
2529 self.wait_online(['test1:degraded'])
2533 self.assertIn('10111: from all fwmark 0x3f3 lookup 1011', output)
2534 self.assertIn('10112: from all oif test1 lookup 1011', output)
2535 self.assertIn('10113: from all iif test1 lookup 1011', output)
2536 self.assertIn('10114: from 192.168.8.254 lookup 1011', output)
2540 self.assertIn('10113: from all iif test1 lookup 1011', output)
2543 def test_routing_policy_rule_port_range(self): argument
2546 self.wait_online(['test1:degraded'])
2550 self.assertRegex(output, '111')
2551 self.assertRegex(output, 'from 192.168.100.18')
2552 self.assertRegex(output, '1123-1150')
2553 self.assertRegex(output, '3224-3290')
2554 self.assertRegex(output, 'tcp')
2555 self.assertRegex(output, 'lookup 7')
2558 def test_routing_policy_rule_invert(self): argument
2561 self.wait_online(['test1:degraded'])
2565 self.assertRegex(output, '111')
2566 self.assertRegex(output, 'not.*?from.*?192.168.100.18')
2567 self.assertRegex(output, 'tcp')
2568 self.assertRegex(output, 'lookup 7')
2571 def test_routing_policy_rule_uidrange(self): argument
2574 self.wait_online(['test1:degraded'])
2578 self.assertRegex(output, '111')
2579 self.assertRegex(output, 'from 192.168.100.18')
2580 self.assertRegex(output, 'lookup 7')
2581 self.assertRegex(output, 'uidrange 100-200')
2583 def _test_route_static(self, manage_foreign_routes): argument
2589 self.wait_online(['dummy98:routable'])
2597 self.assertIn('2001:1234:5:8fff:ff:ff:ff:ff proto static', output)
2598 self.assertIn('2001:1234:5:8f63::1 proto kernel', output)
2599 … self.assertIn('2001:1234:5:afff:ff:ff:ff:ff via fe80:0:222:4dff:ff:ff:ff:ff proto static', output)
2604 self.assertIn('default', output)
2605 self.assertIn('via 2001:1234:5:8fff:ff:ff:ff:ff', output)
2610 self.assertIn('149.10.124.48/28 proto kernel scope link src 149.10.124.58', output)
2611 self.assertIn('149.10.124.64 proto static scope link', output)
2612 self.assertIn('169.254.0.0/16 proto static scope link metric 2048', output)
2613 self.assertIn('192.168.1.1 proto static scope link initcwnd 20', output)
2614 self.assertIn('192.168.1.2 proto static scope link initrwnd 30', output)
2615 self.assertIn('192.168.1.3 proto static scope link advmss 30', output)
2616 self.assertIn('multicast 149.10.123.4 proto static', output)
2621 self.assertIn('default via 149.10.125.65 proto static onlink', output)
2622 self.assertIn('default via 149.10.124.64 proto static', output)
2623 self.assertIn('default proto static', output)
2628 self.assertIn('local 149.10.123.1 proto static scope host', output)
2629 self.assertIn('anycast 149.10.123.2 proto static scope link', output)
2630 self.assertIn('broadcast 149.10.123.3 proto static scope link', output)
2635 self.assertIn('blackhole 202.54.1.2 proto static', output)
2640 self.assertIn('unreachable 202.54.1.3 proto static', output)
2645 self.assertIn('prohibit 202.54.1.4 proto static', output)
2650 self.assertIn('blackhole 2001:1234:5678::2 dev lo proto static', output)
2655 self.assertIn('unreachable 2001:1234:5678::3 dev lo proto static', output)
2660 self.assertIn('prohibit 2001:1234:5678::4 dev lo proto static', output)
2665 self.assertIn('192.168.10.1 proto static', output)
2666 self.assertIn('nexthop via 149.10.124.59 dev dummy98 weight 10', output)
2667 self.assertIn('nexthop via 149.10.124.60 dev dummy98 weight 5', output)
2673 self.assertIn('192.168.10.2 proto static', output)
2674 self.assertIn('nexthop', output)
2675 self.assertIn('dev dummy98 weight 10', output)
2676 self.assertIn('dev dummy98 weight 5', output)
2682 self.assertIn('2001:1234:5:7fff:ff:ff:ff:ff', output)
2683 self.assertIn('via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98', output)
2684 self.assertIn('via 2001:1234:5:9fff:ff:ff:ff:ff dev dummy98', output)
2692 self.wait_online(['dummy98:routable'])
2698 self.assertEqual(output, '')
2703 self.assertEqual(output, '')
2708 self.assertEqual(output, '')
2713 self.assertEqual(output, '')
2718 self.assertEqual(output, '')
2723 self.assertEqual(output, '')
2728 self.wait_online(['dummy98:routable'])
2734 self.assertIn('blackhole 202.54.1.2 proto static', output)
2739 self.assertIn('unreachable 202.54.1.3 proto static', output)
2744 self.assertIn('prohibit 202.54.1.4 proto static', output)
2749 self.assertIn('blackhole 2001:1234:5678::2 dev lo proto static', output)
2754 self.assertIn('unreachable 2001:1234:5678::3 dev lo proto static', output)
2759 self.assertIn('prohibit 2001:1234:5678::4 dev lo proto static', output)
2762 self.assertEqual(rc, 0)
2769 self.assertEqual(output, '')
2774 self.assertEqual(output, '')
2779 self.assertEqual(output, '')
2784 self.assertEqual(output, '')
2789 self.assertEqual(output, '')
2794 self.assertEqual(output, '')
2796 self.tearDown()
2798 def test_route_static(self): argument
2800 with self.subTest(manage_foreign_routes=manage_foreign_routes):
2801 self._test_route_static(manage_foreign_routes)
2804 def test_route_via_ipv6(self): argument
2807 self.wait_online(['dummy98:routable'])
2815 self.assertRegex(output, '2001:1234:5:8fff:ff:ff:ff:ff proto static')
2816 self.assertRegex(output, '2001:1234:5:8f63::1 proto kernel')
2821 self.assertRegex(output, '149.10.124.48/28 proto kernel scope link src 149.10.124.58')
2822 … self.assertRegex(output, '149.10.124.66 via inet6 2001:1234:5:8fff:ff:ff:ff:ff proto static')
2825 def test_route_vrf(self): argument
2829 self.wait_online(['dummy98:routable', 'vrf99:carrier'])
2833 self.assertRegex(output, 'default via 192.168.100.1')
2837 self.assertNotRegex(output, 'default via 192.168.100.1')
2839 def test_gateway_reconfigure(self): argument
2842 self.wait_online(['dummy98:routable'])
2846 self.assertRegex(output, 'default via 149.10.124.59 proto static')
2847 self.assertNotRegex(output, '149.10.124.60')
2852 self.wait_online(['dummy98:routable'])
2856 self.assertNotRegex(output, '149.10.124.59')
2857 self.assertRegex(output, 'default via 149.10.124.60 proto static')
2859 def test_ip_route_ipv6_src_route(self): argument
2865 self.wait_online(['dummy98:enslaved', 'bond199:routable'])
2869 self.assertRegex(output, 'abcd::/16')
2870 self.assertRegex(output, 'src')
2871 self.assertRegex(output, '2001:1234:56:8f63::2')
2873 def test_ip_link_mac_address(self): argument
2876 self.wait_online(['dummy98:degraded'])
2880 self.assertRegex(output, '00:01:02:aa:bb:cc')
2882 def test_ip_link_unmanaged(self): argument
2886 self.check_link_exists('dummy98')
2888 self.wait_operstate('dummy98', 'off', setup_state='unmanaged')
2890 def test_ipv6_address_label(self): argument
2893 self.wait_online(['dummy98:degraded'])
2897 self.assertRegex(output, '2004:da8:1::/64')
2899 def test_ipv6_proxy_ndp(self): argument
2903 self.wait_online(['dummy98:routable'])
2908 self.assertRegex(output, f'2607:5300:203:5215:{i}::1 *proxy')
2910 def test_neighbor_section(self): argument
2913 self.wait_online(['dummy98:degraded'], timeout='40s')
2918 self.assertRegex(output, '192.168.10.1.*00:00:5e:00:02:65.*PERMANENT')
2919 self.assertRegex(output, '2004:da8:1::1.*00:00:5e:00:02:66.*PERMANENT')
2924 def test_neighbor_reconfigure(self): argument
2927 self.wait_online(['dummy98:degraded'], timeout='40s')
2932 self.assertRegex(output, '192.168.10.1.*00:00:5e:00:02:65.*PERMANENT')
2933 self.assertRegex(output, '2004:da8:1::1.*00:00:5e:00:02:66.*PERMANENT')
2938 self.wait_online(['dummy98:degraded'], timeout='40s')
2942 self.assertNotRegex(output, '192.168.10.1.*00:00:5e:00:02:65.*PERMANENT')
2943 self.assertRegex(output, '192.168.10.1.*00:00:5e:00:02:66.*PERMANENT')
2944 self.assertNotRegex(output, '2004:da8:1::1.*PERMANENT')
2946 def test_neighbor_gre(self): argument
2950 … self.wait_online(['dummy98:degraded', 'gretun97:routable', 'ip6gretun97:routable'], timeout='40s')
2954 self.assertRegex(output, '10.0.0.22 lladdr 10.65.223.239 PERMANENT')
2958 …self.assertRegex(output, '2001:db8:0:f102::17 lladdr 2a:?00:ff:?de:45:?67:ed:?de:[0:]*:49:?88 PERM…
2963 def test_link_local_addressing(self): argument
2967 self.wait_online(['test1:degraded', 'dummy98:carrier'])
2971 self.assertRegex(output, 'inet .* scope link')
2972 self.assertRegex(output, 'inet6 .* scope link')
2976 self.assertNotRegex(output, 'inet6* .* scope link')
2990 …self.assertEqual(read_ipv6_sysctl_attr('test1', 'stable_secret'), '0123:4567:89ab:cdef:0123:4567:8…
2991 self.assertEqual(read_ipv6_sysctl_attr('test1', 'addr_gen_mode'), '2')
2992 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'addr_gen_mode'), '1')
2994 def test_link_local_addressing_ipv6ll(self): argument
2997 self.wait_online(['dummy98:degraded'])
3002 self.assertRegex(output, 'inet6 .* scope link')
3007 self.wait_online(['dummy98:carrier'])
3012 self.assertNotRegex(output, 'inet6 .* scope link')
3017 self.wait_online(['dummy98:degraded'])
3022 self.assertRegex(output, 'inet6 .* scope link')
3024 def test_sysctl(self): argument
3027 self.wait_online(['dummy98:degraded'])
3029 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'forwarding'), '1')
3030 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'use_tempaddr'), '2')
3031 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'dad_transmits'), '3')
3032 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'hop_limit'), '5')
3033 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'proxy_ndp'), '1')
3034 self.assertEqual(read_ipv4_sysctl_attr('dummy98', 'forwarding'),'1')
3035 self.assertEqual(read_ipv4_sysctl_attr('dummy98', 'proxy_arp'), '1')
3036 self.assertEqual(read_ipv4_sysctl_attr('dummy98', 'accept_local'), '1')
3038 def test_sysctl_disable_ipv6(self): argument
3046 self.wait_online(['dummy98:routable'])
3050 self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope global dummy98')
3053 self.assertRegex(output, 'inet6 2607:5300:203:3906::/64 scope global')
3054 self.assertRegex(output, 'inet6 .* scope link')
3057 self.assertRegex(output, '10.2.0.0/16 proto kernel scope link src 10.2.3.4')
3060 self.assertRegex(output, 'default')
3061 self.assertRegex(output, 'via 2607:5300:203:39ff:ff:ff:ff:ff')
3070 self.wait_online(['dummy98:routable'])
3074 self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope global dummy98')
3077 self.assertRegex(output, 'inet6 2607:5300:203:3906::/64 scope global')
3078 self.assertRegex(output, 'inet6 .* scope link')
3081 self.assertRegex(output, '10.2.0.0/16 proto kernel scope link src 10.2.3.4')
3084 self.assertRegex(output, 'via 2607:5300:203:39ff:ff:ff:ff:ff')
3086 def test_bind_carrier(self): argument
3093 self.wait_online(['test1:routable'])
3097 self.assertRegex(output, 'UP,LOWER_UP')
3098 self.assertRegex(output, 'inet 192.168.10.30/24 brd 192.168.10.255 scope global test1')
3099 self.wait_operstate('test1', 'routable')
3106 self.assertRegex(output, 'UP,LOWER_UP')
3107 self.assertRegex(output, 'inet 192.168.10.30/24 brd 192.168.10.255 scope global test1')
3108 self.wait_operstate('test1', 'routable')
3114 self.assertRegex(output, 'UP,LOWER_UP')
3115 self.assertRegex(output, 'inet 192.168.10.30/24 brd 192.168.10.255 scope global test1')
3116 self.wait_operstate('test1', 'routable')
3122 self.assertNotRegex(output, 'UP,LOWER_UP')
3123 self.assertRegex(output, 'DOWN')
3124 self.assertNotRegex(output, '192.168.10')
3125 self.wait_operstate('test1', 'off')
3131 self.assertRegex(output, 'UP,LOWER_UP')
3132 self.assertRegex(output, 'inet 192.168.10.30/24 brd 192.168.10.255 scope global test1')
3133 self.wait_operstate('test1', 'routable')
3135 def _test_activation_policy(self, test, interface): argument
3150 self.wait_activated(interface)
3153 with self.subTest(iteration=iteration, expect_up=expect_up):
3156 self.wait_operstate(interface, operstate, setup_state=setup_state, setup_timeout=20)
3159 self.assertIn('UP', check_output(f'ip link show {interface}'))
3160 self.assertIn('192.168.10.30/24', check_output(f'ip address show {interface}'))
3161 … self.assertIn('default via 192.168.10.1', check_output(f'ip route show dev {interface}'))
3163 self.assertIn('DOWN', check_output(f'ip link show {interface}'))
3174 def test_activation_policy(self): argument
3176 with self.subTest(interface=interface):
3178 with self.subTest(test=test):
3179 self.setUp()
3180 self._test_activation_policy(test, interface)
3181 self.tearDown()
3183 def _test_activation_policy_required_for_online(self, policy, required): argument
3194 self.wait_activated('test1')
3197 self.wait_operstate('test1', 'off', setup_state='configuring')
3199 self.wait_online(['test1'])
3219 self.assertRegex(output, f'Required For Online: {yesno}')
3221 def test_activation_policy_required_for_online(self): argument
3224 with self.subTest(policy=policy, required=required):
3225 self.setUp()
3226 self._test_activation_policy_required_for_online(policy, required)
3227 self.tearDown()
3229 def test_domain(self): argument
3232 self.wait_online(['dummy98:routable'])
3236 self.assertRegex(output, 'Address: 192.168.42.100')
3237 self.assertRegex(output, 'DNS: 192.168.42.1')
3238 self.assertRegex(output, 'Search Domains: one')
3240 def test_keep_configuration_static(self): argument
3249 self.assertRegex(output, 'inet 10.1.2.3/16 scope global dummy98')
3250 self.assertRegex(output, 'inet 10.2.3.4/16 scope global dynamic dummy98')
3256 self.wait_online(['dummy98:routable'])
3260 self.assertRegex(output, 'inet 10.1.2.3/16 scope global dummy98')
3261 self.assertNotRegex(output, 'inet 10.2.3.4/16 scope global dynamic dummy98')
3264 def test_nexthop(self): argument
3265 def check_nexthop(self): argument
3266 self.wait_online(['veth99:routable', 'veth-peer:routable', 'dummy98:routable'])
3270 self.assertIn('id 1 via 192.168.5.1 dev veth99', output)
3271 self.assertIn('id 2 via 2001:1234:5:8f63::2 dev veth99', output)
3272 self.assertIn('id 3 dev veth99', output)
3273 self.assertIn('id 4 dev veth99', output)
3274 self.assertRegex(output, 'id 5 via 192.168.10.1 dev veth99 .*onlink')
3275 self.assertIn('id 8 via fe80:0:222:4dff:ff:ff:ff:ff dev veth99', output)
3276 self.assertRegex(output, r'id [0-9]* via 192.168.5.2 dev veth99')
3280 self.assertIn('id 20 via 192.168.20.1 dev dummy98', output)
3285 self.assertIn('id 6 blackhole', output)
3286 self.assertIn('id 7 blackhole', output)
3291 self.assertRegex(output, r'id 21 group (1,3/20|20/1,3)')
3295 self.assertEqual('10.10.10.10 nhid 1 via 192.168.5.1 proto static', output)
3299 … self.assertEqual('10.10.10.11 nhid 2 via inet6 2001:1234:5:8f63::2 proto static', output)
3303 self.assertEqual('10.10.10.12 nhid 5 via 192.168.10.1 proto static onlink', output)
3307 …self.assertEqual('2001:1234:5:8f62::1 nhid 2 via 2001:1234:5:8f63::2 proto static metric 1024 pref…
3311 self.assertEqual('blackhole 10.10.10.13 nhid 6 dev lo proto static', output)
3315 …self.assertEqual('blackhole 2001:1234:5:8f62::2 nhid 7 dev lo proto static metric 1024 pref medium…
3319 self.assertIn('10.10.10.14 nhid 21 proto static', output)
3320 self.assertIn('nexthop via 192.168.20.1 dev dummy98 weight 1', output)
3321 self.assertIn('nexthop via 192.168.5.1 dev veth99 weight 3', output)
3330 check_nexthop(self)
3335 self.assertEqual(rc, 0)
3338 self.wait_online(['veth99:routable', 'veth-peer:routable'])
3342 self.assertEqual(output, '')
3345 self.assertEqual(output, '')
3350 self.assertEqual(rc, 0)
3352 self.assertEqual(rc, 0)
3355 check_nexthop(self)
3358 self.assertEqual(rc, 0)
3363 self.assertEqual(output, '')
3365 def test_qdisc(self): argument
3371 self.wait_online(['dummy98:routable', 'test1:routable'])
3375 self.assertRegex(output, 'qdisc netem')
3376 self.assertRegex(output, 'limit 100 delay 50(.0)?ms 10(.0)?ms loss 20%')
3377 self.assertRegex(output, 'qdisc ingress')
3381 self.assertRegex(output, 'qdisc clsact')
3383 self.assertRegex(output, 'qdisc htb 2: root')
3384 self.assertRegex(output, r'default (0x30|30)')
3386 self.assertRegex(output, 'qdisc netem 30: parent 2:30')
3387 self.assertRegex(output, 'limit 100 delay 50(.0)?ms 10(.0)?ms loss 20%')
3388 self.assertRegex(output, 'qdisc fq_codel')
3389 …self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10(.0)?ms ce_threshold 100(.…
3391 self.assertRegex(output, 'qdisc teql1 31: parent 2:31')
3393 self.assertRegex(output, 'qdisc fq 32: parent 2:32')
3394 self.assertRegex(output, 'limit 1000p flow_limit 200p buckets 512 orphan_mask 511')
3395 self.assertRegex(output, 'quantum 1500')
3396 self.assertRegex(output, 'initial_quantum 13000')
3397 self.assertRegex(output, 'maxrate 1Mbit')
3399 self.assertRegex(output, 'qdisc codel 33: parent 2:33')
3400 …self.assertRegex(output, 'limit 2000p target 10(.0)?ms ce_threshold 100(.0)?ms interval 50(.0)?ms …
3402 self.assertRegex(output, 'qdisc fq_codel 34: parent 2:34')
3403 …self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10(.0)?ms ce_threshold 100(.…
3405 self.assertRegex(output, 'qdisc tbf 35: parent 2:35')
3406 … self.assertRegex(output, 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70(.0)?ms')
3408 self.assertRegex(output, 'qdisc sfq 36: parent 2:36')
3409 self.assertRegex(output, 'perturb 5sec')
3411 self.assertRegex(output, 'qdisc pfifo 37: parent 2:37')
3412 self.assertRegex(output, 'limit 100000p')
3414 self.assertRegex(output, 'qdisc gred 38: parent 2:38')
3415 self.assertRegex(output, 'vqs 12 default 10 grio')
3417 self.assertRegex(output, 'qdisc sfb 39: parent 2:39')
3418 self.assertRegex(output, 'limit 200000')
3420 self.assertRegex(output, 'qdisc bfifo 3a: parent 2:3a')
3421 self.assertRegex(output, 'limit 1000000')
3423 self.assertRegex(output, 'qdisc pfifo_head_drop 3b: parent 2:3b')
3424 self.assertRegex(output, 'limit 1023p')
3426 self.assertRegex(output, 'qdisc pfifo_fast 3c: parent 2:3c')
3430 self.assertRegex(output, 'class htb 2:30 root leaf 30:')
3431 self.assertRegex(output, 'class htb 2:31 root leaf 31:')
3432 self.assertRegex(output, 'class htb 2:32 root leaf 32:')
3433 self.assertRegex(output, 'class htb 2:33 root leaf 33:')
3434 self.assertRegex(output, 'class htb 2:34 root leaf 34:')
3435 self.assertRegex(output, 'class htb 2:35 root leaf 35:')
3436 self.assertRegex(output, 'class htb 2:36 root leaf 36:')
3437 self.assertRegex(output, 'class htb 2:37 root leaf 37:')
3438 self.assertRegex(output, 'class htb 2:38 root leaf 38:')
3439 self.assertRegex(output, 'class htb 2:39 root leaf 39:')
3440 self.assertRegex(output, 'class htb 2:3a root leaf 3a:')
3441 self.assertRegex(output, 'class htb 2:3b root leaf 3b:')
3442 self.assertRegex(output, 'class htb 2:3c root leaf 3c:')
3443 self.assertRegex(output, 'prio 1 quantum 4000 rate 1Mbit overhead 100 ceil 500Kbit')
3444 self.assertRegex(output, 'burst 123456')
3445 self.assertRegex(output, 'cburst 123457')
3447 def test_qdisc2(self): argument
3452 self.wait_online(['dummy98:routable', 'test1:routable'])
3456 self.assertRegex(output, 'qdisc drr 2: root')
3459 self.assertRegex(output, 'class drr 2:30 root quantum 2000b')
3463 self.assertRegex(output, 'qdisc qfq 2: root')
3466 self.assertRegex(output, 'class qfq 2:30 root weight 2 maxpkt 16000')
3467 self.assertRegex(output, 'class qfq 2:31 root weight 10 maxpkt 8000')
3470 def test_qdisc_cake(self): argument
3473 self.wait_online(['dummy98:routable'])
3477 self.assertIn('qdisc cake 3a: root', output)
3478 self.assertIn('bandwidth 500Mbit', output)
3479 self.assertIn('autorate-ingress', output)
3480 self.assertIn('diffserv8', output)
3481 self.assertIn('dual-dsthost', output)
3482 self.assertIn(' nat', output)
3483 self.assertIn(' wash', output)
3484 self.assertIn(' split-gso', output)
3485 self.assertIn(' raw', output)
3486 self.assertIn(' atm', output)
3487 self.assertIn('overhead 128', output)
3488 self.assertIn('mpu 20', output)
3489 self.assertIn('fwmark 0xff00', output)
3492 def test_qdisc_pie(self): argument
3495 self.wait_online(['dummy98:routable'])
3499 self.assertRegex(output, 'qdisc pie 3a: root')
3500 self.assertRegex(output, 'limit 200000')
3503 def test_qdisc_hhf(self): argument
3506 self.wait_online(['dummy98:routable'])
3510 self.assertRegex(output, 'qdisc hhf 3a: root')
3511 self.assertRegex(output, 'limit 1022p')
3514 def test_qdisc_ets(self): argument
3517 self.wait_online(['dummy98:routable'])
3522 self.assertRegex(output, 'qdisc ets 3a: root')
3523 self.assertRegex(output, 'bands 10 strict 3')
3524 self.assertRegex(output, 'quanta 1 2 3 4 5')
3525 self.assertRegex(output, 'priomap 3 4 5 6 7')
3528 def test_qdisc_fq_pie(self): argument
3531 self.wait_online(['dummy98:routable'])
3536 self.assertRegex(output, 'qdisc fq_pie 3a: root')
3537 self.assertRegex(output, 'limit 200000p')
3539 def test_wait_online_ipv4(self): argument
3543 self.wait_online(['veth99:routable'], ipv4=True)
3545 self.wait_address('veth99', r'192.168.5.[0-9]+', ipv='-4', timeout_sec=1)
3547 def test_wait_online_ipv6(self): argument
3551 self.wait_online(['veth99:routable'], ipv6=True)
3553 self.wait_address('veth99', r'2002:da8:1:0:1034:56ff:fe78:9abc', ipv='-6', timeout_sec=1)
3565 def setUp(self): argument
3566 remove_links(self.links)
3569 def tearDown(self): argument
3570 remove_links(self.links)
3571 remove_unit_from_networkd_path(self.units)
3574 def test_state_file(self): argument
3577 self.wait_online(['dummy98:routable'])
3584 self.assertTrue(os.path.exists(path))
3594 self.assertRegex(data, r'IPV4_ADDRESS_STATE=routable')
3595 self.assertRegex(data, r'IPV6_ADDRESS_STATE=routable')
3596 self.assertRegex(data, r'ADMIN_STATE=configured')
3597 self.assertRegex(data, r'OPER_STATE=routable')
3598 self.assertRegex(data, r'REQUIRED_FOR_ONLINE=yes')
3599 self.assertRegex(data, r'REQUIRED_OPER_STATE_FOR_ONLINE=routable')
3600 self.assertRegex(data, r'REQUIRED_FAMILY_FOR_ONLINE=both')
3601 self.assertRegex(data, r'ACTIVATION_POLICY=up')
3602 self.assertRegex(data, r'NETWORK_FILE=/run/systemd/network/25-state-file-tests.network')
3603 …self.assertRegex(data, r'DNS=10.10.10.10#aaa.com 10.10.10.11:1111#bbb.com \[1111:2222::3333\]:1234…
3604 self.assertRegex(data, r'NTP=0.fedora.pool.ntp.org 1.fedora.pool.ntp.org')
3605 self.assertRegex(data, r'DOMAINS=hogehoge')
3606 self.assertRegex(data, r'ROUTE_DOMAINS=foofoo')
3607 self.assertRegex(data, r'LLMNR=no')
3608 self.assertRegex(data, r'MDNS=yes')
3609 self.assertRegex(data, r'DNSSEC=no')
3623 self.assertRegex(data, r'DNS=10.10.10.12#ccc.com 10.10.10.13 1111:2222::3333')
3624 self.assertRegex(data, r'NTP=2.fedora.pool.ntp.org 3.fedora.pool.ntp.org')
3625 self.assertRegex(data, r'DOMAINS=hogehogehoge')
3626 self.assertRegex(data, r'ROUTE_DOMAINS=foofoofoo')
3627 self.assertRegex(data, r'LLMNR=yes')
3628 self.assertRegex(data, r'MDNS=no')
3629 self.assertRegex(data, r'DNSSEC=yes')
3638 self.assertRegex(data, r'DNS=10.10.10.12#ccc.com 10.10.10.13 1111:2222::3333')
3639 self.assertRegex(data, r'NTP=0.fedora.pool.ntp.org 1.fedora.pool.ntp.org')
3640 self.assertRegex(data, r'DOMAINS=hogehogehoge')
3641 self.assertRegex(data, r'ROUTE_DOMAINS=foofoofoo')
3642 self.assertRegex(data, r'LLMNR=yes')
3643 self.assertRegex(data, r'MDNS=no')
3644 self.assertRegex(data, r'DNSSEC=yes')
3653 …self.assertRegex(data, r'DNS=10.10.10.10#aaa.com 10.10.10.11:1111#bbb.com \[1111:2222::3333\]:1234…
3654 self.assertRegex(data, r'NTP=0.fedora.pool.ntp.org 1.fedora.pool.ntp.org')
3655 self.assertRegex(data, r'DOMAINS=hogehoge')
3656 self.assertRegex(data, r'ROUTE_DOMAINS=foofoo')
3657 self.assertRegex(data, r'LLMNR=no')
3658 self.assertRegex(data, r'MDNS=yes')
3659 self.assertRegex(data, r'DNSSEC=no')
3680 def setUp(self): argument
3681 remove_links(self.links)
3684 def tearDown(self): argument
3685 remove_links(self.links)
3686 remove_unit_from_networkd_path(self.units)
3689 def test_bond_keep_master(self): argument
3696 self.wait_online(['dummy98:enslaved'])
3700 self.assertRegex(output, 'active_slave dummy98')
3704 self.assertRegex(output, 'master bond199')
3706 def test_bond_active_slave(self): argument
3709 self.wait_online(['dummy98:enslaved', 'bond199:degraded'])
3713 self.assertRegex(output, 'active_slave dummy98')
3715 def test_bond_primary_slave(self): argument
3718 self.wait_online(['dummy98:enslaved', 'bond199:degraded'])
3722 self.assertRegex(output, 'primary dummy98')
3724 def test_bond_operstate(self): argument
3728 self.wait_online(['dummy98:enslaved', 'test1:enslaved', 'bond99:routable'])
3732 self.assertRegex(output, 'SLAVE,UP,LOWER_UP')
3736 self.assertRegex(output, 'SLAVE,UP,LOWER_UP')
3740 self.assertRegex(output, 'MASTER,UP,LOWER_UP')
3742 self.wait_operstate('dummy98', 'enslaved')
3743 self.wait_operstate('test1', 'enslaved')
3744 self.wait_operstate('bond99', 'routable')
3748 self.wait_operstate('dummy98', 'off')
3749 self.wait_operstate('test1', 'enslaved')
3750 self.wait_operstate('bond99', 'degraded-carrier')
3754 self.wait_operstate('dummy98', 'enslaved')
3755 self.wait_operstate('test1', 'enslaved')
3756 self.wait_operstate('bond99', 'routable')
3761 self.wait_operstate('dummy98', 'off')
3762 self.wait_operstate('test1', 'off')
3764 if not self.wait_operstate('bond99', 'no-carrier', setup_timeout=30, fail_assert=False):
3767 self.assertNotRegex(output, 'NO-CARRIER')
3800 def setUp(self): argument
3801 remove_routing_policy_rule_tables(self.routing_policy_rule_tables)
3802 remove_links(self.links)
3805 def tearDown(self): argument
3806 remove_routing_policy_rule_tables(self.routing_policy_rule_tables)
3807 remove_links(self.links)
3808 remove_unit_from_networkd_path(self.units)
3811 def test_bridge_vlan(self): argument
3815 self.wait_online(['test1:enslaved', 'bridge99:degraded'])
3819 self.assertNotRegex(output, '4063')
3821 self.assertRegex(output, f'{i}')
3822 self.assertNotRegex(output, '4095')
3826 self.assertNotRegex(output, '4059')
3828 self.assertRegex(output, f'{i}')
3829 self.assertNotRegex(output, '4095')
3831 def test_bridge_vlan_issue_20373(self): argument
3836 self.wait_online(['test1:enslaved', 'bridge99:degraded', 'vlan99:routable'])
3840 self.assertIn('100 PVID Egress Untagged', output)
3841 self.assertIn('560', output)
3842 self.assertIn('600', output)
3846 self.assertIn('1 PVID Egress Untagged', output)
3847 self.assertIn('100', output)
3848 self.assertIn('600', output)
3850 def test_bridge_mdb(self): argument
3854 self.wait_online(['test1:enslaved', 'bridge99:degraded'])
3858 … self.assertRegex(output, 'dev bridge99 port test1 grp ff02:aaaa:fee5::1:3 permanent *vid 4064')
3859 self.assertRegex(output, 'dev bridge99 port test1 grp 224.0.1.1 permanent *vid 4065')
3863 … self.assertRegex(output, 'dev bridge99 port bridge99 grp ff02:aaaa:fee5::1:4 temp *vid 4066')
3864 self.assertRegex(output, 'dev bridge99 port bridge99 grp 224.0.1.2 temp *vid 4067')
3866 def test_bridge_keep_master(self): argument
3874 self.wait_online(['dummy98:enslaved'])
3878 self.assertRegex(output, 'master bridge99')
3879 self.assertRegex(output, 'bridge')
3883 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'path_cost'), '400')
3884 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'hairpin_mode'), '1')
3885 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'multicast_fast_leave'), '1')
3886 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'unicast_flood'), '1')
3887 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'multicast_flood'), '0')
3890 … self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'multicast_to_unicast'), '1')
3892 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'neigh_suppress'), '1')
3893 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'learning'), '0')
3894 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'priority'), '23')
3895 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'bpdu_guard'), '1')
3896 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'root_block'), '1')
3898 def test_bridge_property(self): argument
3903 self.wait_online(['dummy98:enslaved', 'test1:enslaved', 'bridge99:routable'])
3907 self.assertRegex(output, 'master')
3908 self.assertRegex(output, 'bridge')
3912 self.assertRegex(output, 'master')
3913 self.assertRegex(output, 'bridge')
3917 self.assertRegex(output, '192.168.0.15/24')
3921 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'path_cost'), '400')
3922 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'hairpin_mode'), '1')
3923 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'isolated'), '1')
3924 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'multicast_fast_leave'), '1')
3925 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'unicast_flood'), '1')
3926 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'multicast_flood'), '0')
3929 … self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'multicast_to_unicast'), '1')
3931 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'neigh_suppress'), '1')
3932 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'learning'), '0')
3933 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'priority'), '23')
3934 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'bpdu_guard'), '1')
3935 self.assertEqual(read_bridge_port_attr('bridge99', 'dummy98', 'root_block'), '1')
3939 self.assertEqual(read_bridge_port_attr('bridge99', 'test1', 'priority'), '0')
3946 self.assertRegex(output, '192.168.0.16/24')
3952 …self.assertRegex(output, 'ff00::/8 table local (proto kernel )?metric 256 (linkdown )?pref medium')
3954 self.assertEqual(call('ip link del test1'), 0)
3956 self.wait_operstate('bridge99', 'degraded-carrier')
3960 self.wait_operstate('bridge99', 'no-carrier')
3964 self.assertRegex(output, 'NO-CARRIER')
3965 self.assertNotRegex(output, '192.168.0.15/24')
3966 self.assertRegex(output, '192.168.0.16/24') # foreign address is kept
3971 …self.assertRegex(output, 'ff00::/8 table local (proto kernel )?metric 256 (linkdown )?pref medium')
3973 def test_bridge_configure_without_carrier(self): argument
3980 with self.subTest(test=test):
3983 …self.wait_operstate('bridge99', operstate=r'(no-carrier|routable)', setup_state=None, setup_timeou…
3992 self.check_link_attr('test1', 'operstate', 'down')
3994 self.wait_operstate('bridge99', operstate='no-carrier', setup_state=None)
3995 self.check_link_attr('bridge99', 'carrier', '0')
3999 self.wait_online(['bridge99:routable'])
4000 self.check_link_attr('bridge99', 'carrier', '1')
4004 self.wait_online(['bridge99:no-carrier:no-carrier'])
4005 self.check_link_attr('bridge99', 'carrier', '0')
4009 self.wait_online(['bridge99:routable'])
4010 self.check_link_attr('bridge99', 'carrier', '1')
4014 self.wait_online(['bridge99:no-carrier:no-carrier'])
4015 self.check_link_attr('bridge99', 'carrier', '0')
4018 self.assertRegex(output, '10.1.2.3')
4019 self.assertRegex(output, '10.1.2.1')
4021 def test_bridge_ignore_carrier_loss(self): argument
4026 self.wait_online(['dummy98:enslaved', 'test1:enslaved', 'bridge99:routable'])
4037 self.assertRegex(output, 'NO-CARRIER')
4038 self.assertRegex(output, 'inet 192.168.0.15/24 brd 192.168.0.255 scope global bridge99')
4039 self.assertRegex(output, 'inet 192.168.0.16/24 scope global secondary bridge99')
4041 def test_bridge_ignore_carrier_loss_frequent_loss_and_gain(self): argument
4045 self.wait_online(['bridge99:no-carrier'])
4053 self.wait_online(['bridge99:routable', 'dummy98:enslaved'])
4057 self.assertRegex(output, 'inet 192.168.0.15/24 brd 192.168.0.255 scope global bridge99')
4061 self.assertIn('from all to 8.8.8.8 lookup 100', output)
4070 def setUp(self): argument
4074 def tearDown(self): argument
4075 remove_unit_from_networkd_path(self.units)
4080 def test_sriov(self): argument
4093 self.wait_online(['eni99np1:routable'])
4097 self.assertRegex(output,
4104 def test_sriov_udev(self): argument
4114 self.wait_online(['eni99np1:routable'])
4118 self.assertRegex(output,
4123 self.assertNotIn('vf 3', output)
4124 self.assertNotIn('vf 4', output)
4134 self.assertRegex(output,
4140 self.assertNotIn('vf 4', output)
4150 self.assertRegex(output,
4156 self.assertNotIn('vf 4', output)
4166 self.assertRegex(output,
4170 self.assertNotIn('vf 2', output)
4171 self.assertNotIn('vf 3', output)
4172 self.assertNotIn('vf 4', output)
4182 self.assertRegex(output,
4187 self.assertNotIn('vf 3', output)
4188 self.assertNotIn('vf 4', output)
4198 def setUp(self): argument
4199 remove_links(self.links)
4202 def tearDown(self): argument
4203 remove_links(self.links)
4204 remove_unit_from_networkd_path(self.units)
4207 def test_lldp(self): argument
4210 self.wait_online(['veth99:degraded', 'veth-peer:degraded'])
4221 self.fail()
4234 def setUp(self): argument
4235 remove_links(self.links)
4238 def tearDown(self): argument
4239 remove_links(self.links)
4240 remove_unit_from_networkd_path(self.units)
4243 def test_ipv6_prefix_delegation(self): argument
4246 self.wait_online(['veth99:routable', 'veth-peer:degraded'])
4250 self.assertRegex(output, 'fe80::')
4251 self.assertRegex(output, '2002:da8:1::1')
4255 self.assertIn('hogehoge.test', output)
4259 self.assertRegex(output, '2002:da8:1:0')
4261 def test_ipv6_token_static(self): argument
4264 self.wait_online(['veth99:routable', 'veth-peer:degraded'])
4268 self.assertRegex(output, '2002:da8:1:0:1a:2b:3c:4d')
4269 self.assertRegex(output, '2002:da8:1:0:fa:de:ca:fe')
4270 self.assertRegex(output, '2002:da8:2:0:1a:2b:3c:4d')
4271 self.assertRegex(output, '2002:da8:2:0:fa:de:ca:fe')
4273 def test_ipv6_token_prefixstable(self): argument
4276 self.wait_online(['veth99:routable', 'veth-peer:degraded'])
4280 self.assertIn('2002:da8:1:0:b47e:7975:fc7a:7d6e', output)
4281 self.assertIn('2002:da8:2:0:1034:56ff:fe78:9abc', output) # EUI64
4283 def test_ipv6_token_prefixstable_without_address(self): argument
4286 self.wait_online(['veth99:routable', 'veth-peer:degraded'])
4290 self.assertIn('2002:da8:1:0:b47e:7975:fc7a:7d6e', output)
4291 self.assertIn('2002:da8:2:0:f689:561a:8eda:7443', output)
4312 def setUp(self): argument
4313 remove_links(self.links)
4316 def tearDown(self): argument
4317 remove_links(self.links)
4318 remove_unit_from_networkd_path(self.units)
4321 def test_dhcp_server(self): argument
4324 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4328 self.assertRegex(output, r'Address: 192.168.5.[0-9]* \(DHCP4 via 192.168.5.1\)')
4329 self.assertIn('Gateway: 192.168.5.3', output)
4330 self.assertRegex(output, 'DNS: 192.168.5.1\n *192.168.5.10')
4331 self.assertRegex(output, 'NTP: 192.168.5.1\n *192.168.5.11')
4333 def test_dhcp_server_with_uplink(self): argument
4337 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4341 self.assertRegex(output, r'Address: 192.168.5.[0-9]* \(DHCP4 via 192.168.5.1\)')
4342 self.assertIn('Gateway: 192.168.5.3', output)
4343 self.assertIn('DNS: 192.168.5.1', output)
4344 self.assertIn('NTP: 192.168.5.1', output)
4346 def test_emit_router_timezone(self): argument
4349 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4353 self.assertRegex(output, r'Address: 192.168.5.[0-9]* \(DHCP4 via 192.168.5.1\)')
4354 self.assertIn('Gateway: 192.168.5.1', output)
4355 self.assertIn('Time Zone: Europe/Berlin', output)
4357 def test_dhcp_server_static_lease(self): argument
4360 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4364 self.assertIn('Address: 10.1.1.200 (DHCP4 via 10.1.1.1)', output)
4383 def setUp(self): argument
4384 remove_links(self.links)
4387 def tearDown(self): argument
4388 remove_links(self.links)
4389 remove_unit_from_networkd_path(self.units)
4392 def test_relay_agent(self): argument
4393 copy_unit_to_networkd_unit_path(*self.units)
4396 self.wait_online(['client:routable'])
4400 self.assertRegex(output, r'Address: 192.168.5.150 \(DHCP4 via 192.168.5.1\)')
4443 def setUp(self): argument
4447 remove_links(self.links)
4450 def tearDown(self): argument
4454 remove_links(self.links)
4455 remove_unit_from_networkd_path(self.units)
4458 def test_dhcp_client_ipv6_only(self): argument
4462 self.wait_online(['veth-peer:carrier'])
4464 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4468 self.assertRegex(output, '2600::')
4469 self.assertNotRegex(output, '192.168.5')
4473 self.assertRegex(output, '2600::')
4474 self.assertNotRegex(output, '192.168.5')
4475 self.assertNotRegex(output, 'tentative')
4480 self.assertRegex(output, 'token :: dev veth99')
4482 def test_dhcp_client_ipv4_only(self): argument
4486 self.wait_online(['veth-peer:carrier'])
4488 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4492 self.assertNotRegex(output, '2600::')
4493 self.assertRegex(output, '192.168.5')
4494 self.assertRegex(output, '192.168.5.6')
4495 self.assertRegex(output, '192.168.5.7')
4500 self.assertRegex(output, r'192.168.5.1 proto dhcp scope link src 192.168.5.181 metric 1024')
4501 self.assertRegex(output, r'192.168.5.6 proto dhcp scope link src 192.168.5.181 metric 1024')
4502 self.assertRegex(output, r'192.168.5.7 proto dhcp scope link src 192.168.5.181 metric 1024')
4511 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4515 self.assertNotRegex(output, '2600::')
4516 self.assertRegex(output, '192.168.5')
4517 self.assertNotRegex(output, '192.168.5.6')
4518 self.assertRegex(output, '192.168.5.7')
4519 self.assertRegex(output, '192.168.5.8')
4524 self.assertNotRegex(output, r'192.168.5.6')
4525 self.assertRegex(output, r'192.168.5.1 proto dhcp scope link src 192.168.5.181 metric 1024')
4526 self.assertRegex(output, r'192.168.5.7 proto dhcp scope link src 192.168.5.181 metric 1024')
4527 self.assertRegex(output, r'192.168.5.8 proto dhcp scope link src 192.168.5.181 metric 1024')
4529 def test_dhcp_client_ipv4_use_routes_gateway(self): argument
4531 self.setUp()
4532 …with self.subTest(routes=routes, gateway=gateway, dns_and_ntp_routes=dns_and_ntp_routes, classless…
4533 … self._test_dhcp_client_ipv4_use_routes_gateway(routes, gateway, dns_and_ntp_routes, classless)
4534 self.tearDown()
4536 …def _test_dhcp_client_ipv4_use_routes_gateway(self, use_routes, use_gateway, dns_and_ntp_routes, c… argument
4545 self.wait_online(['veth-peer:carrier'])
4550 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4558 … self.assertRegex(output, r'default via 192.168.5.4 proto dhcp src 192.168.5.[0-9]* metric 1024')
4559 … self.assertRegex(output, r'8.0.0.0/8 via 192.168.5.5 proto dhcp src 192.168.5.[0-9]* metric 1024')
4560 … self.assertRegex(output, r'192.168.5.4 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4561 … self.assertRegex(output, r'192.168.5.5 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4563 … self.assertRegex(output, r'192.168.5.0/24 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4564 … self.assertRegex(output, r'8.0.0.0/8 via 192.168.5.3 proto dhcp src 192.168.5.[0-9]* metric 1024')
4565 … self.assertRegex(output, r'192.168.5.3 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4567 …self.assertNotRegex(output, r'default via 192.168.5.4 proto dhcp src 192.168.5.[0-9]* metric 1024')
4568 …self.assertNotRegex(output, r'8.0.0.0/8 via 192.168.5.5 proto dhcp src 192.168.5.[0-9]* metric 102…
4569 … self.assertNotRegex(output, r'192.168.5.4 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4570 … self.assertNotRegex(output, r'192.168.5.5 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4571 …self.assertNotRegex(output, r'192.168.5.0/24 proto dhcp scope link src 192.168.5.[0-9]* metric 102…
4572 …self.assertNotRegex(output, r'8.0.0.0/8 via 192.168.5.3 proto dhcp src 192.168.5.[0-9]* metric 102…
4573 … self.assertNotRegex(output, r'192.168.5.3 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4577 … self.assertRegex(output, r'default via 192.168.5.1 proto dhcp src 192.168.5.[0-9]* metric 1024')
4579 …self.assertNotRegex(output, r'default via 192.168.5.1 proto dhcp src 192.168.5.[0-9]* metric 1024')
4583 … self.assertRegex(output, r'192.168.5.1 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4585 … self.assertNotRegex(output, r'192.168.5.1 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4589 … self.assertRegex(output, r'192.168.5.10 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4590 … self.assertRegex(output, r'192.168.5.11 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4592 … self.assertRegex(output, r'8.8.8.8 via 192.168.5.4 proto dhcp src 192.168.5.[0-9]* metric 1024')
4593 … self.assertRegex(output, r'9.9.9.9 via 192.168.5.4 proto dhcp src 192.168.5.[0-9]* metric 1024')
4595 … self.assertRegex(output, r'8.8.8.8 via 192.168.5.1 proto dhcp src 192.168.5.[0-9]* metric 1024')
4596 … self.assertRegex(output, r'9.9.9.9 via 192.168.5.1 proto dhcp src 192.168.5.[0-9]* metric 1024')
4598 …self.assertNotRegex(output, r'192.168.5.10 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4599 …self.assertNotRegex(output, r'192.168.5.11 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4600 …self.assertNotRegex(output, r'8.8.8.8 via 192.168.5.[0-9]* proto dhcp src 192.168.5.[0-9]* metric …
4601 …self.assertNotRegex(output, r'9.9.9.9 via 192.168.5.[0-9]* proto dhcp src 192.168.5.[0-9]* metric …
4606 def test_dhcp_client_ipv4_ipv6(self): argument
4609 self.wait_online(['veth-peer:carrier'])
4611 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4614 …self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global …
4615 …self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|nopref…
4619 self.assertRegex(output, '2600::')
4620 self.assertRegex(output, '192.168.5')
4622 def test_dhcp_client_settings(self): argument
4626 self.wait_online(['veth-peer:carrier'])
4628 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4633 self.assertRegex(output, '12:34:56:78:9a:bc')
4634 self.assertRegex(output, '192.168.5')
4635 self.assertRegex(output, '1492')
4636 self.assertRegex(output, 'test-label')
4644 self.assertNotRegex(output, 'proto dhcp')
4649 self.assertRegex(output, 'default via 192.168.5.1 proto dhcp')
4651 self.assertRegex(output, '192.168.5.0/24 proto dhcp')
4652 self.assertRegex(output, '192.168.5.1 proto dhcp scope link')
4655 self.assertTrue(search_words_in_dnsmasq_log('vendor class: SusantVendorTest', True))
4656 self.assertTrue(search_words_in_dnsmasq_log('DHCPDISCOVER(veth-peer) 12:34:56:78:9a:bc'))
4657 self.assertTrue(search_words_in_dnsmasq_log('client provides name: test-hostname'))
4658 self.assertTrue(search_words_in_dnsmasq_log('26:mtu'))
4660 def test_dhcp_client_settings_anonymize(self): argument
4663 self.wait_online(['veth-peer:carrier'])
4665 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4667 … self.assertFalse(search_words_in_dnsmasq_log('VendorClassIdentifier=SusantVendorTest', True))
4668 self.assertFalse(search_words_in_dnsmasq_log('test-hostname'))
4669 self.assertFalse(search_words_in_dnsmasq_log('26:mtu'))
4671 def test_dhcp_client_listen_port(self): argument
4674 self.wait_online(['veth-peer:carrier'])
4676 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4680 self.assertRegex(output, '192.168.5.* dynamic')
4682 def test_dhcp_client_with_static_address(self): argument
4686 self.wait_online(['veth-peer:carrier'])
4688 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4692 self.assertRegex(output, r'inet 192.168.5.250/24 brd 192.168.5.255 scope global veth99')
4693 …self.assertRegex(output, r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global sec…
4697 … self.assertRegex(output, r'default via 192.168.5.1 proto dhcp src 192.168.5.[0-9]* metric 1024')
4698 self.assertRegex(output, r'192.168.5.0/24 proto kernel scope link src 192.168.5.250')
4699 … self.assertRegex(output, r'192.168.5.1 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
4701 def test_dhcp_route_table_id(self): argument
4704 self.wait_online(['veth-peer:carrier'])
4706 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4710 self.assertRegex(output, 'veth99 proto dhcp')
4711 self.assertRegex(output, '192.168.5.1')
4713 def test_dhcp_route_metric(self): argument
4716 self.wait_online(['veth-peer:carrier'])
4718 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4722 self.assertIn('default via 192.168.5.1 proto dhcp src 192.168.5.181 metric 24', output)
4723 self.assertIn('192.168.5.0/24 proto kernel scope link src 192.168.5.181 metric 24', output)
4724 self.assertIn('192.168.5.1 proto dhcp scope link src 192.168.5.181 metric 24', output)
4726 def test_dhcp_client_reassign_static_routes_ipv4(self): argument
4730 self.wait_online(['veth-peer:carrier'])
4732 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4736 …self.assertRegex(output, r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dyn…
4740 self.assertRegex(output, r'192.168.5.0/24 proto kernel scope link src 192.168.5.[0-9]*')
4741 self.assertRegex(output, r'192.168.5.0/24 proto static')
4742 self.assertRegex(output, r'192.168.6.0/24 proto static')
4743 self.assertRegex(output, r'192.168.7.0/24 proto static')
4752 self.wait_online(['veth99:routable'])
4756 self.assertRegex(output, r'192.168.5.0/24 proto kernel scope link src 192.168.5.[0-9]*')
4757 self.assertRegex(output, r'192.168.5.0/24 proto static')
4758 self.assertRegex(output, r'192.168.6.0/24 proto static')
4759 self.assertRegex(output, r'192.168.7.0/24 proto static')
4761 def test_dhcp_client_reassign_static_routes_ipv6(self): argument
4765 self.wait_online(['veth-peer:carrier'])
4767 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4771 …self.assertRegex(output, r'inet6 2600::[0-9a-f]*/128 scope global (noprefixroute dynamic|dynamic n…
4775 self.assertRegex(output, r'2600::/64 proto ra metric 1024')
4776 self.assertRegex(output, r'2600:0:0:1::/64 proto static metric 1024 pref medium')
4785 self.wait_online(['veth99:routable'])
4789 self.assertRegex(output, r'2600::/64 proto ra metric 1024')
4790 self.assertRegex(output, r'2600:0:0:1::/64 proto static metric 1024 pref medium')
4792 def test_dhcp_keep_configuration_dhcp(self): argument
4795 self.wait_online(['veth-peer:carrier'])
4797 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4801 self.assertRegex(output, r'192.168.5.*')
4805 self.assertRegex(output, r'192.168.5.*')
4817 self.assertRegex(output, r'192.168.5.*')
4821 self.assertRegex(output, r'192.168.5.*')
4829 self.assertRegex(output, r'192.168.5.*')
4835 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4840 self.assertRegex(output, r'192.168.5.*')
4844 self.assertRegex(output, r'192.168.5.*')
4846 def test_dhcp_keep_configuration_dhcp_on_stop(self): argument
4849 self.wait_online(['veth-peer:carrier'])
4851 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4855 self.assertRegex(output, r'192.168.5.*')
4863 self.assertRegex(output, r'192.168.5.*')
4866 self.wait_online(['veth-peer:routable'])
4870 self.assertNotRegex(output, r'192.168.5.*')
4872 def test_dhcp_client_reuse_address_as_static(self): argument
4875 self.wait_online(['veth-peer:carrier'])
4877 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4880 …self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global …
4881 …self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|nopref…
4885 self.assertRegex(output, '192.168.5')
4886 self.assertRegex(output, '2600::')
4901 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4905 self.assertRegex(output, '192.168.5')
4906 self.assertRegex(output, 'valid_lft forever preferred_lft forever')
4910 self.assertRegex(output, '2600::')
4911 self.assertRegex(output, 'valid_lft forever preferred_lft forever')
4914 def test_dhcp_client_vrf(self): argument
4918 self.wait_online(['veth-peer:carrier'])
4920 self.wait_online(['veth99:routable', 'veth-peer:routable', 'vrf99:carrier'])
4923 …self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global …
4924 …self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|nopref…
4929 self.assertRegex(output, 'vrf table 42')
4934 …self.assertRegex(output, 'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dyna…
4935 …self.assertRegex(output, 'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|noprefixro…
4936 self.assertRegex(output, 'inet6 .* scope link')
4941 …self.assertRegex(output, 'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dyna…
4942 …self.assertRegex(output, 'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|noprefixro…
4943 self.assertRegex(output, 'inet6 .* scope link')
4948 self.assertRegex(output, 'default via 192.168.5.1 dev veth99 proto dhcp src 192.168.5.')
4949 self.assertRegex(output, '192.168.5.0/24 dev veth99 proto kernel scope link src 192.168.5')
4950 self.assertRegex(output, '192.168.5.1 dev veth99 proto dhcp scope link src 192.168.5')
4955 self.assertEqual(output, '')
4957 def test_dhcp_client_gateway_ipv4(self): argument
4961 self.wait_online(['veth-peer:carrier'])
4963 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4967 self.assertRegex(output, 'default via 192.168.5.1 proto dhcp src 192.168.5.[0-9]*')
4968 self.assertIn('10.0.0.0/8 via 192.168.5.1 proto dhcp', output)
4974 self.assertEqual(rc, 0)
4977 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4981 self.assertNotRegex(output, 'default via 192.168.5.1 proto dhcp src 192.168.5.[0-9]*')
4982 self.assertIn('10.0.0.0/8 via 192.168.5.1 proto dhcp', output)
4984 def test_dhcp_client_gateway_ipv6(self): argument
4988 self.wait_online(['veth-peer:carrier'])
4990 self.wait_online(['veth99:routable', 'veth-peer:routable'])
4994 self.assertRegex(output, 'via fe80::1034:56ff:fe78:9abd')
4996 def test_dhcp_client_gateway_onlink_implicit(self): argument
5000 self.wait_online(['veth-peer:carrier'])
5002 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5006 self.assertRegex(output, '192.168.5')
5010 self.assertRegex(output, 'onlink')
5013 self.assertRegex(output, 'onlink')
5015 def test_dhcp_client_with_ipv4ll_with_dhcp_server(self): argument
5019 self.wait_online(['veth-peer:carrier'])
5021 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5027 self.assertNotRegex(output, r'inet6 2600::[0-9a-f]+/128 scope global dynamic')
5029 self.assertRegex(output, r'inet6 .* scope link')
5031 …self.assertRegex(output, r'inet 192\.168\.5\.\d+/24 metric 1024 brd 192\.168\.5\.255 scope global …
5033 …self.assertNotRegex(output, r'inet 169\.254\.\d+\.\d+/16 metric 2048 brd 169\.254\.255\.255 scope …
5042 self.assertNotRegex(output, r'inet6 2600::[0-9a-f]+/128 scope global dynamic')
5044 self.assertRegex(output, r'inet6 .* scope link')
5046 …self.assertRegex(output, r'inet 192\.168\.5\.\d+/24 metric 1024 brd 192\.168\.5\.255 scope global …
5048 …self.assertNotRegex(output, r'inet 169\.254\.\d+\.\d+/16 metric 2048 brd 169\.254\.255\.255 scope …
5052 def test_dhcp_client_with_ipv4ll_without_dhcp_server(self): argument
5058 self.wait_online(['veth99:degraded', 'veth-peer:routable'], timeout='60s')
5064 self.assertNotRegex(output, r'inet6 2600::[0-9a-f]+/128 scope global dynamic')
5066 self.assertRegex(output, r'inet6 .* scope link')
5068 …self.assertNotRegex(output, r'inet 192\.168\.5\.\d+/24 metric 1024 brd 192\.168\.5\.255 scope glob…
5070 …self.assertRegex(output, r'inet 169\.254\.\d+\.\d+/16 metric 2048 brd 169\.254\.255\.255 scope lin…
5073 …self.wait_address('veth99', r'inet 192\.168\.5\.\d+/24 metric 1024 brd 192\.168\.5\.255 scope glob…
5074 …self.wait_address_dropped('veth99', r'inet 169\.254\.\d+\.\d+/16 metric 2048 brd 169\.255\.255\.25…
5076 def test_dhcp_client_route_remove_on_renew(self): argument
5080 self.wait_online(['veth-peer:carrier'])
5082 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5088 …self.assertRegex(output, 'inet 192.168.5.1[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dyn…
5097 self.assertRegex(output, f'default via 192.168.5.1 proto dhcp src {address1} metric 1024')
5098 self.assertRegex(output, f'192.168.5.1 proto dhcp scope link src {address1} metric 1024')
5108 …self.assertRegex(output, 'inet 192.168.5.2[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dyn…
5115 self.assertNotEqual(address1, address2)
5119 … self.assertNotRegex(output, f'default via 192.168.5.1 proto dhcp src {address1} metric 1024')
5120 self.assertNotRegex(output, f'192.168.5.1 proto dhcp scope link src {address1} metric 1024')
5121 self.assertRegex(output, f'default via 192.168.5.1 proto dhcp src {address2} metric 1024')
5122 self.assertRegex(output, f'192.168.5.1 proto dhcp scope link src {address2} metric 1024')
5124 def test_dhcp_client_use_dns_yes(self): argument
5128 self.wait_online(['veth-peer:carrier'])
5130 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5133 …self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global …
5134 …self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|nopref…
5139 self.assertRegex(output, '192.168.5.1')
5140 self.assertRegex(output, '2600::1')
5145 def test_dhcp_client_use_dns_no(self): argument
5149 self.wait_online(['veth-peer:carrier'])
5151 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5154 …self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global …
5155 …self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|nopref…
5160 self.assertNotRegex(output, '192.168.5.1')
5161 self.assertNotRegex(output, '2600::1')
5163 def test_dhcp_client_use_dns_ipv4(self): argument
5167 self.wait_online(['veth-peer:carrier'])
5169 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5172 …self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global …
5173 …self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|nopref…
5178 self.assertRegex(output, '192.168.5.1')
5179 self.assertNotRegex(output, '2600::1')
5181 def test_dhcp_client_use_dns_ipv4_and_ra(self): argument
5185 self.wait_online(['veth-peer:carrier'])
5187 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5190 …self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global …
5191 …self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|nopref…
5196 self.assertRegex(output, '192.168.5.1')
5197 self.assertRegex(output, '2600::1')
5199 def test_dhcp_client_use_domains(self): argument
5203 self.wait_online(['veth-peer:carrier'])
5205 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5209 self.assertRegex(output, 'Search Domains: example.com')
5214 self.assertRegex(output, 'example.com')
5216 def test_dhcp_client_decline(self): argument
5220 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5224 …self.assertRegex(output, 'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dyna…
5226 def test_dhcp_client_allow_list(self): argument
5230 self.wait_online(['veth99:routable', 'veth-peer:routable'])
5234 …self.assertRegex(output, 'inet 192.168.5.[0-9]*/24 metric 1024 brd 192.168.5.255 scope global dyna…
5269 def setUp(self): argument
5272 remove_links(self.links)
5275 def tearDown(self): argument
5278 remove_links(self.links)
5279 remove_unit_from_networkd_path(self.units)
5282 def test_dhcp6pd(self): argument
5292 self.wait_online(['veth-peer:routable'])
5294 … self.wait_online(['veth99:routable', 'test1:routable', 'dummy98:routable', 'dummy99:degraded',
5300 self.assertIn('inet6 3ffe:501:ffff:100::1/64 scope global', output)
5315 …self.assertRegex(output, 'inet6 3ffe:501:ffff:100::[0-9]*/128 scope global (dynamic noprefixroute|…
5317 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]10:1a:2b:3c:4d/64 (metric 256 |)scope global…
5319 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]10:1034:56ff:fe78:9abc/64 (metric 256 |)scop…
5322 …self.wait_address('veth99', 'inet6 3ffe:501:ffff:[2-9a-f]10:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]…
5328 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]00:1a:2b:3c:4d/64 (metric 256 |)scope global…
5330 …self.wait_address('test1', 'inet6 3ffe:501:ffff:[2-9a-f]00:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*…
5336 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]00:1a:2b:3c:4d/64 (metric 256 |)scope global…
5338 …self.wait_address('dummy98', 'inet6 3ffe:501:ffff:[2-9a-f]00:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f…
5344 self.assertNotRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]02')
5350 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]08:1a:2b:3c:4d/64 (metric 256 |)scope global…
5352 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]08:1034:56ff:fe78:9ace/64 (metric 256 |)scop…
5354 …self.wait_address('veth97', 'inet6 3ffe:501:ffff:[2-9a-f]08:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]…
5360 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]08:1a:2b:3c:4e/64 (metric 256 |)scope global…
5362 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]08:1034:56ff:fe78:9acf/64 (metric 256 |)scop…
5364 …self.wait_address('veth97-peer', 'inet6 3ffe:501:ffff:[2-9a-f]08:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-…
5370 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]09:1a:2b:3c:4d/64 (metric 256 |)scope global…
5372 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]09:1034:56ff:fe78:9abe/64 (metric 256 |)scop…
5374 …self.wait_address('veth98', 'inet6 3ffe:501:ffff:[2-9a-f]09:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]…
5380 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]09:1a:2b:3c:4e/64 (metric 256 |)scope global…
5382 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]09:1034:56ff:fe78:9abf/64 (metric 256 |)scop…
5384 …self.wait_address('veth98-peer', 'inet6 3ffe:501:ffff:[2-9a-f]09:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-…
5389 self.assertRegex(output, 'unreachable 3ffe:501:ffff:[2-9a-f]00::/56 dev lo proto dhcp')
5394 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]10::/64 proto kernel metric [0-9]* expires')
5399 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]00::/64 proto kernel metric [0-9]* expires')
5404 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]00::/64 proto kernel metric [0-9]* expires')
5409 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]02::/64 proto dhcp metric [0-9]* expires')
5414 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]08::/64 proto kernel metric [0-9]* expires')
5419 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]08::/64 proto ra metric [0-9]* expires')
5424 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]09::/64 proto kernel metric [0-9]* expires')
5429 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]09::/64 proto ra metric [0-9]* expires')
5433 self.wait_online(['dummy97:routable'])
5439 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]01:1a:2b:3c:4d/64 (metric 256 |)scope global…
5441 …self.wait_address('dummy97', 'inet6 3ffe:501:ffff:[2-9a-f]01:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f…
5446 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]01::/64 proto kernel metric [0-9]* expires')
5450 self.wait_online(['dummy98:routable'])
5456 …self.assertRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]00:1a:2b:3c:4d/64 (metric 256 |)scope global…
5458 …self.wait_address('dummy98', 'inet6 3ffe:501:ffff:[2-9a-f]00:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f…
5464 self.assertNotRegex(output, 'inet6 3ffe:501:ffff:[2-9a-f]02')
5469 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]00::/64 proto kernel metric [0-9]* expires')
5474 self.assertRegex(output, '3ffe:501:ffff:[2-9a-f]02::/64 proto dhcp metric [0-9]* expires')
5476 def verify_dhcp4_6rd(self, tunnel_name): argument
5480 self.assertIn('inet 10.0.0.1/8 brd 10.255.255.255 scope global veth-peer', output)
5495 …self.assertRegex(output, 'inet 10.100.100.[0-9]*/8 (metric 1024 |)brd 10.255.255.255 scope global …
5501 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+10:1a:2b:3c:4d/64 (metric 256 |)scope globa…
5503 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+10:1034:56ff:fe78:9abc/64 (metric 256 |)sco…
5506 …self.wait_address('veth99', 'inet6 2001:db8:6464:[0-9a-f]+10:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f…
5512 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+00:1a:2b:3c:4d/64 (metric 256 |)scope globa…
5514 …self.wait_address('test1', 'inet6 2001:db8:6464:[0-9a-f]+00:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]…
5520 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+00:1a:2b:3c:4d/64 (metric 256 |)scope globa…
5522 …self.wait_address('dummy98', 'inet6 2001:db8:6464:[0-9a-f]+00:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-…
5528 self.assertNotRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+0[23]')
5534 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+08:1a:2b:3c:4d/64 (metric 256 |)scope globa…
5536 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+08:1034:56ff:fe78:9ace/64 (metric 256 |)sco…
5538 …self.wait_address('veth97', 'inet6 2001:db8:6464:[0-9a-f]+08:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f…
5544 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+08:1a:2b:3c:4e/64 (metric 256 |)scope globa…
5546 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+08:1034:56ff:fe78:9acf/64 (metric 256 |)sco…
5548 …self.wait_address('veth97-peer', 'inet6 2001:db8:6464:[0-9a-f]+08:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0…
5554 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+09:1a:2b:3c:4d/64 (metric 256 |)scope globa…
5556 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+09:1034:56ff:fe78:9abe/64 (metric 256 |)sco…
5558 …self.wait_address('veth98', 'inet6 2001:db8:6464:[0-9a-f]+09:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f…
5564 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+09:1a:2b:3c:4e/64 (metric 256 |)scope globa…
5566 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+09:1034:56ff:fe78:9abf/64 (metric 256 |)sco…
5568 …self.wait_address('veth98-peer', 'inet6 2001:db8:6464:[0-9a-f]+09:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0…
5573 self.assertRegex(output, 'unreachable 2001:db8:6464:[0-9a-f]+00::/56 dev lo proto dhcp')
5578 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+10::/64 proto kernel metric [0-9]* expires')
5583 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+00::/64 proto kernel metric [0-9]* expires')
5588 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+00::/64 proto kernel metric [0-9]* expires')
5593 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+0[23]::/64 proto dhcp metric [0-9]* expires')
5598 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+08::/64 proto kernel metric [0-9]* expires')
5603 self.assertRegex(output, '2001:db8:6464:[0-9a-f]+08::/64 proto ra metric [0-9]* expires')
5608 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+09::/64 proto kernel metric [0-9]* expires')
5613 self.assertRegex(output, '2001:db8:6464:[0-9a-f]+09::/64 proto ra metric [0-9]* expires')
5619 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+01:1a:2b:3c:4d/64 (metric 256 |)scope globa…
5621 …self.wait_address('dummy97', 'inet6 2001:db8:6464:[0-9a-f]+01:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-…
5626 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+01::/64 proto kernel metric [0-9]* expires')
5631 self.assertIn('link/sit 10.100.100.', output)
5632 self.assertIn('local 10.100.100.', output)
5633 self.assertIn('ttl 64', output)
5634 self.assertIn('6rd-prefix 2001:db8::/32', output)
5635 self.assertIn('6rd-relay_prefix 10.0.0.0/8', output)
5640 …self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+0[23]:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f…
5641 self.assertRegex(output, 'inet6 ::10.100.100.[0-9]+/96 scope global')
5646 … self.assertRegex(output, '2001:db8:6464:[0-9a-f]+0[23]::/64 proto kernel metric [0-9]* expires')
5647 self.assertRegex(output, '::/96 proto kernel metric [0-9]*')
5652 self.assertIn('default', output)
5653 self.assertIn('via ::10.0.0.1 dev {}'.format(tunnel_name), output)
5655 def test_dhcp4_6rd(self): argument
5666 self.wait_online(['veth-peer:routable'])
5673 … self.wait_online(['veth99:routable', 'test1:routable', 'dummy98:routable', 'dummy99:degraded',
5678 self.wait_online(['dummy97:routable'])
5687 self.wait_online(['{}:routable'.format(tunnel_name)])
5689 self.verify_dhcp4_6rd(tunnel_name)
5693 self.wait_online(['dummy98:routable', 'dummy99:degraded'])
5695 self.verify_dhcp4_6rd(tunnel_name)
5709 …self.wait_online(['veth99:routable', 'test1:routable', 'dummy97:routable', 'dummy98:routable', 'du…
5712 self.verify_dhcp4_6rd(tunnel_name)
5729 def setUp(self): argument
5730 remove_links(self.links)
5733 def tearDown(self): argument
5734 remove_links(self.links)
5735 remove_unit_from_networkd_path(self.units)
5738 def test_ipv6_route_prefix(self): argument
5743 self.wait_online(['veth99:routable', 'veth-peer:routable', 'dummy98:routable'])
5747 self.assertIn('inet6 2001:db8:0:1:', output)
5748 self.assertNotIn('inet6 2001:db8:0:2:', output)
5749 self.assertNotIn('inet6 2001:db8:0:3:', output)
5753 self.assertIn('2001:db8:0:1::/64 proto ra', output)
5754 self.assertNotIn('2001:db8:0:2::/64 proto ra', output)
5755 self.assertNotIn('2001:db8:0:3::/64 proto ra', output)
5756 self.assertIn('2001:db0:fff::/64 via ', output)
5757 self.assertNotIn('2001:db1:fff::/64 via ', output)
5758 self.assertNotIn('2001:db2:fff::/64 via ', output)
5762 self.assertNotIn('inet6 2001:db8:0:1:', output)
5763 self.assertIn('inet6 2001:db8:0:2:1a:2b:3c:4d', output)
5764 self.assertIn('inet6 2001:db8:0:2:fa:de:ca:fe', output)
5765 self.assertNotIn('inet6 2001:db8:0:3:', output)
5769 self.assertRegex(output, '2001:db8:1:1::2')
5773 self.assertIn('example.com', output)
5778 def test_ipv6_route_prefix_deny_list(self): argument
5783 self.wait_online(['veth99:routable', 'veth-peer:routable', 'dummy98:routable'])
5787 self.assertIn('inet6 2001:db8:0:1:', output)
5788 self.assertNotIn('inet6 2001:db8:0:2:', output)
5792 self.assertIn('2001:db8:0:1::/64 proto ra', output)
5793 self.assertNotIn('2001:db8:0:2::/64 proto ra', output)
5794 self.assertIn('2001:db0:fff::/64 via ', output)
5795 self.assertNotIn('2001:db1:fff::/64 via ', output)
5799 self.assertNotIn('inet6 2001:db8:0:1:', output)
5800 self.assertIn('inet6 2001:db8:0:2:', output)
5804 self.assertRegex(output, '2001:db8:1:1::2')
5808 self.assertIn('example.com', output)
5820 def setUp(self): argument
5821 remove_links(self.links)
5824 def tearDown(self): argument
5825 remove_links(self.links)
5826 remove_unit_from_networkd_path(self.units)
5829 def check_mtu(self, mtu, ipv6_mtu=None, reset=True): argument
5835 self.wait_online(['dummy98:routable'])
5836 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'mtu'), ipv6_mtu)
5837 self.assertEqual(read_link_attr('dummy98', 'mtu'), mtu)
5841 self.wait_online(['dummy98:routable'])
5842 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'mtu'), ipv6_mtu)
5843 self.assertEqual(read_link_attr('dummy98', 'mtu'), mtu)
5846 self.reset_check_mtu(mtu, ipv6_mtu)
5848 def reset_check_mtu(self, mtu, ipv6_mtu=None): argument
5855 self.assertEqual(read_link_attr('dummy98', 'mtu'), '1500')
5856 self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'mtu'), '1500')
5858 self.check_mtu(mtu, ipv6_mtu, reset=False)
5860 def test_mtu_network(self): argument
5862 self.check_mtu('1600')
5864 def test_mtu_netdev(self): argument
5867 self.check_mtu('1600', reset=False)
5869 def test_mtu_link(self): argument
5874 self.check_mtu('1600', reset=False)
5876 def test_ipv6_mtu(self): argument
5879 self.check_mtu('1500', '1400')
5881 def test_ipv6_mtu_toolarge(self): argument
5884 self.check_mtu('1500', '1500')
5886 def test_mtu_network_ipv6_mtu(self): argument
5889 self.check_mtu('1600', '1550')
5891 def test_mtu_netdev_ipv6_mtu(self): argument
5894 self.check_mtu('1600', '1550', reset=False)
5896 def test_mtu_link_ipv6_mtu(self): argument
5901 self.check_mtu('1600', '1550', reset=False)