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
135
noc
Commits
73dade62
Commit
73dade62
authored
Mar 26, 2020
by
Andrey Vertiprahov
Browse files
Merge branch 'fix-avs-huawei' into 'master'
Huawei. Disable CLI metrics. See merge request
noc/noc!3337
parents
de03e15f
3d1de7cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Huawei/MA5600T/profile.py
View file @
73dade62
...
...
@@ -62,6 +62,7 @@ class Profile(BaseProfile):
matchers
=
{
"is_gpon_uplink"
:
{
"platform"
:
{
"$in"
:
[
"MA5626G"
]}},
"is_dslam"
:
{
"platform"
:
{
"$in"
:
[
"MA5600"
]}},
"is_ua5k"
:
{
"platform"
:
{
"$in"
:
[
"UA5000"
]}},
}
rx_slots
=
re
.
compile
(
r
"^\s*\d+"
,
re
.
MULTILINE
)
...
...
sa/profiles/Huawei/VRP/get_metrics.py
View file @
73dade62
...
...
@@ -9,11 +9,8 @@
# Python modules
from
__future__
import
absolute_import
# Third-party modules
import
six
# NOC modules
from
noc.sa.profiles.Generic.get_metrics
import
Script
as
GetMetricsScript
,
metrics
from
noc.sa.profiles.Generic.get_metrics
import
Script
as
GetMetricsScript
from
.oidrules.slot
import
SlotRule
from
.oidrules.sslot
import
SSlotRule
...
...
@@ -23,19 +20,19 @@ class Script(GetMetricsScript):
OID_RULES
=
[
SlotRule
,
SSlotRule
]
@
metrics
(
[
"Interface | Errors | CRC"
,
"Interface | Errors | Frame"
],
has_capability
=
"DB | Interfaces"
,
volatile
=
False
,
access
=
"C"
,
# CLI version
)
def
get_vrp_interface_metrics
(
self
,
metrics
):
v
=
self
.
cli
(
"display interface"
)
ifdata
=
self
.
profile
.
parse_ifaces
(
v
)
for
iface
,
data
in
six
.
iteritems
(
ifdata
):
iface
=
self
.
profile
.
convert_interface_name
(
iface
)
ipath
=
[
""
,
""
,
""
,
iface
]
if
"CRC"
in
data
:
self
.
set_metric
(
id
=
(
"Interface | Errors | CRC"
,
ipath
),
value
=
int
(
data
[
"CRC"
]))
if
"Frames"
in
data
:
self
.
set_metric
(
id
=
(
"Interface | Errors | Frame"
,
ipath
),
value
=
int
(
data
[
"Frames"
]))
#
@metrics(
#
["Interface | Errors | CRC", "Interface | Errors | Frame"],
#
has_capability="DB | Interfaces",
#
volatile=False,
#
access="C", # CLI version
#
)
#
def get_vrp_interface_metrics(self, metrics):
#
v = self.cli("display interface")
#
ifdata = self.profile.parse_ifaces(v)
#
for iface, data in six.iteritems(ifdata):
#
iface = self.profile.convert_interface_name(iface)
#
ipath = ["", "", "", iface]
#
if "CRC" in data:
#
self.set_metric(id=("Interface | Errors | CRC", ipath), value=int(data["CRC"]))
#
if "Frames" in data:
#
self.set_metric(id=("Interface | Errors | Frame", ipath), value=int(data["Frames"]))
Write
Preview
Supports
Markdown
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