diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-09-24 19:54:15 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-09-24 19:54:15 +0200 |
commit | 58ead7415a3fe8d786bdb6fd2a99d0a57770dbd7 (patch) | |
tree | eacbad8eb616ca4fc1945b6048e433204fccfc69 /smoketest/scripts/cli/test_service_snmp.py | |
parent | 4db00f1cd820f4fc462ce3537d692694224e02a4 (diff) | |
download | vyos-1x-58ead7415a3fe8d786bdb6fd2a99d0a57770dbd7.tar.gz vyos-1x-58ead7415a3fe8d786bdb6fd2a99d0a57770dbd7.zip |
smoketest: (re-)use process_named_running() from vyos.util
Diffstat (limited to 'smoketest/scripts/cli/test_service_snmp.py')
-rwxr-xr-x | smoketest/scripts/cli/test_service_snmp.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/smoketest/scripts/cli/test_service_snmp.py b/smoketest/scripts/cli/test_service_snmp.py index fb5f5393f..067a3c76b 100755 --- a/smoketest/scripts/cli/test_service_snmp.py +++ b/smoketest/scripts/cli/test_service_snmp.py @@ -19,12 +19,15 @@ import re import unittest from vyos.validate import is_ipv4 -from psutil import process_iter -from vyos.configsession import ConfigSession, ConfigSessionError +from vyos.configsession import ConfigSession +from vyos.configsession import ConfigSessionError from vyos.util import read_file +from vyos.util import process_named_running +PROCESS_NAME = 'snmpd' SNMPD_CONF = '/etc/snmp/snmpd.conf' + base_path = ['service', 'snmp'] def get_config_value(key): @@ -78,7 +81,7 @@ class TestSNMPService(unittest.TestCase): self.assertTrue(expected in config) # Check for running process - self.assertTrue("snmpd" in (p.name() for p in process_iter())) + self.assertTrue(process_named_running(PROCESS_NAME)) def test_snmpv3_sha(self): @@ -113,7 +116,7 @@ class TestSNMPService(unittest.TestCase): # TODO: read in config file and check values # Check for running process - self.assertTrue("snmpd" in (p.name() for p in process_iter())) + self.assertTrue(process_named_running(PROCESS_NAME)) def test_snmpv3_md5(self): """ Check if SNMPv3 can be configured with MD5 authentication and service runs""" @@ -147,8 +150,7 @@ class TestSNMPService(unittest.TestCase): # TODO: read in config file and check values # Check for running process - self.assertTrue("snmpd" in (p.name() for p in process_iter())) - + self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': unittest.main() |