summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_service_snmp.py
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2024-03-07 15:45:37 +0200
committerNataliia Solomko <natalirs1985@gmail.com>2024-03-07 15:45:37 +0200
commit77a25e95da48549f2791b677f4ba187e547b1c6a (patch)
treebe4b9eda22f0029186292edeadf5f55818254242 /smoketest/scripts/cli/test_service_snmp.py
parent38fdc27ee2b3253053b2794e3e7ec5d8e0d5aa02 (diff)
downloadvyos-1x-77a25e95da48549f2791b677f4ba187e547b1c6a.tar.gz
vyos-1x-77a25e95da48549f2791b677f4ba187e547b1c6a.zip
snmp: T2998: SNMP v3 oid "exclude" option fix
Diffstat (limited to 'smoketest/scripts/cli/test_service_snmp.py')
-rwxr-xr-xsmoketest/scripts/cli/test_service_snmp.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_snmp.py b/smoketest/scripts/cli/test_service_snmp.py
index 52a72ec4f..b3daa90d0 100755
--- a/smoketest/scripts/cli/test_service_snmp.py
+++ b/smoketest/scripts/cli/test_service_snmp.py
@@ -229,5 +229,22 @@ class TestSNMPService(VyOSUnitTestSHIM.TestCase):
tmp = call(f'snmpwalk -v 3 -u {snmpv3_user} -a MD5 -A {snmpv3_auth_pw} -x DES -X {snmpv3_priv_pw} -l authPriv 127.0.0.1', stdout=DEVNULL)
self.assertEqual(tmp, 0)
+ def test_snmpv3_view_exclude(self):
+ snmpv3_view_oid_exclude = ['1.3.6.1.2.1.4.21', '1.3.6.1.2.1.4.24']
+
+ self.cli_set(base_path + ['v3', 'group', snmpv3_group, 'view', snmpv3_view])
+ self.cli_set(base_path + ['v3', 'view', snmpv3_view, 'oid', snmpv3_view_oid])
+
+ for excluded in snmpv3_view_oid_exclude:
+ self.cli_set(base_path + ['v3', 'view', snmpv3_view, 'oid', snmpv3_view_oid, 'exclude', excluded])
+
+ self.cli_commit()
+
+ tmp = read_file(SNMPD_CONF)
+ # views
+ self.assertIn(f'view {snmpv3_view} included .{snmpv3_view_oid}', tmp)
+ for excluded in snmpv3_view_oid_exclude:
+ self.assertIn(f'view {snmpv3_view} excluded .{excluded}', tmp)
+
if __name__ == '__main__':
unittest.main(verbosity=2)