Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
dashboardv3
inventory-provider
Commits
fbba09b7
Commit
fbba09b7
authored
1 month ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inventory_provider/nokia.py
+7
-3
7 additions, 3 deletions
inventory_provider/nokia.py
inventory_provider/snmp.py
+15
-2
15 additions, 2 deletions
inventory_provider/snmp.py
test/per_router/test_snmp_handling.py
+1
-1
1 addition, 1 deletion
test/per_router/test_snmp_handling.py
with
23 additions
and
6 deletions
inventory_provider/nokia.py
+
7
−
3
View file @
fbba09b7
...
@@ -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
}
'
,
'
oid
s
'
:
[
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
}
}
...
...
This diff is collapsed.
Click to expand it.
inventory_provider/snmp.py
+
15
−
2
View file @
fbba09b7
...
@@ -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
}
}
...
...
This diff is collapsed.
Click to expand it.
test/per_router/test_snmp_handling.py
+
1
−
1
View file @
fbba09b7
...
@@ -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
"
},
"
oid
s
"
:
{
"
type
"
:
"
array
"
,
"
items
"
:
{
"
type
"
:
"
string
"
}
}
,
"
community
"
:
{
"
type
"
:
"
string
"
}
"
community
"
:
{
"
type
"
:
"
string
"
}
},
},
"
required
"
:
[
"
name
"
,
"
index
"
,
"
community
"
],
"
required
"
:
[
"
name
"
,
"
index
"
,
"
community
"
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment