From 60ce6a3413b39539e0c84dcb5995732932df22bc Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 18 Nov 2024 14:57:27 +0900 Subject: [PATCH] test-network: add test case for [IPv6RoutePrefix] Preference= --- test/test-network/systemd-networkd-tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index b6549b96b38..a151e00a2f1 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -6494,6 +6494,22 @@ class NetworkdRATests(unittest.TestCase, Utilities): networkctl_reload() self.check_router_preference('01', 100, 'high', 300, 'low') + # Use route options with preference to configure default routes. + with open(os.path.join(network_unit_dir, '25-veth-router-high.network'), mode='a', encoding='utf-8') as f: + f.write('LifetimeSec=1200\nPreference=low\n') + with open(os.path.join(network_unit_dir, '25-veth-router-low.network'), mode='a', encoding='utf-8') as f: + f.write('LifetimeSec=1200\nPreference=high\n') + networkctl_reload() + self.check_router_preference('01', 300, 'low', 100, 'high') + + # Set zero lifetime again to the route options. + with open(os.path.join(network_unit_dir, '25-veth-router-high.network'), mode='a', encoding='utf-8') as f: + f.write('LifetimeSec=0\n') + with open(os.path.join(network_unit_dir, '25-veth-router-low.network'), mode='a', encoding='utf-8') as f: + f.write('LifetimeSec=0\n') + networkctl_reload() + self.check_router_preference('01', 100, 'high', 300, 'low') + def _test_ndisc_vs_static_route(self, manage_foreign_nexthops): if not manage_foreign_nexthops: copy_networkd_conf_dropin('networkd-manage-foreign-nexthops-no.conf') -- 2.47.3