Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alexey Shapovalov
noc
Commits
be8f8804
Commit
be8f8804
authored
Jan 27, 2022
by
bee26
Browse files
Merge branch 'cisco_inventory' into 'master'
Fix Cisco.IOS.get_inventory script See merge request
noc/noc!6001
parents
2ad36d1e
ce249aa2
Changes
1
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Cisco/IOS/get_inventory.py
View file @
be8f8804
# ---------------------------------------------------------------------
# Cisco.IOS.get_inventory
# ---------------------------------------------------------------------
# Copyright (C) 2007-202
0
The NOC Project
# Copyright (C) 2007-202
1
The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
...
...
@@ -62,7 +62,8 @@ class Script(BaseScript):
)
rx_c4900m
=
re
.
compile
(
r
"^Cisco Systems, Inc. (?P<part_no>\S+) \d+ slot switch"
)
rx_slot_id
=
re
.
compile
(
r
"^.*(slot|[tr|b]ay|pem|supply|fan|module)(\s*:?)(?P<slot_id>[\d|\w]+).*"
,
re
.
IGNORECASE
r
"^.*(slot|[tr|b]ay|pem|supply|fan|module|disk|card)(\s*:?)(?P<slot_id>[\d|\w]+).*"
,
re
.
IGNORECASE
,
)
rx_psu1
=
re
.
compile
(
r
"(?:PS|Power Supply) (?P<number>\d+) "
)
rx_psu2
=
re
.
compile
(
r
"Power Supply (?P<number>\d+)$"
)
...
...
@@ -272,12 +273,18 @@ class Script(BaseScript):
# Cisco ISR series not have PID for motherboard
if
"1921"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO1921-MB"
elif
"2921"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO2921-MB"
elif
"2811"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO2811-MB"
elif
"2821"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO2821-MB"
elif
"2851"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO2851-MB"
elif
"2901"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO2901-MB"
elif
"2911"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO2911-MB"
elif
"2921"
in
name
:
return
"MOTHERBOARD"
,
None
,
"CISCO2921-MB"
pid
=
""
match
=
self
.
rx_slot_id
.
search
(
name
)
if
match
:
...
...
@@ -376,7 +383,7 @@ class Script(BaseScript):
elif
(
"SUP"
in
pid
or
"S2U"
in
pid
)
and
"supervisor"
in
descr
:
# Sup2
return
"SUP"
,
self
.
slot_id
,
pid
elif
name
.
startswith
(
"module "
):
elif
name
.
startswith
(
"module
"
)
or
name
.
startswith
(
"SPA subslot
"
):
# Linecards or supervisors
if
pid
.
startswith
(
"RSP"
)
or
(
(
pid
.
startswith
(
"WS-SUP"
)
or
pid
.
startswith
(
"VS-S"
))
...
...
@@ -406,7 +413,14 @@ class Script(BaseScript):
# 2-port 100BASE-TX Fast Ethernet port adapter
pid
=
"CISCO7100-MB"
if
pid
in
(
"ASR1001"
,
"ASR1001-X"
):
return
"RP"
,
self
.
slot_id
,
pid
+
"-RP"
if
"Route Processor"
in
descr
:
return
"RP"
,
self
.
slot_id
,
pid
+
"-RP"
elif
"SPA Interface Processor"
in
descr
:
return
"SIP"
,
self
.
slot_id
,
pid
+
"-SIP"
elif
"Shared Port Adapter"
in
descr
:
return
"SPA"
,
self
.
slot_id
,
pid
+
"-SPA"
elif
"Embedded Services Processor"
in
descr
:
return
"ESP"
,
self
.
slot_id
,
pid
+
"-ESP"
return
"MOTHERBOARD"
,
self
.
slot_id
,
pid
elif
(
pid
.
startswith
(
"WS-X64"
)
...
...
@@ -512,10 +526,16 @@ class Script(BaseScript):
return
"VTT"
,
self
.
slot_id
,
pid
elif
"Compact Flash Disk"
in
descr
:
# Compact Flash
return
"Flash | CF"
,
name
,
pid
match
=
self
.
rx_slot_id
.
search
(
name
)
if
match
:
self
.
slot_id
=
int
(
match
.
group
(
"slot_id"
))
return
"Flash | CF"
,
self
.
slot_id
,
pid
elif
"PCMCIA Flash Disk"
in
descr
:
# PCMCIA Flash
return
"Flash | PCMCIA"
,
name
,
pid
match
=
self
.
rx_slot_id
.
search
(
name
)
if
match
:
self
.
slot_id
=
int
(
match
.
group
(
"slot_id"
))
return
"Flash | PCMCIA"
,
self
.
slot_id
,
pid
elif
name
.
startswith
(
"StackPort"
):
match
=
self
.
rx_stack1
.
search
(
name
)
if
match
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment