summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-10-30 14:35:51 +0900
committerGitHub <noreply@github.com>2019-10-30 14:35:51 +0900
commita346aa7c38dff023a6783eade2900cb75eff1d25 (patch)
tree0a48471f2b6f732eb6813cb0c1d2219a673afd7e /test
parentafa1a54eb5cb1a375fe4a305d41b1a2d53fdab26 (diff)
parentef3c8a92b7332fa9e017afcb5e88f22255eb8d1d (diff)
downloadsystemd-a346aa7c38dff023a6783eade2900cb75eff1d25.tar.gz
Merge pull request #13747 from ssahani/tc-qdisc
network: introduce Traffic Control
Diffstat (limited to 'test')
-rw-r--r--test/fuzz/fuzz-network-parser/directives.network6
-rw-r--r--test/test-network/conf/25-qdisc.network20
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py18
3 files changed, 41 insertions, 3 deletions
diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network
index 7a25561336..0d0892fd3a 100644
--- a/test/fuzz/fuzz-network-parser/directives.network
+++ b/test/fuzz/fuzz-network-parser/directives.network
@@ -262,3 +262,9 @@ DNS=
[NextHop]
Id=
Gateway=
+[TrafficControlQueueingDiscipline]
+Parent=
+NetworkEmulatorDelaySec=
+NetworkEmulatorDelayJitterSec=
+NetworkEmulatorLossRate=
+NetworkEmulatorPacketLimit=
diff --git a/test/test-network/conf/25-qdisc.network b/test/test-network/conf/25-qdisc.network
new file mode 100644
index 0000000000..de8f7243ce
--- /dev/null
+++ b/test/test-network/conf/25-qdisc.network
@@ -0,0 +1,20 @@
+[Match]
+Name=dummy98
+
+[Network]
+IPv6AcceptRA=no
+Address=10.1.2.3/16
+
+[TrafficControlQueueingDiscipline]
+Parent=root
+NetworkEmulatorDelaySec=50ms
+NetworkEmulatorDelayJitterSec=10ms
+NetworkEmulatorLossRate=20%
+NetworkEmulatorPacketLimit=100
+
+[TrafficControlQueueingDiscipline]
+Parent=clsact
+NetworkEmulatorDelaySec=100ms
+NetworkEmulatorDelayJitterSec=13ms
+NetworkEmulatorLossRate=20.5%
+NetworkEmulatorPacketLimit=200
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 1cd623482f..e9b9fb0d7c 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -1485,15 +1485,16 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-gre-tunnel-remote-any.netdev',
'25-ip6gre-tunnel-remote-any.netdev',
'25-ipv6-address-label-section.network',
+ '25-link-local-addressing-no.network',
+ '25-link-local-addressing-yes.network',
+ '25-link-section-unmanaged.network',
'25-neighbor-section.network',
'25-neighbor-next.network',
'25-neighbor-ipv6.network',
'25-neighbor-ip-dummy.network',
'25-neighbor-ip.network',
'25-nexthop.network',
- '25-link-local-addressing-no.network',
- '25-link-local-addressing-yes.network',
- '25-link-section-unmanaged.network',
+ '25-qdisc.network',
'25-route-ipv6-src.network',
'25-route-static.network',
'25-gateway-static.network',
@@ -2051,6 +2052,17 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, '192.168.5.1')
+ def test_qdisc(self):
+ copy_unit_to_networkd_unit_path('25-qdisc.network', '12-dummy.netdev')
+ start_networkd()
+
+ self.wait_online(['dummy98:routable'])
+
+ output = check_output('tc qdisc show dev dummy98')
+ print(output)
+ self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
+ self.assertRegex(output, 'limit 200 delay 100.0ms 13.0ms loss 20.5%')
+
class NetworkdStateFileTests(unittest.TestCase, Utilities):
links = [
'dummy98',