diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-04 18:11:16 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-04 18:11:16 +0100 |
commit | 70f0d321325f3a7d9966c11c39dfb2ef6ecea97e (patch) | |
tree | adb04062c1c4dbbc67bf52ccc095798f56cda3a1 /scripts/cli | |
parent | 594ca265b327ffcacfef57f30bd24939be97bc90 (diff) | |
download | vyos-1x-70f0d321325f3a7d9966c11c39dfb2ef6ecea97e.tar.gz vyos-1x-70f0d321325f3a7d9966c11c39dfb2ef6ecea97e.zip |
snmp: add testcase for SNMPv3
Diffstat (limited to 'scripts/cli')
-rwxr-xr-x | scripts/cli/test_service_snmp.py | 23 |
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() |