summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_system_flow-accounting.py
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2021-07-28 12:03:21 +0200
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2021-12-06 21:20:49 +0100
commitfdeba8da3e99256fe449e331d0b833a941315226 (patch)
treec6181ec7b84796a52a72d61e7d89ad6974f6f5f6 /smoketest/scripts/cli/test_system_flow-accounting.py
parent025f0609cea8591e93b8cb4a7d0256e43e23323b (diff)
downloadvyos-1x-fdeba8da3e99256fe449e331d0b833a941315226.tar.gz
vyos-1x-fdeba8da3e99256fe449e331d0b833a941315226.zip
firewall: T2199: Migrate firewall to XML/Python
Diffstat (limited to 'smoketest/scripts/cli/test_system_flow-accounting.py')
-rwxr-xr-xsmoketest/scripts/cli/test_system_flow-accounting.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/smoketest/scripts/cli/test_system_flow-accounting.py b/smoketest/scripts/cli/test_system_flow-accounting.py
index a2b5b1481..dfbfba94e 100755
--- a/smoketest/scripts/cli/test_system_flow-accounting.py
+++ b/smoketest/scripts/cli/test_system_flow-accounting.py
@@ -59,9 +59,20 @@ class TestSystemFlowAccounting(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
# verify configuration
- tmp = cmd('sudo iptables-save -t raw')
+ nftables_output = cmd('sudo nft list chain raw VYOS_CT_PREROUTING_HOOK').splitlines()
for interface in Section.interfaces('ethernet'):
- self.assertIn(f'-A VYATTA_CT_PREROUTING_HOOK -i {interface} -m comment --comment FLOW_ACCOUNTING_RULE -j NFLOG --nflog-group 2 --nflog-size 128 --nflog-threshold 100', tmp)
+ rule_found = False
+ ifname_search = f'iifname "{interface}"'
+
+ for nftables_line in nftables_output:
+ if 'FLOW_ACCOUNTING_RULE' in nftables_line and ifname_search in nftables_line:
+ self.assertIn('group 2', nftables_line)
+ self.assertIn('snaplen 128', nftables_line)
+ self.assertIn('queue-threshold 100', nftables_line)
+ rule_found = True
+ break
+
+ self.assertTrue(rule_found)
uacctd = read_file(uacctd_conf)
# circular queue size - buffer_size