1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-01 09:47:35 +03:00

test-network: add test case for MPLSRouting=yes

This commit is contained in:
Yu Watanabe 2024-12-07 05:47:07 +09:00 committed by Luca Boccassi
parent 10a768443a
commit af44a16ec7
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=dummy98
[Network]
IPv6AcceptRA=no
MPLSRouting=yes

View File

@ -732,6 +732,9 @@ def read_ipv6_neigh_sysctl_attr(link, attribute):
def read_ipv4_sysctl_attr(link, attribute):
return read_ip_sysctl_attr(link, attribute, 'ipv4')
def read_mpls_sysctl_attr(link, attribute):
return read_ip_sysctl_attr(link, attribute, 'mpls')
def stop_by_pid_file(pid_file):
if not os.path.exists(pid_file):
return
@ -1117,6 +1120,9 @@ class Utilities():
def check_ipv6_neigh_sysctl_attr(self, link, attribute, expected):
self.assertEqual(read_ipv6_neigh_sysctl_attr(link, attribute), expected)
def check_mpls_sysctl_attr(self, link, attribute, expected):
self.assertEqual(read_mpls_sysctl_attr(link, attribute), expected)
def wait_links(self, *links, trial=40):
for _ in range(trial):
if link_exists(*links):
@ -4568,6 +4574,15 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'via 2607:5300:203:39ff:ff:ff:ff:ff')
@expectedFailureIfModuleIsNotAvailable('mpls_router')
def test_sysctl_mpls(self):
check_output('modprobe mpls_router')
copy_network_unit('25-sysctl-mpls.network', '12-dummy.netdev')
start_networkd()
self.wait_online('dummy98:degraded')
self.check_mpls_sysctl_attr('dummy98', 'input', '1')
def test_bind_carrier(self):
copy_network_unit('25-bind-carrier.network', '11-dummy.netdev')
start_networkd()