Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
noc
noc
Commits
a10da9b1
Commit
a10da9b1
authored
Oct 23, 2019
by
Dmitry Lukhtionov
Browse files
Add Zhone.Bitstorm.get_inventory script
parent
7efc057f
Pipeline
#17422
passed with stages
in 8 minutes and 13 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Zhone/Bitstorm/get_inventory.py
0 → 100644
View file @
a10da9b1
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Zhone.Bitstorm.get_inventory
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
import
re
# NOC modules
from
noc.core.script.base
import
BaseScript
from
noc.sa.interfaces.igetinventory
import
IGetInventory
class
Script
(
BaseScript
):
name
=
"Zhone.Bitstorm.get_inventory"
interface
=
IGetInventory
rx_card
=
re
.
compile
(
r
"^(?P<part_no>\S+ [Cc]ard)\s*\n"
r
"(^HW Rev\s+(?P<revision>\S+)\s*\n)?"
r
"(^PLD Rev\s+\S+\s*\n)?"
r
"(^Serial Number(?P<serial>\S+)\s*\n)?"
,
re
.
MULTILINE
,
)
PLATFORMS
=
{
"4214-A1-520"
:
"24p ReachDSL, T1 MLPPP, No Splitters"
,
"4214-A1-522"
:
"24p ReachDSL, E1 MLPPP, No Splitters"
,
"4214-A1-530"
:
"24p ReachDSL, T1 MLPPP, w/Internal Splitters"
,
"4214-A1-531"
:
"24p ReachDSL, E1 MLPPP, w/Internal 600ohm Splitters"
,
"4214-A1-532"
:
"24p ReachDSL, E1 MLPPP, w/Internal Splitters"
,
"4219-A2-520"
:
"24p ReachDSL, GigE Uplink, No Splitters"
,
"4219-A2-530"
:
"24p ReachDSL, GigE Uplink, w/Internal Splitters"
,
"4219-A2-531"
:
"24p ReachDSL, GigE Uplink, w/Internal 600 ohm Splitters"
,
"4224-A1-520"
:
"24p ADSL2+, T1 MLPPP Uplink, No Splitters"
,
"4224-A1-522"
:
"24p ADSL2+, E1 MLPPP Uplink, No Splitters"
,
"4224-A1-530"
:
"24p ADSL2+, T1 MLPPP Uplink, w/Internal Splitters"
,
"4224-A1-531"
:
"24p ADSL2+, E1 MLPPP Uplink, w/Internal 600ohm Splitters"
,
"4224-A1-532"
:
"24p ADSL2+, E1 MLPPP Uplink, w/Internal Splitters"
,
"4229-A3-520"
:
"24p ADSL2+, GigE Uplink, No Splitters"
,
"4229-A3-530"
:
"24p ADSL2+, GigE Uplink, w/Internal Splitters"
,
"4229-A3-531"
:
"24p ADSL2+, GigE Uplink, w/Internal 600 ohm Splitters"
,
"4234-A1-522"
:
"24p ADSL2+, E1 MLPPP Uplink, No Splitters"
,
"4234-A1-532"
:
"24p ADSL2+, E1 MLPPP Uplink, w/Internal ISDN Splitter"
,
"4239-A3-520"
:
"24p ADSL2+ Annex B, GigE Uplink, No Splitters"
,
"4239-A3-532"
:
"24p ADSL2+ Annex B, GigE Uplink, w/Internal ISDN Splitters"
,
}
def
execute_cli
(
self
):
v
=
self
.
scripts
.
get_version
()
r
=
{
"type"
:
"CHASSIS"
,
"vendor"
:
"ZHONE"
,
"part_no"
:
[
v
[
"platform"
]]}
if
"attributes"
in
v
and
"Serial Number"
in
v
[
"attributes"
]:
r
[
"serial"
]
=
v
[
"attributes"
][
"Serial Number"
]
if
self
.
PLATFORMS
.
get
(
v
[
"platform"
]):
r
[
"description"
]
=
self
.
PLATFORMS
.
get
(
v
[
"platform"
])
res
=
[
r
]
v
=
self
.
cli
(
"show system information"
,
cached
=
True
)
for
match
in
self
.
rx_card
.
finditer
(
v
):
r
=
{
"type"
:
"CARD"
,
"vendor"
:
"ZHONE"
,
"part_no"
:
[
match
.
group
(
"part_no"
)]}
if
match
.
group
(
"revision"
):
r
[
"revision"
]
=
match
.
group
(
"revision"
)
if
match
.
group
(
"serial"
):
r
[
"serial"
]
=
match
.
group
(
"serial"
)
res
+=
[
r
]
return
res
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment