From e0ad421001d2017301950517a657051f79d8c0df Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 5 Jan 2023 19:22:27 +0100 Subject: qos: T4284: priority-queue and round-robin have no default bandwidth --- smoketest/scripts/cli/test_qos.py | 11 ++++++----- src/conf_mode/qos.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/smoketest/scripts/cli/test_qos.py b/smoketest/scripts/cli/test_qos.py index 014870ec4..0092473d6 100755 --- a/smoketest/scripts/cli/test_qos.py +++ b/smoketest/scripts/cli/test_qos.py @@ -222,8 +222,8 @@ class TestQoS(VyOSUnitTestSHIM.TestCase): # results in: tc -j qdisc show dev eth0 # [{"kind":"fq_codel","handle":"8046:","root":true,"refcnt":3,"options":{"limit":2048,"flows":512, # "quantum":1500,"target":4999,"interval":99999,"memory_limit":33554432,"drop_batch":64}}] - self.assertEqual(interval *1000 -1, tmp['options']['interval']) - self.assertEqual(target *1000 -1, tmp['options']['target']) + self.assertAlmostEqual(tmp['options']['interval'], interval *1000, delta=1) + self.assertAlmostEqual(tmp['options']['target'], target *1000 -1, delta=1) codel_quantum += 10 flows += 2 @@ -234,13 +234,13 @@ class TestQoS(VyOSUnitTestSHIM.TestCase): def test_05_limiter(self): qos_config = { '1' : { - 'bandwidth' : '100', + 'bandwidth' : '1000000', 'match4' : { 'ssh' : { 'dport' : '22', }, }, }, '2' : { - 'bandwidth' : '100', + 'bandwidth' : '1000000', 'match6' : { 'ssh' : { 'dport' : '22', }, }, @@ -260,7 +260,8 @@ class TestQoS(VyOSUnitTestSHIM.TestCase): first = False self.cli_set(base_path + ['interface', interface, 'ingress', policy_name]) - + # set default bandwidth parameter for all remaining connections + self.cli_set(base_path + ['policy', 'limiter', policy_name, 'default', 'bandwidth', '500000']) for qos_class, qos_class_config in qos_config.items(): qos_class_base = base_path + ['policy', 'limiter', policy_name, 'class', qos_class] diff --git a/src/conf_mode/qos.py b/src/conf_mode/qos.py index 1fe3b6aa9..0418e8d82 100755 --- a/src/conf_mode/qos.py +++ b/src/conf_mode/qos.py @@ -188,7 +188,7 @@ def verify(qos): raise ConfigError(f'Policy "{policy}" uses queue-limit "{queue_lim}" < max-threshold "{max_tr}"!') if 'default' in policy_config: - if 'bandwidth' not in policy_config['default']: + if 'bandwidth' not in policy_config['default'] and policy_type not in ['priority_queue', 'round_robin']: raise ConfigError('Bandwidth not defined for default traffic!') # we should check interface ingress/egress configuration after verifying that -- cgit v1.2.3