Skip to content
Snippets Groups Projects
Commit fbba09b7 authored by Robert Latta's avatar Robert Latta
Browse files

updated snmp info to include oids as a list. RE DBOARD3-1152

parent 80e13d4a
No related branches found
No related tags found
No related merge requests found
...@@ -225,7 +225,7 @@ def _default_snmp_interface_info(interface_, name_field, communities): ...@@ -225,7 +225,7 @@ def _default_snmp_interface_info(interface_, name_field, communities):
return { return {
'name': interface_[name_field], 'name': interface_[name_field],
'index': index, 'index': index,
'oid': f'{snmp.IF_OPER_STATUS}.{index}', 'oids': [f'{snmp.IF_ADMIN_STATUS}.{index}'],
'communities': communities 'communities': communities
} }
...@@ -256,7 +256,9 @@ def get_services_snmp_info(service_elements, interface_state_elements, communiti ...@@ -256,7 +256,9 @@ def get_services_snmp_info(service_elements, interface_state_elements, communiti
yield { yield {
'name': interface_info['interface-name'], 'name': interface_info['interface-name'],
'index': interface_info['if-index'], 'index': interface_info['if-index'],
'oid': f'{snmp.NOKIA_IES_IF_OPER_STATUS}.{interface_info["service-id"]}.{interface_info["if-index"]}', 'oids': [
f'{snmp.NOKIA_IES_IF_OPER_STATUS}.{interface_info["service-id"]}.{interface_info["if-index"]}'
],
'communities': communities 'communities': communities
} }
...@@ -294,7 +296,9 @@ def get_epipe_services_snmp_info(netconf_doc, communities): ...@@ -294,7 +296,9 @@ def get_epipe_services_snmp_info(netconf_doc, communities):
yield { yield {
'name': service['sap-id'], 'name': service['sap-id'],
'index': -1, 'index': -1,
'oid': f'{snmp.NOKIA_SVC_OPER_STATUS}.{service["service-id"]}', 'oids': [
f'{snmp.NOKIA_SVC_OPER_STATUS}.{service["service-id"]}'
],
'communities': communities 'communities': communities
} }
......
...@@ -11,6 +11,9 @@ from pysnmp.error import PySnmpError ...@@ -11,6 +11,9 @@ from pysnmp.error import PySnmpError
# from pysnmp.smi import view, rfc1902 # from pysnmp.smi import view, rfc1902
# IF-MIB::ifAdminStatus
IF_ADMIN_STATUS = '1.3.6.1.2.1.2.2.1.7'
# IF-MIB::ifOperStatus # IF-MIB::ifOperStatus
IF_OPER_STATUS = '1.3.6.1.2.1.2.2.1.8' IF_OPER_STATUS = '1.3.6.1.2.1.2.2.1.8'
...@@ -21,9 +24,15 @@ JNX_BGP_M2_PEER_STATE = '1.3.6.1.4.1.2636.5.1.1.2.1.1.1.2' ...@@ -21,9 +24,15 @@ JNX_BGP_M2_PEER_STATE = '1.3.6.1.4.1.2636.5.1.1.2.1.1.1.2'
# tBgpPeerNgOperLastState # tBgpPeerNgOperLastState
NOKIA_BGP_PEER_STATE = '1.3.6.1.4.1.6527.3.1.2.14.4.8.1.11' NOKIA_BGP_PEER_STATE = '1.3.6.1.4.1.6527.3.1.2.14.4.8.1.11'
# TIMETRA-SERV-MIB::svcAdminStatus
NOKIA_SVC_ADMIN_STATUS = '1.3.6.1.4.1.6527.3.1.2.4.2.2.1.8'
# TIMETRA-SERV-MIB::svcOperStatus # TIMETRA-SERV-MIB::svcOperStatus
NOKIA_SVC_OPER_STATUS = '1.3.6.1.4.1.6527.3.1.2.4.2.2.1.9' NOKIA_SVC_OPER_STATUS = '1.3.6.1.4.1.6527.3.1.2.4.2.2.1.9'
# TIMETRA-SERV-MIB::iesIfAdminStatus
NOKIA_IES_IF_ADMIN_STATUS = '1.3.6.1.4.1.6527.3.1.2.4.2.5.1.5'
# TIMETRA-SERV-MIB::iesIfOperStatus # TIMETRA-SERV-MIB::iesIfOperStatus
NOKIA_IES_IF_OPER_STATUS = '1.3.6.1.4.1.6527.3.1.2.4.2.5.1.6' NOKIA_IES_IF_OPER_STATUS = '1.3.6.1.4.1.6527.3.1.2.4.2.5.1.6'
...@@ -159,10 +168,14 @@ def _get_router_snmp_indexes(hostname, community): ...@@ -159,10 +168,14 @@ def _get_router_snmp_indexes(hostname, community):
for ifc in walk(hostname, community, RFC1213_MIB_IFDESC): for ifc in walk(hostname, community, RFC1213_MIB_IFDESC):
m = re.match(r'.*\.(\d+)$', ifc['oid']) m = re.match(r'.*\.(\d+)$', ifc['oid'])
assert m, f'sanity failure parsing oid: {ifc["oid"]}' assert m, f'sanity failure parsing oid: {ifc["oid"]}'
index = int(m.group(1))
yield { yield {
'name': ifc['value'], 'name': ifc['value'],
'index': int(m.group(1)), 'index': index,
'oid': ifc['oid'], 'oids': [
f'{IF_ADMIN_STATUS}.{index}',
ifc['oid'],
],
'community': community 'community': community
} }
......
...@@ -68,7 +68,7 @@ def test_snmp_interfaces_juniper(mocker, netconf_doc): ...@@ -68,7 +68,7 @@ def test_snmp_interfaces_juniper(mocker, netconf_doc):
"properties": { "properties": {
"name": {"type": "string"}, "name": {"type": "string"},
"index": {"type": "integer"}, "index": {"type": "integer"},
"oid": {"type": "string"}, "oids": {"type": "array", "items": {"type": "string"}},
"community": {"type": "string"} "community": {"type": "string"}
}, },
"required": ["name", "index", "community"], "required": ["name", "index", "community"],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment