test-network: add test for issue #24377

The issue has been already fixed by
b05e52000b (PR #24020).
This commit is contained in:
Yu Watanabe 2022-08-20 20:36:12 +09:00
parent 5bd2a7c580
commit b249834bc3
6 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[NetDev]
Name=bond99
Kind=bond
[Bond]
Mode=802.3ad
TransmitHashPolicy=layer3+4

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=bond99
[Network]
VLAN=vlan99
BindCarrier=test1 dummy98
LinkLocalAddressing=no

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=test1
Name=dummy98
[Network]
Bond=bond99

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[NetDev]
Name=vlan99
Kind=vlan
[VLAN]
Id=20

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=vlan99
[Network]
IPv6AcceptRA=false
Address=192.168.23.5/24
LinkLocalAddressing=yes

View file

@ -1199,6 +1199,31 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'inet 192.168.23.5/24 brd 192.168.23.255 scope global vlan99')
def test_vlan_on_bond(self):
# For issue #24377 (https://github.com/systemd/systemd/issues/24377),
# which is fixed by b05e52000b4eee764b383cc3031da0a3739e996e (PR#24020).
copy_network_unit('21-bond-802.3ad.netdev', '21-bond-802.3ad.network',
'21-vlan-on-bond.netdev', '21-vlan-on-bond.network')
start_networkd()
self.wait_online(['bond99:off'])
self.wait_operstate('vlan99', operstate='off', setup_state='configuring', setup_timeout=10)
# The commit b05e52000b4eee764b383cc3031da0a3739e996e adds ", ignoring". To make it easily confirmed
# that the issue is fixed by the commit, let's allow to match both string.
log_re = re.compile('vlan99: Could not bring up interface(, ignoring|): Network is down$', re.MULTILINE)
for i in range(20):
if i > 0:
time.sleep(0.5)
if log_re.search(read_networkd_log()):
break
else:
self.fail()
copy_network_unit('11-dummy.netdev', '12-dummy.netdev', '21-dummy-bond-slave.network')
networkctl_reload()
self.wait_online(['test1:enslaved', 'dummy98:enslaved', 'bond99:carrier', 'vlan99:routable'])
def test_macvtap(self):
first = True
for mode in ['private', 'vepa', 'bridge', 'passthru']: