mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
test-network: add more tests for [Address] section
This commit is contained in:
@@ -43,6 +43,11 @@ Label=30
|
||||
Peer=hoge
|
||||
Address=10.10.0.2/16
|
||||
|
||||
[Address]
|
||||
# address and peer must be in the same family
|
||||
Address=10.10.0.3/16
|
||||
Peer=2001:db8:0:f103::10/128
|
||||
|
||||
[Address]
|
||||
Address=2001:db8:0:f102::16/64
|
||||
|
||||
@@ -65,6 +70,7 @@ Scope=link
|
||||
[Address]
|
||||
# this will also deduped
|
||||
Address=2001:0db8:1:f101::1/64
|
||||
PreferredLifetime=infinity
|
||||
|
||||
[Address]
|
||||
Address=2001:0db8:1:f101::1/64
|
||||
@@ -72,8 +78,33 @@ PreferredLifetime=0
|
||||
|
||||
[Address]
|
||||
Address=10.8.8.1/16
|
||||
Broadcast=yes
|
||||
Broadcast=
|
||||
Broadcast=no
|
||||
|
||||
[Address]
|
||||
Address=10.8.8.2/16
|
||||
Broadcast=10.8.8.128
|
||||
|
||||
[Address]
|
||||
# Invalid broadcast
|
||||
Address=10.8.8.2/16
|
||||
Broadcast=::1
|
||||
|
||||
[Address]
|
||||
# broadcast cannot set for IPv6 address
|
||||
Address=2001:0db8:1:f101::2/64
|
||||
Broadcast=::1
|
||||
|
||||
[Address]
|
||||
Address=10.9.0.1/16
|
||||
RouteMetric=128
|
||||
|
||||
[Address]
|
||||
# invalid metric
|
||||
Address=10.9.0.1/16
|
||||
RouteMetric=hoge
|
||||
|
||||
# test for ENOBUFS issue #17012
|
||||
[Network]
|
||||
Address=10.3.3.1/16
|
||||
|
||||
@@ -2002,6 +2002,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
self.assertIn('inet 10.2.2.4/16 brd 10.2.255.255 scope global dummy98', output)
|
||||
self.assertIn('inet 10.7.8.9/16 brd 10.7.255.255 scope link deprecated dummy98', output)
|
||||
self.assertIn('inet 10.8.8.1/16 scope global dummy98', output)
|
||||
self.assertIn('inet 10.8.8.2/16 brd 10.8.8.128 scope global secondary dummy98', output)
|
||||
self.assertRegex(output, 'inet 10.9.0.1/16 (metric 128 |)brd 10.9.255.255 scope global dummy98')
|
||||
|
||||
# test for ENOBUFS issue #17012
|
||||
for i in range(1,254):
|
||||
@@ -2023,6 +2025,10 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
output = check_output('ip -4 address show dev dummy98 label 35')
|
||||
self.assertRegex(output, r'inet 172.[0-9]*.0.1/16 brd 172.[0-9]*.255.255 scope global 35')
|
||||
|
||||
output = check_output('ip -4 route show dev dummy98')
|
||||
print(output)
|
||||
self.assertIn('10.9.0.0/16 proto kernel scope link src 10.9.0.1 metric 128', output)
|
||||
|
||||
output = check_output('ip -6 address show dev dummy98')
|
||||
print(output)
|
||||
self.assertIn('inet6 2001:db8:0:f101::15/64 scope global', output)
|
||||
|
||||
Reference in New Issue
Block a user