Commit ddfbd1ef authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Huawei.MA5600T. Add get_lldp_neighbors script.

parent 7c92e7f9
Pipeline #23010 failed with stages
in 21 seconds
......@@ -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)
......
# ---------------------------------------------------------------------
# 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")
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment