1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

test-network: add test case for removal of nexthop that is a member of a group nexthop

This commit is contained in:
Yu Watanabe 2024-01-15 19:48:48 +09:00
parent 3cbbe8635a
commit f9b5c27645
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=test1
[Network]
Address=192.168.20.21/24
IPv6AcceptRA=no
[Route]
Destination=10.10.11.10
# Nexthop 21 is configured as a group nexthop of 1 and 20
NextHop=21

View File

@ -4033,6 +4033,33 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.check_nexthop(manage_foreign_nexthops, first=True)
# Remove nexthop with ID 20
check_output('ip nexthop del id 20')
copy_network_unit('11-dummy.netdev', '25-nexthop-test1.network')
networkctl_reload()
# 25-nexthop-test1.network requests a route with nexthop ID 21,
# which is silently removed by the kernel when nexthop with ID 20 is removed in the above,
# hence test1 should be stuck in the configuring state.
self.wait_operstate('test1', operstate='routable', setup_state='configuring')
# Wait for a while, and check if the interface is still in the configuring state.
time.sleep(1)
output = networkctl_status('test1')
self.assertIn('State: routable (configuring)', output)
# Reconfigure the interface that has nexthop with ID 20 and 21,
# then the route requested by test1 can be configured.
networkctl_reconfigure('dummy98')
self.wait_online(['test1:routable'])
# Check if the requested route actually configured.
output = check_output('ip route show 10.10.11.10')
print(output)
self.assertIn('10.10.11.10 nhid 21 proto static', output)
self.assertIn('nexthop via 192.168.5.1 dev veth99 weight 3', output)
self.assertIn('nexthop via 192.168.20.1 dev dummy98 weight 1', output)
remove_link('veth99')
time.sleep(2)