From 970ab1fcc0511622c1e99865bd008d6c02b95065 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 12 Mar 2020 02:40:29 +0900 Subject: [PATCH] test-network: add a test case for HHF --- test/test-network/conf/25-qdisc-hhf.network | 11 ++++++++++ test/test-network/systemd-networkd-tests.py | 24 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/test-network/conf/25-qdisc-hhf.network diff --git a/test/test-network/conf/25-qdisc-hhf.network b/test/test-network/conf/25-qdisc-hhf.network new file mode 100644 index 00000000000..950536259fc --- /dev/null +++ b/test/test-network/conf/25-qdisc-hhf.network @@ -0,0 +1,11 @@ +[Match] +Name=dummy98 + +[Network] +IPv6AcceptRA=no +Address=10.1.2.3/16 + +[HeavyHitterFilter] +Parent=root +Handle=3a +PacketLimit=1022 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 8d481b6f721..5df1fed9859 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -181,6 +181,18 @@ def expectedFailureIfPIEIsNotAvailable(): return f +def expectedFailureIfHHFIsNotAvailable(): + def f(func): + call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL) + rc = call('tc qdisc add dev dummy98 parent root hhf', 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 @@ -1648,6 +1660,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): '25-qdisc-cake.network', '25-qdisc-clsact-and-htb.network', '25-qdisc-drr.network', + '25-qdisc-hhf.network', '25-qdisc-ingress-netem-compat.network', '25-qdisc-pie.network', '25-route-ipv6-src.network', @@ -2391,6 +2404,17 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): self.assertRegex(output, 'qdisc pie 3a: root') self.assertRegex(output, 'limit 200000') + @expectedFailureIfHHFIsNotAvailable() + def test_qdisc_hhf(self): + copy_unit_to_networkd_unit_path('25-qdisc-hhf.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 hhf 3a: root') + self.assertRegex(output, 'limit 1022p') + class NetworkdStateFileTests(unittest.TestCase, Utilities): links = [ 'dummy98',