diff options
| author | Karen Schoener <karen@voltanet.io> | 2021-01-21 11:35:11 -0500 |
|---|---|---|
| committer | Karen Schoener <karen@voltanet.io> | 2021-01-21 11:43:03 -0500 |
| commit | 6ea2bd40d8fee4aba48a2bfbb9ac1abe85bc6ffd (patch) | |
| tree | c91e4fc9adba5e75314f0595e3597c1c19252eef /tests/topotests/lib/snmptest.py | |
| parent | 52624d79452c3f6688f3e2a7f9f4aa667d178c7c (diff) | |
tests: update snmp test infastructure api test_oid_walk
Update test_oid_walk to either validate specific oids or
to validate all rows walked.
Signed-off-by: Karen Schoener <karen@voltanet.io>
Diffstat (limited to 'tests/topotests/lib/snmptest.py')
| -rw-r--r-- | tests/topotests/lib/snmptest.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/topotests/lib/snmptest.py b/tests/topotests/lib/snmptest.py index ba5835dcf7..910e901ade 100644 --- a/tests/topotests/lib/snmptest.py +++ b/tests/topotests/lib/snmptest.py @@ -80,11 +80,14 @@ class SnmpTester(object): def _parse_multiline(self, snmp_output): results = snmp_output.strip().split("\r\n") - out_dict = {} + out_dict = {} + out_list = [] for response in results: out_dict[self._get_snmp_oid(response)] = self._get_snmp_value(response) - return out_dict + out_list.append(self._get_snmp_value(response)) + + return out_dict, out_list def get(self, oid): cmd = "snmpget {0} {1}".format(self._snmp_config(), oid) @@ -114,7 +117,7 @@ class SnmpTester(object): return self.get_next(oid) == value def test_oid_walk(self, oid, values, oids=None): - results_dict = self.walk(oid) + results_dict, results_list = self.walk(oid) print("res {}".format(results_dict)) if oids is not None: index = 0 @@ -124,4 +127,4 @@ class SnmpTester(object): index += 1 return True - return results_dict.values() == values + return results_list == values |
