test-network: add tests for route advmss

master
Yu Watanabe 2 years ago
parent 386e89083f
commit 0b5dc24953
  1. 4
      test/test-network/conf/25-route-static.network
  2. 65
      test/test-network/systemd-networkd-tests.py

@ -36,6 +36,10 @@ InitialCongestionWindow=20
Destination=192.168.1.2
InitialAdvertisedReceiveWindow=30
[Route]
Destination=192.168.1.3
TCPAdvertisedMaximumSegmentSize=30
[Route]
Type=blackhole
Destination=202.54.1.2

@ -2197,53 +2197,54 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print('### ip -6 route show dev dummy98')
output = check_output('ip -6 route show dev dummy98')
print(output)
self.assertRegex(output, '2001:1234:5:8fff:ff:ff:ff:ff proto static')
self.assertRegex(output, '2001:1234:5:8f63::1 proto kernel')
self.assertIn('2001:1234:5:8fff:ff:ff:ff:ff proto static', output)
self.assertIn('2001:1234:5:8f63::1 proto kernel', output)
print('### ip -6 route show default')
output = check_output('ip -6 route show default')
print(output)
self.assertRegex(output, 'default')
self.assertRegex(output, 'via 2001:1234:5:8fff:ff:ff:ff:ff')
self.assertIn('default', output)
self.assertIn('via 2001:1234:5:8fff:ff:ff:ff:ff', output)
print('### ip -4 route show dev dummy98')
output = check_output('ip -4 route show dev dummy98')
print(output)
self.assertRegex(output, '149.10.124.48/28 proto kernel scope link src 149.10.124.58')
self.assertRegex(output, '149.10.124.64 proto static scope link')
self.assertRegex(output, '169.254.0.0/16 proto static scope link metric 2048')
self.assertRegex(output, '192.168.1.1 proto static initcwnd 20')
self.assertRegex(output, '192.168.1.2 proto static initrwnd 30')
self.assertRegex(output, 'multicast 149.10.123.4 proto static')
self.assertIn('149.10.124.48/28 proto kernel scope link src 149.10.124.58', output)
self.assertIn('149.10.124.64 proto static scope link', output)
self.assertIn('169.254.0.0/16 proto static scope link metric 2048', output)
self.assertIn('192.168.1.1 proto static initcwnd 20', output)
self.assertIn('192.168.1.2 proto static initrwnd 30', output)
self.assertIn('192.168.1.3 proto static advmss 30', output)
self.assertIn('multicast 149.10.123.4 proto static', output)
print('### ip -4 route show dev dummy98 default')
output = check_output('ip -4 route show dev dummy98 default')
print(output)
self.assertRegex(output, 'default via 149.10.125.65 proto static onlink')
self.assertRegex(output, 'default via 149.10.124.64 proto static')
self.assertRegex(output, 'default proto static')
self.assertIn('default via 149.10.125.65 proto static onlink', output)
self.assertIn('default via 149.10.124.64 proto static', output)
self.assertIn('default proto static', output)
print('### ip -4 route show table local dev dummy98')
output = check_output('ip -4 route show table local dev dummy98')
print(output)
self.assertRegex(output, 'local 149.10.123.1 proto static scope host')
self.assertRegex(output, 'anycast 149.10.123.2 proto static scope link')
self.assertRegex(output, 'broadcast 149.10.123.3 proto static scope link')
self.assertIn('local 149.10.123.1 proto static scope host', output)
self.assertIn('anycast 149.10.123.2 proto static scope link', output)
self.assertIn('broadcast 149.10.123.3 proto static scope link', output)
print('### ip route show type blackhole')
output = check_output('ip route show type blackhole')
print(output)
self.assertRegex(output, 'blackhole 202.54.1.2 proto static')
self.assertIn('blackhole 202.54.1.2 proto static', output)
print('### ip route show type unreachable')
output = check_output('ip route show type unreachable')
print(output)
self.assertRegex(output, 'unreachable 202.54.1.3 proto static')
self.assertIn('unreachable 202.54.1.3 proto static', output)
print('### ip route show type prohibit')
output = check_output('ip route show type prohibit')
print(output)
self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
self.assertIn('prohibit 202.54.1.4 proto static', output)
print('### ip -6 route show type blackhole')
output = check_output('ip -6 route show type blackhole')
@ -2263,26 +2264,26 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print('### ip route show 192.168.10.1')
output = check_output('ip route show 192.168.10.1')
print(output)
self.assertRegex(output, '192.168.10.1 proto static')
self.assertRegex(output, 'nexthop via 149.10.124.59 dev dummy98 weight 10')
self.assertRegex(output, 'nexthop via 149.10.124.60 dev dummy98 weight 5')
self.assertIn('192.168.10.1 proto static', output)
self.assertIn('nexthop via 149.10.124.59 dev dummy98 weight 10', output)
self.assertIn('nexthop via 149.10.124.60 dev dummy98 weight 5', output)
print('### ip route show 192.168.10.2')
output = check_output('ip route show 192.168.10.2')
print(output)
# old ip command does not show IPv6 gateways...
self.assertRegex(output, '192.168.10.2 proto static')
self.assertRegex(output, 'nexthop')
self.assertRegex(output, 'dev dummy98 weight 10')
self.assertRegex(output, 'dev dummy98 weight 5')
self.assertIn('192.168.10.2 proto static', output)
self.assertIn('nexthop', output)
self.assertIn('dev dummy98 weight 10', output)
self.assertIn('dev dummy98 weight 5', output)
print('### ip -6 route show 2001:1234:5:7fff:ff:ff:ff:ff')
output = check_output('ip -6 route show 2001:1234:5:7fff:ff:ff:ff:ff')
print(output)
# old ip command does not show 'nexthop' keyword and weight...
self.assertRegex(output, '2001:1234:5:7fff:ff:ff:ff:ff')
self.assertRegex(output, 'via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98')
self.assertRegex(output, 'via 2001:1234:5:9fff:ff:ff:ff:ff dev dummy98')
self.assertIn('2001:1234:5:7fff:ff:ff:ff:ff', output)
self.assertIn('via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98', output)
self.assertIn('via 2001:1234:5:9fff:ff:ff:ff:ff dev dummy98', output)
copy_unit_to_networkd_unit_path('25-address-static.network')
check_output(*networkctl_cmd, 'reload', env=env)
@ -2329,17 +2330,17 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print('### ip route show type blackhole')
output = check_output('ip route show type blackhole')
print(output)
self.assertRegex(output, 'blackhole 202.54.1.2 proto static')
self.assertIn('blackhole 202.54.1.2 proto static', output)
print('### ip route show type unreachable')
output = check_output('ip route show type unreachable')
print(output)
self.assertRegex(output, 'unreachable 202.54.1.3 proto static')
self.assertIn('unreachable 202.54.1.3 proto static', output)
print('### ip route show type prohibit')
output = check_output('ip route show type prohibit')
print(output)
self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
self.assertIn('prohibit 202.54.1.4 proto static', output)
print('### ip -6 route show type blackhole')
output = check_output('ip -6 route show type blackhole')

Loading…
Cancel
Save