diff options
author | Roman Khramshin <HollyGurza@users.noreply.github.com> | 2024-11-21 13:41:10 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-21 09:41:10 +0200 |
commit | b51cf400b42d7b2d05237169a813d1e952213558 (patch) | |
tree | 12fe95038495b36d7d008400ae0b039430b051e4 /smoketest/scripts | |
parent | 1a291b44716ae268916a95971016fb0cf9584ba0 (diff) | |
download | vyos-1x-b51cf400b42d7b2d05237169a813d1e952213558.tar.gz vyos-1x-b51cf400b42d7b2d05237169a813d1e952213558.zip |
T6796: QoS: match filter by interface(iif) (#4188)
Diffstat (limited to 'smoketest/scripts')
-rwxr-xr-x | smoketest/scripts/cli/test_qos.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/smoketest/scripts/cli/test_qos.py b/smoketest/scripts/cli/test_qos.py index 9c3e848cd..53b2c18b5 100755 --- a/smoketest/scripts/cli/test_qos.py +++ b/smoketest/scripts/cli/test_qos.py @@ -21,7 +21,7 @@ from json import loads from base_vyostest_shim import VyOSUnitTestSHIM from vyos.configsession import ConfigSessionError -from vyos.ifconfig import Section +from vyos.ifconfig import Section, Interface from vyos.qos import CAKE from vyos.utils.process import cmd @@ -1006,6 +1006,30 @@ class TestQoS(VyOSUnitTestSHIM.TestCase): # TC store rates as a 32-bit unsigned integer in bps (Bytes per second) self.assertEqual(int(bandwidth * 125), tmp['options']['rate']) + def test_23_policy_limiter_iif_filter(self): + policy_name = 'smoke_test' + base_policy_path = ['qos', 'policy', 'limiter', policy_name] + + self.cli_set(['qos', 'interface', self._interfaces[0], 'ingress', policy_name]) + self.cli_set(base_policy_path + ['class', '100', 'bandwidth', '20gbit']) + self.cli_set(base_policy_path + ['class', '100', 'burst', '3760k']) + self.cli_set(base_policy_path + ['class', '100', 'match', 'test', 'interface', self._interfaces[0]]) + self.cli_set(base_policy_path + ['class', '100', 'priority', '20']) + self.cli_set(base_policy_path + ['default', 'bandwidth', '1gbit']) + self.cli_set(base_policy_path + ['default', 'burst', '125000000b']) + self.cli_commit() + + iif = Interface(self._interfaces[0]).get_ifindex() + tc_filters = cmd(f'tc filter show dev {self._interfaces[0]} ingress') + + # class 100 + self.assertIn('filter parent ffff: protocol all pref 20 basic chain 0', tc_filters) + self.assertIn(f'meta(rt_iif eq {iif})', tc_filters) + self.assertIn('action order 1: police 0x1 rate 20Gbit burst 3847500b mtu 2Kb action drop overhead 0b', tc_filters) + # default + self.assertIn('filter parent ffff: protocol all pref 255 basic chain 0', tc_filters) + self.assertIn('action order 1: police 0x2 rate 1Gbit burst 125000000b mtu 2Kb action drop overhead 0b', tc_filters) + if __name__ == '__main__': unittest.main(verbosity=2) |