]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add a test case for CAKE 14890/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 17 Feb 2020 12:03:12 +0000 (21:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 2 Mar 2020 06:59:37 +0000 (15:59 +0900)
test/test-network/conf/25-qdisc-cake.network [new file with mode: 0644]
test/test-network/systemd-networkd-tests.py

diff --git a/test/test-network/conf/25-qdisc-cake.network b/test/test-network/conf/25-qdisc-cake.network
new file mode 100644 (file)
index 0000000..b713245
--- /dev/null
@@ -0,0 +1,12 @@
+[Match]
+Name=dummy98
+
+[Network]
+IPv6AcceptRA=no
+Address=10.1.2.3/16
+
+[CAKE]
+Parent=root
+Handle=3a
+Overhead=128
+Bandwidth=500M
index 3d26a87bae6488532c1ab10b2c329af80951b323..9d39bfb920b92334fa0298dd6e65736857a46917 100755 (executable)
@@ -156,6 +156,18 @@ def expectedFailureIfAlternativeNameIsNotAvailable():
 
     return f
 
+def expectedFailureIfCAKEIsNotAvailable():
+    def f(func):
+        call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL)
+        rc = call('tc qdisc add dev dummy98 parent root cake', stderr=subprocess.DEVNULL)
+        call('ip link del dummy98', stderr=subprocess.DEVNULL)
+        if rc == 0:
+            return func
+        else:
+            return unittest.expectedFailure(func)
+
+    return f
+
 def setUpModule():
     global running_units
 
@@ -1620,6 +1632,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         '25-neighbor-ip-dummy.network',
         '25-neighbor-ip.network',
         '25-nexthop.network',
+        '25-qdisc-cake.network',
         '25-qdisc-clsact-and-htb.network',
         '25-qdisc-ingress-netem-compat.network',
         '25-route-ipv6-src.network',
@@ -2316,6 +2329,18 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
         self.assertRegex(output, 'class htb 2:39 root leaf 39:')
         self.assertRegex(output, 'prio 1 rate 1Mbit ceil 500Kbit')
 
+    @expectedFailureIfCAKEIsNotAvailable()
+    def test_qdisc_cake(self):
+        copy_unit_to_networkd_unit_path('25-qdisc-cake.network', '12-dummy.netdev')
+        start_networkd()
+        self.wait_online(['dummy98:routable'])
+
+        output = check_output('tc qdisc show dev dummy98')
+        print(output)
+        self.assertRegex(output, 'qdisc cake 3a: root')
+        self.assertRegex(output, 'bandwidth 500Mbit')
+        self.assertRegex(output, 'overhead 128')
+
 class NetworkdStateFileTests(unittest.TestCase, Utilities):
     links = [
         'dummy98',