mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
test-network: add test case for HTB class
This commit is contained in:
parent
19f86a6351
commit
f1de1eb3e3
124
test/test-network/conf/25-qdisc-clsact-and-htb.network
Normal file
124
test/test-network/conf/25-qdisc-clsact-and-htb.network
Normal file
@ -0,0 +1,124 @@
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=10.1.2.3/16
|
||||
|
||||
[QDisc]
|
||||
Parent=clsact
|
||||
|
||||
[HierarchyTokenBucket]
|
||||
Parent=root
|
||||
Handle=0002
|
||||
DefaultClass=30
|
||||
|
||||
[HierarchyTokenBucketClass]
|
||||
Parent=root
|
||||
ClassId=0002:0030
|
||||
Priority=1
|
||||
Rate=1M
|
||||
CeilRate=0.5M
|
||||
|
||||
[NetworkEmulator]
|
||||
Parent=2:30
|
||||
Handle=0030
|
||||
DelaySec=50ms
|
||||
DelayJitterSec=10ms
|
||||
LossRate=20%
|
||||
PacketLimit=100
|
||||
|
||||
[HierarchyTokenBucketClass]
|
||||
Parent=root
|
||||
ClassId=0002:0031
|
||||
Priority=1
|
||||
Rate=1M
|
||||
CeilRate=0.5M
|
||||
|
||||
[TrivialLinkEqualizer]
|
||||
Parent=2:31
|
||||
Handle=0031
|
||||
Id=1
|
||||
|
||||
[HierarchyTokenBucketClass]
|
||||
Parent=root
|
||||
ClassId=0002:0032
|
||||
Priority=1
|
||||
Rate=1M
|
||||
CeilRate=0.5M
|
||||
|
||||
[FairQueueing]
|
||||
Parent=2:32
|
||||
Handle=0032
|
||||
PacketLimit=1000
|
||||
FlowLimit=200
|
||||
Quantum=1500
|
||||
InitialQuantum=13000
|
||||
MaximumRate=1M
|
||||
Buckets=512
|
||||
OrphanMask=511
|
||||
Pacing=yes
|
||||
CEThresholdSec=100ms
|
||||
|
||||
[HierarchyTokenBucketClass]
|
||||
Parent=root
|
||||
ClassId=0002:0033
|
||||
Priority=1
|
||||
Rate=1M
|
||||
CeilRate=0.5M
|
||||
|
||||
[ControlledDelay]
|
||||
Parent=2:33
|
||||
Handle=0033
|
||||
PacketLimit=2000
|
||||
TargetSec=10ms
|
||||
IntervalSec=50ms
|
||||
ECN=yes
|
||||
CEThresholdSec=100ms
|
||||
|
||||
[HierarchyTokenBucketClass]
|
||||
Parent=root
|
||||
ClassId=0002:0034
|
||||
Priority=1
|
||||
Rate=1M
|
||||
CeilRate=0.5M
|
||||
|
||||
[FairQueueingControlledDelay]
|
||||
Parent=2:34
|
||||
Handle=0034
|
||||
PacketLimit=20480
|
||||
MemoryLimit=64M
|
||||
Flows=2048
|
||||
TargetSec=10ms
|
||||
IntervalSec=200ms
|
||||
Quantum=1400
|
||||
ECN=yes
|
||||
CEThresholdSec=100ms
|
||||
|
||||
[HierarchyTokenBucketClass]
|
||||
Parent=root
|
||||
ClassId=0002:0035
|
||||
Priority=1
|
||||
Rate=1M
|
||||
CeilRate=0.5M
|
||||
|
||||
[TokenBucketFilter]
|
||||
Parent=2:35
|
||||
Handle=0035
|
||||
Rate=1G
|
||||
Burst=5K
|
||||
LatencySec=70msec
|
||||
PeakRate=100G
|
||||
MTUBytes=1M
|
||||
|
||||
[HierarchyTokenBucketClass]
|
||||
Parent=root
|
||||
ClassId=0002:0036
|
||||
Priority=1
|
||||
Rate=1M
|
||||
CeilRate=0.5M
|
||||
|
||||
[StochasticFairnessQueueing]
|
||||
Parent=2:36
|
||||
Handle=0036
|
||||
PerturbPeriodSec=5sec
|
@ -1,12 +0,0 @@
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=10.1.2.3/16
|
||||
|
||||
#[TrafficControlQueueingDiscipline]
|
||||
#Parent=root
|
||||
|
||||
[TrafficControlQueueingDiscipline]
|
||||
Parent=clsact
|
@ -1,27 +0,0 @@
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=10.1.2.3/16
|
||||
|
||||
[FairQueueing]
|
||||
Parent=root
|
||||
Handle=0003
|
||||
PacketLimit=1000
|
||||
FlowLimit=200
|
||||
Quantum=1500
|
||||
InitialQuantum=13000
|
||||
MaximumRate=1M
|
||||
Buckets=512
|
||||
OrphanMask=511
|
||||
Pacing=yes
|
||||
CEThresholdSec=100ms
|
||||
|
||||
[ControlledDelay]
|
||||
Parent=clsact
|
||||
PacketLimit=2000
|
||||
TargetSec=10ms
|
||||
IntervalSec=50ms
|
||||
ECN=yes
|
||||
CEThresholdSec=100ms
|
@ -1,12 +0,0 @@
|
||||
[Match]
|
||||
Name=test1
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=10.1.2.4/16
|
||||
|
||||
#[QDisc]
|
||||
#Parent=root
|
||||
|
||||
[QDisc]
|
||||
Parent=ingress
|
@ -1,25 +0,0 @@
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=10.1.2.3/16
|
||||
|
||||
[NetworkEmulator]
|
||||
Parent=root
|
||||
Handle=001f
|
||||
DelaySec=50ms
|
||||
DelayJitterSec=10ms
|
||||
LossRate=20%
|
||||
PacketLimit=100
|
||||
|
||||
[FairQueueingControlledDelay]
|
||||
Parent=ingress
|
||||
PacketLimit=20480
|
||||
MemoryLimit=64M
|
||||
Flows=2048
|
||||
TargetSec=10ms
|
||||
IntervalSec=200ms
|
||||
Quantum=1400
|
||||
ECN=yes
|
||||
CEThresholdSec=100ms
|
@ -1,19 +0,0 @@
|
||||
[Match]
|
||||
Name=test1
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=10.1.2.4/16
|
||||
|
||||
[TokenBucketFilter]
|
||||
Parent=root
|
||||
Handle=003f
|
||||
Rate=1G
|
||||
Burst=5K
|
||||
LatencySec=70msec
|
||||
PeakRate=100G
|
||||
MTUBytes=1M
|
||||
|
||||
[StochasticFairnessQueueing]
|
||||
Parent=clsact
|
||||
PerturbPeriodSec=5sec
|
@ -1,15 +0,0 @@
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=10.1.2.3/16
|
||||
|
||||
[TrivialLinkEqualizer]
|
||||
Parent=ingress
|
||||
Id=1
|
||||
|
||||
[HierarchyTokenBucket]
|
||||
Parent=root
|
||||
Handle=0002
|
||||
DefaultClass=30
|
@ -1620,13 +1620,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
'25-neighbor-ip-dummy.network',
|
||||
'25-neighbor-ip.network',
|
||||
'25-nexthop.network',
|
||||
'25-qdisc-clsact-root-compat.network',
|
||||
'25-qdisc-fq-codel.network',
|
||||
'25-qdisc-clsact-and-htb.network',
|
||||
'25-qdisc-ingress-netem-compat.network',
|
||||
'25-qdisc-ingress-root.network',
|
||||
'25-qdisc-netem-and-fqcodel.network',
|
||||
'25-qdisc-tbf-and-sfq.network',
|
||||
'25-qdisc-teql-and-htb.network',
|
||||
'25-route-ipv6-src.network',
|
||||
'25-route-static.network',
|
||||
'25-route-vrf.network',
|
||||
@ -2253,74 +2248,62 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
self.assertRegex(output, '192.168.5.1')
|
||||
|
||||
def test_qdisc(self):
|
||||
copy_unit_to_networkd_unit_path('25-qdisc-netem-and-fqcodel.network', '12-dummy.netdev',
|
||||
'25-qdisc-tbf-and-sfq.network', '11-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['dummy98:routable', 'test1:routable'])
|
||||
|
||||
output = check_output('tc qdisc show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'qdisc netem 1f:')
|
||||
self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
|
||||
self.assertRegex(output, 'qdisc fq_codel')
|
||||
self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10.0ms ce_threshold 100.0ms interval 200.0ms memory_limit 64Mb ecn')
|
||||
output = check_output('tc qdisc show dev test1')
|
||||
print(output)
|
||||
self.assertRegex(output, 'qdisc tbf 3f:')
|
||||
self.assertRegex(output, 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70.0ms')
|
||||
self.assertRegex(output, 'qdisc sfq')
|
||||
self.assertRegex(output, 'perturb 5sec')
|
||||
|
||||
def test_qdisc2(self):
|
||||
copy_unit_to_networkd_unit_path('25-qdisc-fq-codel.network', '12-dummy.netdev',
|
||||
'25-qdisc-ingress-root.network', '11-dummy.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['dummy98:routable', 'test1:routable'])
|
||||
|
||||
output = check_output('tc qdisc show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'qdisc fq 3:')
|
||||
self.assertRegex(output, 'limit 1000p flow_limit 200p buckets 512 orphan_mask 511')
|
||||
self.assertRegex(output, 'quantum 1500')
|
||||
self.assertRegex(output, 'initial_quantum 13000')
|
||||
self.assertRegex(output, 'maxrate 1Mbit')
|
||||
self.assertRegex(output, 'qdisc codel')
|
||||
self.assertRegex(output, 'limit 2000p target 10.0ms ce_threshold 100.0ms interval 50.0ms ecn')
|
||||
output = check_output('tc qdisc show dev test1')
|
||||
print(output)
|
||||
self.assertRegex(output, 'qdisc ingress')
|
||||
|
||||
def test_qdisc3(self):
|
||||
copy_unit_to_networkd_unit_path('25-qdisc-clsact-root-compat.network', '12-dummy.netdev',
|
||||
copy_unit_to_networkd_unit_path('25-qdisc-clsact-and-htb.network', '12-dummy.netdev',
|
||||
'25-qdisc-ingress-netem-compat.network', '11-dummy.netdev')
|
||||
check_output('modprobe sch_teql max_equalizers=2')
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['dummy98:routable', 'test1:routable'])
|
||||
|
||||
output = check_output('tc qdisc show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'qdisc clsact')
|
||||
output = check_output('tc qdisc show dev test1')
|
||||
print(output)
|
||||
self.assertRegex(output, 'qdisc netem')
|
||||
self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
|
||||
self.assertRegex(output, 'qdisc ingress')
|
||||
|
||||
def test_qdisc4(self):
|
||||
copy_unit_to_networkd_unit_path('25-qdisc-teql-and-htb.network', '12-dummy.netdev')
|
||||
check_output('modprobe sch_teql max_equalizers=2')
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output('tc qdisc show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'qdisc teql1')
|
||||
self.assertRegex(output, 'qdisc htb 2:')
|
||||
self.assertRegex(output, 'qdisc clsact')
|
||||
|
||||
self.assertRegex(output, 'qdisc htb 2: root')
|
||||
self.assertRegex(output, r'default (0x30|30)')
|
||||
|
||||
self.assertRegex(output, 'qdisc netem 30: parent 2:30')
|
||||
self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
|
||||
self.assertRegex(output, 'qdisc fq_codel')
|
||||
self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10.0ms ce_threshold 100.0ms interval 200.0ms memory_limit 64Mb ecn')
|
||||
|
||||
self.assertRegex(output, 'qdisc teql1 31: parent 2:31')
|
||||
|
||||
self.assertRegex(output, 'qdisc fq 32: parent 2:32')
|
||||
self.assertRegex(output, 'limit 1000p flow_limit 200p buckets 512 orphan_mask 511')
|
||||
self.assertRegex(output, 'quantum 1500')
|
||||
self.assertRegex(output, 'initial_quantum 13000')
|
||||
self.assertRegex(output, 'maxrate 1Mbit')
|
||||
|
||||
self.assertRegex(output, 'qdisc codel 33: parent 2:33')
|
||||
self.assertRegex(output, 'limit 2000p target 10.0ms ce_threshold 100.0ms interval 50.0ms ecn')
|
||||
|
||||
self.assertRegex(output, 'qdisc fq_codel 34: parent 2:34')
|
||||
self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10.0ms ce_threshold 100.0ms interval 200.0ms memory_limit 64Mb ecn')
|
||||
|
||||
self.assertRegex(output, 'qdisc tbf 35: parent 2:35')
|
||||
self.assertRegex(output, 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70.0ms')
|
||||
|
||||
self.assertRegex(output, 'qdisc sfq 36: parent 2:36')
|
||||
self.assertRegex(output, 'perturb 5sec')
|
||||
|
||||
output = check_output('tc class show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'class htb 2:30 root leaf 30:')
|
||||
self.assertRegex(output, 'class htb 2:31 root leaf 31:')
|
||||
self.assertRegex(output, 'class htb 2:32 root leaf 32:')
|
||||
self.assertRegex(output, 'class htb 2:33 root leaf 33:')
|
||||
self.assertRegex(output, 'class htb 2:34 root leaf 34:')
|
||||
self.assertRegex(output, 'class htb 2:35 root leaf 35:')
|
||||
self.assertRegex(output, 'class htb 2:36 root leaf 36:')
|
||||
self.assertRegex(output, 'prio 1 rate 1Mbit ceil 500Kbit')
|
||||
|
||||
class NetworkdStateFileTests(unittest.TestCase, Utilities):
|
||||
links = [
|
||||
'dummy98',
|
||||
|
Loading…
Reference in New Issue
Block a user