test-network: add test case for TBF

This commit is contained in:
Yu Watanabe 2019-11-24 21:23:48 +09:00
parent f1dba55565
commit 1b628c4f64
3 changed files with 20 additions and 3 deletions

View File

@ -0,0 +1,12 @@
[Match]
Name=test1
[Network]
IPv6AcceptRA=no
Address=10.1.2.4/16
[TrafficControlQueueingDiscipline]
Parent=root
TokenBufferFilterRate=0.5M
TokenBufferFilterBurst=5K
TokenBufferFilterLatencySec=70msec

View File

@ -1498,7 +1498,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-neighbor-ip-dummy.network',
'25-neighbor-ip.network',
'25-nexthop.network',
'25-qdisc.network',
'25-qdisc-netem.network',
'25-qdisc-tbf.network',
'25-route-ipv6-src.network',
'25-route-static.network',
'25-gateway-static.network',
@ -2057,15 +2058,19 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, '192.168.5.1')
def test_qdisc(self):
copy_unit_to_networkd_unit_path('25-qdisc.network', '12-dummy.netdev')
copy_unit_to_networkd_unit_path('25-qdisc-netem.network', '12-dummy.netdev',
'25-qdisc-tbf.network', '11-dummy.netdev')
start_networkd()
self.wait_online(['dummy98:routable'])
self.wait_online(['dummy98:routable', 'test1: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%')
output = check_output('tc qdisc show dev test1')
print(output)
self.assertRegex(output, 'rate 500Kbit burst 5000b lat 70.0ms')
class NetworkdStateFileTests(unittest.TestCase, Utilities):
links = [