network: Add L3MasterDevice= into routing policy

This commit is contained in:
Nick Cao
2024-01-19 00:17:50 +00:00
committed by Luca Boccassi
parent 12af3f1834
commit 4be1fc8443
7 changed files with 112 additions and 20 deletions
@@ -496,6 +496,7 @@ KernelVersion=
Key=
Kind=
L2MissNotification=
L3MasterDevice=
L3MissNotification=
LACPTransmitRate=
LLDP=
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=test1
[Network]
IPv6AcceptRA=no
[RoutingPolicyRule]
Priority=1500
L3MasterDevice=true
[RoutingPolicyRule]
Priority=2000
L3MasterDevice=true
Type=unreachable
@@ -199,6 +199,14 @@ def expectedFailureIfRoutingPolicyUIDRangeIsNotAvailable():
return f
def expectedFailureIfRoutingPolicyL3MasterDeviceIsNotAvailable():
def f(func):
rc = call_quiet('ip rule add not from 192.168.100.19 l3mdev')
call_quiet('ip rule del not from 192.168.100.19 l3mdev')
return func if rc == 0 else unittest.expectedFailure(func)
return f
def expectedFailureIfNexthopIsNotAvailable():
def f(func):
rc = call_quiet('ip nexthop list')
@@ -3106,6 +3114,17 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'tcp')
self.assertRegex(output, 'lookup 7')
@expectedFailureIfRoutingPolicyL3MasterDeviceIsNotAvailable()
def test_routing_policy_rule_l3mdev(self):
copy_network_unit('25-fibrule-l3mdev.network', '11-dummy.netdev')
start_networkd()
self.wait_online(['test1:degraded'])
output = check_output('ip rule')
print(output)
self.assertIn('1500: from all lookup [l3mdev-table]', output)
self.assertIn('2000: from all lookup [l3mdev-table] unreachable', output)
@expectedFailureIfRoutingPolicyUIDRangeIsNotAvailable()
def test_routing_policy_rule_uidrange(self):
copy_network_unit('25-fibrule-uidrange.network', '11-dummy.netdev')