Skip to content
Snippets Groups Projects
Commit 5400f1ed authored by Auke Klazema's avatar Auke Klazema Committed by Taya Snijder
Browse files

changed setu_annotation

parent 6eeda113
No related branches found
No related tags found
1 merge request!288Resolve L2SS-446 "Extend snmp client to support mib files"
...@@ -60,18 +60,16 @@ class SNMP_client(CommClient): ...@@ -60,18 +60,16 @@ class SNMP_client(CommClient):
index (optional) the index if the value thats being read from is a table. index (optional) the index if the value thats being read from is a table.
""" """
# check if the 'mib' and 'name' keys are present try:
if 'mib' in annotation and 'name' in annotation:
mib = annotation["mib"] mib = annotation["mib"]
name = annotation["name"] name = annotation["name"]
# SNMP has tables that require an index number to access them. regular non-table variable have an index of 0 # SNMP has tables that require an index number to access them. regular non-table variable have an index of 0
idx = annotation.get('index', 0) idx = annotation.get('index', 0)
else: return mib, name, idx
raise ValueError(f"SNMP attribute annotation requires a dict argument with both a 'name' and 'mib' key. Instead got: {annotation}") except KeyError:
raise ValueError(f"SNMP attribute annotation requires a dict argument with both a 'name' and 'mib' key. Instead got: {annotation}")
return mib, name, idx
def setup_value_conversion(self, attribute): def setup_value_conversion(self, attribute):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment