summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorkhramshinr <khramshinr@gmail.com>2024-04-12 13:32:52 +0800
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-04-13 11:11:07 +0000
commit92f236989bc8fee0cc0170999204dc5ffc5cc1f8 (patch)
tree90bff1230431992cfb2a66c3dfb1fe3ad9bc94b2 /smoketest/scripts/cli
parent7441c14810e5254d53c7fefca87297ad10ab9c1d (diff)
downloadvyos-1x-92f236989bc8fee0cc0170999204dc5ffc5cc1f8.tar.gz
vyos-1x-92f236989bc8fee0cc0170999204dc5ffc5cc1f8.zip
qos: T6035: QoS policy shaper queue-type random-detect requires limit avpkt
Added params for configuration red on the shaper policy (cherry picked from commit 31cd75aec6d035b36537046ae0d034c03009a3fc)
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_qos.py64
1 files changed, 63 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_qos.py b/smoketest/scripts/cli/test_qos.py
index 1eb4b5cfb..4f41e36cd 100755
--- a/smoketest/scripts/cli/test_qos.py
+++ b/smoketest/scripts/cli/test_qos.py
@@ -581,7 +581,6 @@ class TestQoS(VyOSUnitTestSHIM.TestCase):
dport = int(match_config['dport'])
self.assertEqual(f'{dport:x}', filter['options']['match']['value'])
-
def test_11_shaper(self):
bandwidth = 250
default_bandwidth = 20
@@ -635,6 +634,69 @@ class TestQoS(VyOSUnitTestSHIM.TestCase):
class_bandwidth += 1
class_ceil += 1
+ def test_12_shaper_with_red_queue(self):
+ bandwidth = 100
+ default_bandwidth = 100
+ default_burst = 100
+ interface = self._interfaces[0]
+ class_bandwidth = 50
+ dst_address = '192.0.2.8/32'
+
+ shaper_name = f'qos-shaper-{interface}'
+ self.cli_set(base_path + ['interface', interface, 'egress', shaper_name])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'bandwidth', f'{bandwidth}mbit'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'default', 'bandwidth', f'{default_bandwidth}%'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'default', 'burst', f'{default_burst}'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'default', 'queue-type', 'random-detect'])
+
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'bandwidth', f'{class_bandwidth}mbit'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'match', '10', 'ip', 'destination', 'address', dst_address])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'queue-type', 'random-detect'])
+
+ # commit changes
+ self.cli_commit()
+
+ # check root htb config
+ output = cmd(f'tc class show dev {interface}')
+
+ config_entries = (
+ f'prio 0 rate {class_bandwidth}Mbit ceil 50Mbit burst 15Kb', # specified class
+ f'prio 7 rate {default_bandwidth}Mbit ceil 100Mbit burst {default_burst}b', # default class
+ )
+ for config_entry in config_entries:
+ self.assertIn(config_entry, output)
+
+ output = cmd(f'tc -d qdisc show dev {interface}')
+ config_entries = (
+ 'qdisc red', # use random detect
+ 'limit 72Kb min 9Kb max 18Kb ewma 3 probability 0.1', # default config for random detect
+ )
+ for config_entry in config_entries:
+ self.assertIn(config_entry, output)
+
+ # test random detect queue params
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'default', 'queue-limit', '1024'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'default', 'average-packet', '1024'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'default', 'maximum-threshold', '32'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'default', 'minimum-threshold', '16'])
+
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'queue-limit', '1024'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'average-packet', '512'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'maximum-threshold', '32'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'minimum-threshold', '16'])
+ self.cli_set(base_path + ['policy', 'shaper', shaper_name, 'class', '2', 'mark-probability', '20'])
+
+ self.cli_commit()
+
+ output = cmd(f'tc -d qdisc show dev {interface}')
+ config_entries = (
+ 'qdisc red', # use random detect
+ 'limit 1Mb min 16Kb max 32Kb ewma 3 probability 0.1', # default config for random detect
+ 'limit 512Kb min 8Kb max 16Kb ewma 3 probability 0.05', # class config for random detect
+ )
+ for config_entry in config_entries:
+ self.assertIn(config_entry, output)
+
if __name__ == '__main__':
unittest.main(verbosity=2)