From b753e8358c9492f9046b424e46dcfb270126f400 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 9 Jun 2020 17:24:04 +0900 Subject: [PATCH] test-network: add tests for ETS --- test/test-network/conf/25-qdisc-ets.network | 20 ++++++++++++++++ test/test-network/systemd-networkd-tests.py | 26 +++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 test/test-network/conf/25-qdisc-ets.network diff --git a/test/test-network/conf/25-qdisc-ets.network b/test/test-network/conf/25-qdisc-ets.network new file mode 100644 index 00000000000..a8c6b68235b --- /dev/null +++ b/test/test-network/conf/25-qdisc-ets.network @@ -0,0 +1,20 @@ +[Match] +Name=dummy98 + +[Network] +IPv6AcceptRA=no +Address=10.1.2.3/16 + +[EnhancedTransmissionSelection] +Parent=root +Handle=3a +Bands=10 +StrictBands=3 +QuantumBytes=2 4 6 +QuantumBytes= +QuantumBytes=1 2 3 +QuantumBytes=4 5 +PriorityMap=8 7 6 5 +PriorityMap= +PriorityMap=3 4 5 +PriorityMap=6 7 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index b6d1de52235..f059bc90f1c 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -194,6 +194,18 @@ def expectedFailureIfHHFIsNotAvailable(): return f +def expectedFailureIfETSIsNotAvailable(): + def f(func): + call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL) + rc = call('tc qdisc add dev dummy98 parent root ets bands 10', 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 @@ -1673,6 +1685,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): '25-qdisc-cake.network', '25-qdisc-clsact-and-htb.network', '25-qdisc-drr.network', + '25-qdisc-ets.network', '25-qdisc-hhf.network', '25-qdisc-ingress-netem-compat.network', '25-qdisc-pie.network', @@ -2480,6 +2493,19 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): self.assertRegex(output, 'qdisc hhf 3a: root') self.assertRegex(output, 'limit 1022p') + @expectedFailureIfETSIsNotAvailable() + def test_qdisc_ets(self): + copy_unit_to_networkd_unit_path('25-qdisc-ets.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 ets 3a: root') + self.assertRegex(output, 'bands 10 strict 3') + self.assertRegex(output, 'quanta 1 2 3 4 5') + self.assertRegex(output, 'priomap 3 4 5 6 7') + class NetworkdStateFileTests(unittest.TestCase, Utilities): links = [ 'dummy98', -- 2.39.2