Commit 2c218c41 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'patch-avs-iskratel-snmp' into 'master'

Iskratel.MSAN. Add SNMP proto to profile.

See merge request noc/noc!6043
parents a840e1ac e49c3644
......@@ -11,7 +11,8 @@ import re
from collections import defaultdict
# NOC modules
from noc.core.script.base import BaseScript
# from noc.core.script.base import BaseScript
from noc.sa.profiles.Generic.get_interfaces import Script as BaseScript
from noc.sa.interfaces.igetinterfaces import IGetInterfaces
from noc.core.ip import IPv4
......
......@@ -15,7 +15,7 @@ class Script(BaseScript):
name = "Iskratel.MSAN.get_inventory"
interface = IGetInventory
def execute(self):
def execute_cli(self, **kwargs):
v = self.profile.get_hardware(self)
r = {"vendor": "ISKRATEL", "part_no": v["part_no"], "serial": v["serial"]}
if v["number"]:
......
......@@ -31,7 +31,7 @@ class Script(BaseScript):
re.MULTILINE | re.DOTALL,
)
def execute(self):
def execute_cli(self, **kwargs):
r = []
try:
v = self.cli("show lldp remote-device all")
......
......@@ -32,7 +32,7 @@ class Script(BaseScript):
r"^(?P<mac>\S+)\s+(?P<interface>\d+/\d+)\s+(?P<type>\S+)\s*\n", re.MULTILINE
)
def execute(self, interface=None, vlan=None, mac=None):
def execute_cli(self, interface=None, vlan=None, mac=None):
cmd = "show mac-addr-table"
if interface is not None:
cmd += " interface %s" % interface
......
......@@ -24,6 +24,15 @@ class Script(BaseScript):
rx_ver = re.compile(r"(Steer|Appl\.|Package)\s*Version\.+\s*(?P<version>\S+)")
def execute_snmp(self, **kwargs):
version = self.snmp.get("1.3.6.1.4.1.1332.1.1.5.1.3.1.0")
return {
"vendor": "Iskratel",
"platform": "Iskratel SGR",
"version": version,
# "attributes": {"Serial Number": serial},
}
def execute_cli(self):
v = self.cli("show hardware", cached=True)
match = self.rx_platform.search(v)
......
......@@ -80,3 +80,13 @@ class Profile(BaseProfile):
else:
match = self.rx_hw2.search(c)
return match.groupdict()
rx_iface = re.compile(r"[01]/\d+")
@classmethod
def get_interface_type(cls, name):
if cls.rx_iface.match(name):
return "physical"
if name == "2/1":
return "aggregated"
return "other"
Markdown is supported
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