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
ddfbd1ef
Commit
ddfbd1ef
authored
May 14, 2020
by
Andrey Vertiprahov
Browse files
Huawei.MA5600T. Add get_lldp_neighbors script.
parent
7c92e7f9
Pipeline
#23010
failed with stages
in 21 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
sa/profiles/Huawei/MA5600T/get_capabilities.py
View file @
ddfbd1ef
...
...
@@ -10,7 +10,7 @@ import re
# NOC modules
from
noc.sa.profiles.Generic.get_capabilities
import
Script
as
BaseScript
from
noc.sa.profiles.Generic.get_capabilities
import
false_on_cli_error
from
noc.sa.profiles.Generic.get_capabilities
import
false_on_cli_error
,
false_on_snmp_error
from
noc.core.mib
import
mib
...
...
@@ -21,6 +21,8 @@ class Script(BaseScript):
rx_lacp_id
=
re
.
compile
(
r
"^\s+(?P<id>\d+)\s+\d+"
,
re
.
MULTILINE
)
rx_lldp_enable
=
re
.
compile
(
r
"LLDP\sstatus\s+:\s*enabled"
)
@
false_on_cli_error
def
has_stp_cli
(
self
):
"""
...
...
@@ -38,12 +40,20 @@ class Script(BaseScript):
cmd
=
self
.
cli
(
"display lacp link-aggregation summary"
)
return
self
.
rx_lacp_id
.
search
(
cmd
)
is
not
None
@
false_on_cli_error
def
has_lacp_cli
(
self
):
"""
Check box has LACP enabled
"""
cmd
=
self
.
cli
(
"display lldp local"
)
return
self
.
rx_lldp_enable
.
search
(
cmd
)
is
not
None
@
false_on_cli_error
def
has_olt_cli
(
self
):
cmd
=
self
.
cli
(
"display ont global-config"
)
return
bool
(
cmd
)
@
false_on_
cli
_error
@
false_on_
snmp
_error
def
has_olt_snmp
(
self
):
cmd
=
self
.
snmp
.
get
(
mib
[
"HUAWEI-XPON-MIB::hwGponDeviceDbaAssignmentMode"
,
0
])
return
bool
(
cmd
)
...
...
sa/profiles/Huawei/MA5600T/get_lldp_neighbors.py
0 → 100644
View file @
ddfbd1ef
# ---------------------------------------------------------------------
# Huawei.MA5600T.get_lldp_neighbors
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
import
re
# NOC modules
from
noc.sa.profiles.Generic.get_lldp_neighbors
import
Script
as
BaseScript
from
noc.sa.interfaces.igetlldpneighbors
import
IGetLLDPNeighbors
class
Script
(
BaseScript
):
name
=
"Huawei.MA5600T.get_lldp_neighbors"
interface
=
IGetLLDPNeighbors
always_prefer
=
"S"
rx_iface_sep
=
re
.
compile
(
r
"^(\S+)\s+has\s+\d+\s+neighbors?"
,
re
.
MULTILINE
)
def
execute_cli
(
self
,
**
kwargs
):
v
=
self
.
cli
(
"display lldp neighbor"
)
sa/profiles/Huawei/MA5600T/profile.py
View file @
ddfbd1ef
...
...
@@ -24,6 +24,7 @@ class Profile(BaseProfile):
(
r
"\[to\]\:"
,
"
\n
"
),
(
r
"\{ \<cr\>\|vpi\<K\> \}\:"
,
"
\n
"
),
(
r
"\{ \<cr\>\|ont\<K\> \}\:"
,
"
\n
"
),
(
r
"\{ \<cr\>|port\<K\> \}:"
,
"
\n
"
),
(
r
"Are you sure to modify system time?"
,
"n
\n
"
),
(
r
"Are you sure to log out?"
,
"y
\n
"
),
(
r
"\{ <cr>\|configuration<K>\|data<K> \}"
,
"
\n
"
),
...
...
@@ -61,7 +62,8 @@ class Profile(BaseProfile):
matchers
=
{
"is_gpon_uplink"
:
{
"platform"
:
{
"$in"
:
[
"MA5626G"
]}},
"is_dslam"
:
{
"platform"
:
{
"$in"
:
[
"MA5600"
]}},
"is_ua5k"
:
{
"platform"
:
{
"$in"
:
[
"UA5000"
]}},
"is_ua5k"
:
{
"platform"
:
{
"$in"
:
[
"UA5000"
,
"UA5000IPMB"
,
"UA5000PVM"
]}},
"is_lldp_support"
:
{
"version"
:
{
"$gte"
:
"V800R018C10"
}},
}
rx_slots
=
re
.
compile
(
r
"^\s*\d+"
,
re
.
MULTILINE
)
...
...
Andrey Vertiprahov
@aversant
mentioned in commit
f3fdda3d
·
May 14, 2020
mentioned in commit
f3fdda3d
mentioned in commit f3fdda3d3390111ec669c1ad307ae8bdbab75ed1
Toggle commit list
Andrey Vertiprahov
@aversant
mentioned in merge request
!3597 (merged)
·
May 14, 2020
mentioned in merge request
!3597 (merged)
mentioned in merge request !3597
Toggle commit list
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