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

test-network: add simple test case for DHCP relay on bridge interface

For issue #30763.
This commit is contained in:
Yu Watanabe 2024-01-15 14:19:03 +09:00 committed by Luca Boccassi
parent 3db1e6a874
commit a663ddc04e
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=client-peer
[Network]
Bridge=bridge-relay
IPv6AcceptRA=no

View File

@ -0,0 +1,4 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[NetDev]
Name=bridge-relay
Kind=bridge

View File

@ -0,0 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=bridge-relay
[Network]
Address=192.168.2.1/24
DHCPServer=yes
IPv6AcceptRA=no
[DHCPServer]
RelayTarget=192.168.1.1
RelayAgentRemoteId=string:aabbccdd

View File

@ -5380,6 +5380,24 @@ class NetworkdDHCPServerRelayAgentTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, r'Address: 192.168.5.150 \(DHCP4 via 192.168.5.1\)')
def test_replay_agent_on_bridge(self):
copy_network_unit('25-agent-bridge.netdev',
'25-agent-veth-client.netdev',
'25-agent-bridge.network',
'25-agent-bridge-port.network',
'25-agent-client.network')
start_networkd()
self.wait_online(['bridge-relay:routable', 'client-peer:enslaved'])
# For issue #30763.
expect = 'bridge-relay: DHCPv4 server: STARTED'
for _ in range(20):
if expect in read_networkd_log():
break
time.sleep(0.5)
else:
self.fail()
class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
def setUp(self):