test-network: add tests for fib rules with Family=both vs networkctl reload or reconfigure
This commit is contained in:
parent
a75466ed19
commit
49ff3f34d5
|
@ -21,7 +21,7 @@ OutgoingInterface=test1
|
||||||
# iif
|
# iif
|
||||||
[RoutingPolicyRule]
|
[RoutingPolicyRule]
|
||||||
Table=1011
|
Table=1011
|
||||||
Family=ipv4
|
Family=both
|
||||||
Priority=10113
|
Priority=10113
|
||||||
IncomingInterface=test1
|
IncomingInterface=test1
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
[Match]
|
||||||
|
Name=test1
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
|
||||||
|
# fwmark
|
||||||
|
[RoutingPolicyRule]
|
||||||
|
Table=1011
|
||||||
|
Family=ipv4
|
||||||
|
Priority=10111
|
||||||
|
FirewallMark=1011
|
||||||
|
|
||||||
|
# oif
|
||||||
|
[RoutingPolicyRule]
|
||||||
|
Table=1011
|
||||||
|
Family=both
|
||||||
|
Priority=10112
|
||||||
|
OutgoingInterface=test1
|
||||||
|
|
||||||
|
# iif
|
||||||
|
[RoutingPolicyRule]
|
||||||
|
Table=1011
|
||||||
|
Family=ipv4
|
||||||
|
Priority=10113
|
||||||
|
IncomingInterface=test1
|
||||||
|
|
||||||
|
# source
|
||||||
|
[RoutingPolicyRule]
|
||||||
|
Table=1011
|
||||||
|
Family=ipv4
|
||||||
|
Priority=10114
|
||||||
|
From=192.168.8.254
|
|
@ -1800,7 +1800,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
'26-link-local-addressing-ipv6.network',
|
'26-link-local-addressing-ipv6.network',
|
||||||
'routing-policy-rule-dummy98.network',
|
'routing-policy-rule-dummy98.network',
|
||||||
'routing-policy-rule-test1.network',
|
'routing-policy-rule-test1.network',
|
||||||
'routing-policy-rule-reconfigure.network',
|
'routing-policy-rule-reconfigure1.network',
|
||||||
|
'routing-policy-rule-reconfigure2.network',
|
||||||
]
|
]
|
||||||
|
|
||||||
routing_policy_rule_tables = ['7', '8', '9', '1011']
|
routing_policy_rule_tables = ['7', '8', '9', '1011']
|
||||||
|
@ -2084,37 +2085,65 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
stop_networkd(remove_state_files=False)
|
stop_networkd(remove_state_files=False)
|
||||||
|
|
||||||
def test_routing_policy_rule_reconfigure(self):
|
def test_routing_policy_rule_reconfigure(self):
|
||||||
copy_unit_to_networkd_unit_path('routing-policy-rule-reconfigure.network', '11-dummy.netdev')
|
copy_unit_to_networkd_unit_path('routing-policy-rule-reconfigure2.network', '11-dummy.netdev')
|
||||||
start_networkd()
|
start_networkd()
|
||||||
self.wait_online(['test1:degraded'])
|
self.wait_online(['test1:degraded'])
|
||||||
|
|
||||||
output = check_output('ip rule list table 1011')
|
output = check_output('ip rule list table 1011')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, '10111: from all fwmark 0x3f3 lookup 1011')
|
self.assertIn('10111: from all fwmark 0x3f3 lookup 1011', output)
|
||||||
self.assertRegex(output, '10112: from all oif test1 lookup 1011')
|
self.assertIn('10112: from all oif test1 lookup 1011', output)
|
||||||
self.assertRegex(output, '10113: from all iif test1 lookup 1011')
|
self.assertIn('10113: from all iif test1 lookup 1011', output)
|
||||||
self.assertRegex(output, '10114: from 192.168.8.254 lookup 1011')
|
self.assertIn('10114: from 192.168.8.254 lookup 1011', output)
|
||||||
|
|
||||||
|
output = check_output('ip -6 rule list table 1011')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('10112: from all oif test1 lookup 1011', output)
|
||||||
|
|
||||||
|
copy_unit_to_networkd_unit_path('routing-policy-rule-reconfigure1.network', '11-dummy.netdev')
|
||||||
|
run(*networkctl_cmd, 'reload', env=env)
|
||||||
|
time.sleep(1)
|
||||||
|
self.wait_online(['test1:degraded'])
|
||||||
|
|
||||||
|
output = check_output('ip rule list table 1011')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('10111: from all fwmark 0x3f3 lookup 1011', output)
|
||||||
|
self.assertIn('10112: from all oif test1 lookup 1011', output)
|
||||||
|
self.assertIn('10113: from all iif test1 lookup 1011', output)
|
||||||
|
self.assertIn('10114: from 192.168.8.254 lookup 1011', output)
|
||||||
|
|
||||||
|
output = check_output('ip -6 rule list table 1011')
|
||||||
|
print(output)
|
||||||
|
self.assertNotIn('10112: from all oif test1 lookup 1011', output)
|
||||||
|
self.assertIn('10113: from all iif test1 lookup 1011', output)
|
||||||
|
|
||||||
run('ip rule delete priority 10111')
|
run('ip rule delete priority 10111')
|
||||||
run('ip rule delete priority 10112')
|
run('ip rule delete priority 10112')
|
||||||
run('ip rule delete priority 10113')
|
run('ip rule delete priority 10113')
|
||||||
run('ip rule delete priority 10114')
|
run('ip rule delete priority 10114')
|
||||||
run('ip rule delete priority 10115')
|
run('ip -6 rule delete priority 10113')
|
||||||
|
|
||||||
output = check_output('ip rule list table 1011')
|
output = check_output('ip rule list table 1011')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertEqual(output, '')
|
self.assertEqual(output, '')
|
||||||
|
|
||||||
run(*networkctl_cmd, 'reconfigure', 'test1', env=env)
|
output = check_output('ip -6 rule list table 1011')
|
||||||
|
print(output)
|
||||||
|
self.assertEqual(output, '')
|
||||||
|
|
||||||
|
run(*networkctl_cmd, 'reconfigure', 'test1', env=env)
|
||||||
self.wait_online(['test1:degraded'])
|
self.wait_online(['test1:degraded'])
|
||||||
|
|
||||||
output = check_output('ip rule list table 1011')
|
output = check_output('ip rule list table 1011')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, '10111: from all fwmark 0x3f3 lookup 1011')
|
self.assertIn('10111: from all fwmark 0x3f3 lookup 1011', output)
|
||||||
self.assertRegex(output, '10112: from all oif test1 lookup 1011')
|
self.assertIn('10112: from all oif test1 lookup 1011', output)
|
||||||
self.assertRegex(output, '10113: from all iif test1 lookup 1011')
|
self.assertIn('10113: from all iif test1 lookup 1011', output)
|
||||||
self.assertRegex(output, '10114: from 192.168.8.254 lookup 1011')
|
self.assertIn('10114: from 192.168.8.254 lookup 1011', output)
|
||||||
|
|
||||||
|
output = check_output('ip -6 rule list table 1011')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('10113: from all iif test1 lookup 1011', output)
|
||||||
|
|
||||||
@expectedFailureIfRoutingPolicyPortRangeIsNotAvailable()
|
@expectedFailureIfRoutingPolicyPortRangeIsNotAvailable()
|
||||||
def test_routing_policy_rule_port_range(self):
|
def test_routing_policy_rule_port_range(self):
|
||||||
|
|
Loading…
Reference in New Issue