summaryrefslogtreecommitdiff
path: root/smoketest/scripts
diff options
context:
space:
mode:
authorRoman Khramshin <HollyGurza@users.noreply.github.com>2024-11-08 14:50:14 +0600
committerGitHub <noreply@github.com>2024-11-08 10:50:14 +0200
commit4139e1c12c3f8d6abdf42dc3febfffc097a41c7a (patch)
treee721dbcd7209926fd7fca8befa6377839f64f8ad /smoketest/scripts
parent5fac74ef9d3356a66a39e8ea6ddcb40d6944e23b (diff)
downloadvyos-1x-4139e1c12c3f8d6abdf42dc3febfffc097a41c7a.tar.gz
vyos-1x-4139e1c12c3f8d6abdf42dc3febfffc097a41c7a.zip
T6802: Fix QoS Policy Round-Robin with Default Configuration (#4177)
- Resolved unhandled exception occurring with default round-robin policy config. - Added default filter to ensure proper round-robin policy.
Diffstat (limited to 'smoketest/scripts')
-rwxr-xr-xsmoketest/scripts/cli/test_qos.py82
1 files changed, 75 insertions, 7 deletions
diff --git a/smoketest/scripts/cli/test_qos.py b/smoketest/scripts/cli/test_qos.py
index b98c0e9b7..77d384024 100755
--- a/smoketest/scripts/cli/test_qos.py
+++ b/smoketest/scripts/cli/test_qos.py
@@ -26,25 +26,42 @@ from vyos.utils.process import cmd
base_path = ['qos']
-def get_tc_qdisc_json(interface) -> dict:
+def get_tc_qdisc_json(interface, all=False) -> dict:
tmp = cmd(f'tc -detail -json qdisc show dev {interface}')
tmp = loads(tmp)
+
+ if all:
+ return tmp
+
return next(iter(tmp))
-def get_tc_filter_json(interface, direction) -> list:
- if direction not in ['ingress', 'egress']:
+
+def get_tc_filter_json(interface, direction=None) -> list:
+ if direction not in ['ingress', 'egress', None]:
raise ValueError()
- tmp = cmd(f'tc -detail -json filter show dev {interface} {direction}')
+
+ cmd_stmt = f'tc -detail -json filter show dev {interface}'
+ if direction:
+ cmd_stmt += f' {direction}'
+
+ tmp = cmd(cmd_stmt)
tmp = loads(tmp)
return tmp
-def get_tc_filter_details(interface, direction) -> list:
+
+def get_tc_filter_details(interface, direction=None) -> list:
# json doesn't contain all params, such as mtu
- if direction not in ['ingress', 'egress']:
+ if direction not in ['ingress', 'egress', None]:
raise ValueError()
- tmp = cmd(f'tc -details filter show dev {interface} {direction}')
+
+ cmd_stmt = f'tc -details filter show dev {interface}'
+ if direction:
+ cmd_stmt += f' {direction}'
+
+ tmp = cmd(cmd_stmt)
return tmp
+
class TestQoS(VyOSUnitTestSHIM.TestCase):
@classmethod
def setUpClass(cls):
@@ -854,6 +871,57 @@ class TestQoS(VyOSUnitTestSHIM.TestCase):
self.cli_set(['qos', 'traffic-match-group', '3', 'match-group', 'unexpected'])
self.cli_commit()
+ def test_20_round_robin_policy_default(self):
+ interface = self._interfaces[0]
+ policy_name = f'qos-policy-{interface}'
+
+ self.cli_set(base_path + ['interface', interface, 'egress', policy_name])
+ self.cli_set(
+ base_path
+ + ['policy', 'round-robin', policy_name, 'description', 'default policy']
+ )
+
+ # commit changes
+ self.cli_commit()
+
+ tmp = get_tc_qdisc_json(interface, all=True)
+
+ self.assertEqual(2, len(tmp))
+ self.assertEqual('drr', tmp[0]['kind'])
+ self.assertDictEqual({}, tmp[0]['options'])
+ self.assertEqual('sfq', tmp[1]['kind'])
+ self.assertDictEqual(
+ {
+ 'limit': 127,
+ 'quantum': 1514,
+ 'depth': 127,
+ 'flows': 128,
+ 'divisor': 1024,
+ },
+ tmp[1]['options'],
+ )
+
+ tmp = get_tc_filter_json(interface)
+ self.assertEqual(3, len(tmp))
+
+ for rec in tmp:
+ self.assertEqual('u32', rec['kind'])
+ self.assertEqual(1, rec['pref'])
+ self.assertEqual('all', rec['protocol'])
+
+ self.assertDictEqual(
+ {
+ 'fh': '800::800',
+ 'order': 2048,
+ 'key_ht': '800',
+ 'bkt': '0',
+ 'flowid': '1:1',
+ 'not_in_hw': True,
+ 'match': {'value': '0', 'mask': '0', 'offmask': '', 'off': 0},
+ },
+ tmp[2]['options'],
+ )
+
if __name__ == '__main__':
unittest.main(verbosity=2)