diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-04 18:10:48 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-04 18:10:48 +0100 |
commit | 594ca265b327ffcacfef57f30bd24939be97bc90 (patch) | |
tree | b872e175b703ada3c4f5d1f4fd12557f2b27d0a1 | |
parent | a8d94f0a16f3473c10ef0922ee2d6d6e9659c87a (diff) | |
download | vyos-1x-594ca265b327ffcacfef57f30bd24939be97bc90.tar.gz vyos-1x-594ca265b327ffcacfef57f30bd24939be97bc90.zip |
snmp: ensure snmpd process is running
-rwxr-xr-x | scripts/cli/test_service_snmp.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/cli/test_service_snmp.py b/scripts/cli/test_service_snmp.py index d8521b770..cca39f7c6 100755 --- a/scripts/cli/test_service_snmp.py +++ b/scripts/cli/test_service_snmp.py @@ -18,10 +18,12 @@ import os import re import unittest +from vyos.validate import is_ipv4 +from psutil import process_iter + import vyos.config import vyos.configsession import vyos.util as util -from vyos.validate import is_ipv4 SNMPD_CONF = '/etc/snmp/snmpd.conf' @@ -42,8 +44,8 @@ class TestSystemNameServer(unittest.TestCase): self.session.delete(base_path) self.session.commit() - def test_snmpv2(self): - """ Check if SNMPv2 can be configured and service runs """ + def test_snmp(self): + """ Check if SNMP can be configured and service runs """ clients = ['192.0.2.1', '2001:db8::1'] networks = ['192.0.2.128/25', '2001:db8:babe::/48'] listen = ['127.0.0.1', '::1'] @@ -55,11 +57,12 @@ class TestSystemNameServer(unittest.TestCase): self.session.set(base_path + ['community', community, 'client', client]) for network in networks: self.session.set(base_path + ['community', community, 'network', network]) - for addr in listen: - self.session.set(base_path + ['listen-address', addr]) - self.session.set(base_path + ['contact', 'maintainers@vyos.io']) - self.session.set(base_path + ['location', 'qemu']) + for addr in listen: + self.session.set(base_path + ['listen-address', addr]) + + self.session.set(base_path + ['contact', 'maintainers@vyos.io']) + self.session.set(base_path + ['location', 'qemu']) self.session.commit() @@ -76,6 +79,9 @@ class TestSystemNameServer(unittest.TestCase): self.assertTrue(expected in config) + # Check for running process + self.assertTrue("snmpd" in (p.name() for p in process_iter())) + if __name__ == '__main__': unittest.main() |