summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-02-04 18:11:16 +0100
committerChristian Poessinger <christian@poessinger.com>2020-02-04 18:11:16 +0100
commit70f0d321325f3a7d9966c11c39dfb2ef6ecea97e (patch)
treeadb04062c1c4dbbc67bf52ccc095798f56cda3a1 /scripts
parent594ca265b327ffcacfef57f30bd24939be97bc90 (diff)
downloadvyos-1x-70f0d321325f3a7d9966c11c39dfb2ef6ecea97e.tar.gz
vyos-1x-70f0d321325f3a7d9966c11c39dfb2ef6ecea97e.zip
snmp: add testcase for SNMPv3
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cli/test_service_snmp.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/cli/test_service_snmp.py b/scripts/cli/test_service_snmp.py
index cca39f7c6..04db860f6 100755
--- a/scripts/cli/test_service_snmp.py
+++ b/scripts/cli/test_service_snmp.py
@@ -82,6 +82,29 @@ class TestSystemNameServer(unittest.TestCase):
# Check for running process
self.assertTrue("snmpd" in (p.name() for p in process_iter()))
+ def test_snmpv3(self):
+ """ Check if SNMPv3 can be configured and service runs"""
+
+ self.session.set(base_path + ['v3', 'engineid', '0xaffedeadbeef'])
+ self.session.set(base_path + ['v3', 'group', 'default', 'mode', 'ro'])
+ # check validate() - a view must be created before this can be comitted
+ with self.assertRaises(vyos.configsession.ConfigSessionError):
+ self.session.commit()
+
+ self.session.set(base_path + ['v3', 'view', 'default', 'oid', '1'])
+ self.session.set(base_path + ['v3', 'group', 'default', 'view', 'default'])
+ self.session.commit()
+
+ # create user
+ for authpriv in ['auth', 'privacy']:
+ self.session.set(base_path + ['v3', 'user', 'vyos', authpriv, 'plaintext-key', 'vyos1234'])
+ self.session.set(base_path + ['v3', 'user', 'vyos', 'group', 'default'])
+
+ # TODO: read in config file and check values
+
+ # Check for running process
+ self.assertTrue("snmpd" in (p.name() for p in process_iter()))
+
if __name__ == '__main__':
unittest.main()