]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add test case for MPLSRouting=yes 35495/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 6 Dec 2024 20:47:07 +0000 (05:47 +0900)
committerLuca Boccassi <bluca@debian.org>
Fri, 13 Dec 2024 15:36:45 +0000 (15:36 +0000)
test/test-network/conf/25-sysctl-mpls.network [new file with mode: 0644]
test/test-network/systemd-networkd-tests.py

diff --git a/test/test-network/conf/25-sysctl-mpls.network b/test/test-network/conf/25-sysctl-mpls.network
new file mode 100644 (file)
index 0000000..9494efd
--- /dev/null
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=dummy98
+
+[Network]
+IPv6AcceptRA=no
+MPLSRouting=yes
index 000645c916e26bbaa64493177b6bf1338c698ece..136a6ed7448f414cb162b335797b37617656b0ad 100755 (executable)
@@ -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()