mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
14
test/test-network/conf/25-address-null.network
Normal file
14
test/test-network/conf/25-address-null.network
Normal file
@@ -0,0 +1,14 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=0.0.0.0/16
|
||||
Address=0.0.0.0/30
|
||||
Address=::/64
|
||||
|
||||
[Address]
|
||||
Address=0.0.0.0/24
|
||||
# The broadcast address will be ignored.
|
||||
Broadcast=192.168.0.255
|
||||
@@ -2342,6 +2342,34 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
# TODO: check json string
|
||||
check_output(*networkctl_cmd, '--json=short', 'status', env=env)
|
||||
|
||||
def test_address_null(self):
|
||||
copy_network_unit('25-address-null.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output('ip address show dev dummy98 scope global')
|
||||
print(output)
|
||||
|
||||
ipv4_address_16 = re.findall(r'inet 172.[0-9]*.0.1/16 brd 172.[0-9]*.255.255', output)
|
||||
self.assertEqual(len(ipv4_address_16), 1)
|
||||
ipv4_address_24 = re.findall(r'inet 192.168.[0-9]*.1/24 brd 192.168.[0-9]*.255', output)
|
||||
self.assertEqual(len(ipv4_address_24), 1)
|
||||
ipv4_address_30 = re.findall(r'inet 192.168.[0-9]*.[0-9]*/30 brd 192.168.[0-9]*.[0-9]*', output)
|
||||
self.assertEqual(len(ipv4_address_30), 1)
|
||||
ipv6_address = re.findall(r'inet6 fd[0-9a-f:]*/64', output)
|
||||
self.assertEqual(len(ipv6_address), 1)
|
||||
|
||||
networkctl_reconfigure('dummy98')
|
||||
self.wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output('ip address show dev dummy98 scope global')
|
||||
print(output)
|
||||
self.assertIn(ipv4_address_16[0], output)
|
||||
self.assertIn(ipv4_address_24[0], output)
|
||||
self.assertIn(ipv4_address_30[0], output)
|
||||
self.assertIn(ipv6_address[0], output)
|
||||
|
||||
def test_address_ipv4acd(self):
|
||||
check_output('ip netns add ns99')
|
||||
check_output('ip link add veth99 type veth peer veth-peer')
|
||||
|
||||
Reference in New Issue
Block a user