Commit 574bf9e5 authored by MaksimSmile13's avatar MaksimSmile13
Browse files

Fix profile Ericsson.SEOS

parent 5cba9b93
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Ericsson.SEOS.get_inventory
# ---------------------------------------------------------------------
# Copyright (C) 2007-2013 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules
import re
# NOC modules
from core.script.base import BaseScript
from sa.interfaces.igetinventory import IGetInventory
class Script(BaseScript):
name = "Ericsson.SEOS.get_inventory"
interface = IGetInventory
rx_trans = re.compile(
r"Port\s*:\s*(\S+)\s*XFP\s*\S+\s*Media\s*"
r"Type\s*:\s*([A-Za-z0-9 \/]+)\s*"
r"Redback\s*Approved\s*:\s*(YES|NO)\s*"
r"Diagnostic\s*Monitoring\s*:\s*\S+\s*"
r"CLEI\s*code\s*:\s*\S*\s*"
r"Serial\s*Number\s*:\s*(\S+)\s*\S+\s*:\s*(\S*)",
re.DOTALL | re.IGNORECASE | re.MULTILINE)
def execute_cli(self):
objects = []
v = self.cli("show hardware")
if not v:
raise NotImplementedError()
media = self.cli("show port trans")
for l in v.splitlines():
if "backplane" in l:
objects += [{
"builtin": False,
"description": "Chassis backplane",
"number": 0,
"part_no": "SE600",
"serial": l.split()[2].strip(),
"vendor": "Ericsson",
"type": "CHASSIS"
}]
elif "fan tray" in l:
objects += [{
"builtin": False,
"description": "Fan Tray",
"number": 1,
"part_no": "SE600-FAN",
"serial": l.split()[3].strip(),
"vendor": "Ericsson",
"type": "FAN"
}]
elif "alarm card" in l:
objects += [{
"builtin": False,
"description": "Alarm Card",
"number": 0,
"part_no": "SE600-ALARM",
"serial": l.split()[3].strip(),
"vendor": "Ericsson",
"type": "ALRM"
}]
elif "-port" in l:
objects += [{
"builtin": False,
"description": l.split()[1].strip(),
"number": l.split()[0].strip(),
"part_no": l.split()[1].strip(),
"serial": l.split()[2].strip(),
"vendor": "Ericsson",
"type": "CARD"
}]
for match in self.rx_trans.findall(media):
if l.split()[0].strip() == match[0].split("/")[0]:
objects += [{
"builtin": False,
"description": match[1].strip() + " " + match[4].strip(),
"number": match[0][2:],
"part_no": match[1].strip(),
"serial": match[3],
"vendor": "NoName",
"type": "XCVR"
}]
elif "xcrp" in l:
objects += [{
"builtin": False,
"description": l.split()[1].strip(),
"number": l.split()[0].strip(),
"part_no": l.split()[1].strip(),
"serial": l.split()[2].strip(),
"vendor": "Ericsson",
"type": "MGMT"
}]
return objects
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Ericsson.MINI_LINK.get_mac_address_table
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NOC modules
from noc.core.script.base import BaseScript
from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable
from noc.lib.text import parse_table
from noc.lib.validators import is_int
class Script(BaseScript):
name = "Ericsson.SEOS.get_mac_address_table"
interface = IGetMACAddressTable
def execute(self, interface=None, vlan=None, mac=None):
cmd = self.cli("show mac-address-table")
# if mac is not None:
# cmd += " address %s" % mac
if interface is not None:
cmd += " port %s" % interface
if vlan is not None:
cmd += " vlan %s" % vlan
r = []
t = parse_table(cmd, footer="^show mac-address-table")
for i in t:
if is_int(i[0]):
r += [{
"vlan_id": i[0],
"mac": i[1],
"interfaces": [self.profile.convert_interface_name(i[4])],
"type": "D" if i[2] == "learned" else "S"
}]
return r
......@@ -20,7 +20,8 @@ class Script(BaseScript):
rx_ver = re.compile(r"^Active SBL\s+:\s+CXP:\s+(?P<version>\S+.*)\s+"
r"^Passive (?:NPU|SBL)\s+:\s+CXP:\s+[\S\s]+"
r"^Active BNS\s+:\s+CXCR:\s+(?P<sw_backup>\S+.*)$",
r"^Active BNS\s+:\s+CXCR:\s+(?P<sw_backup>\S+.*)\s+"
r"^Subrack\s+:\s+(?P<platform>\S+.*)\s+\-",
re.MULTILINE)
def execute_snmp(self):
......@@ -40,12 +41,14 @@ class Script(BaseScript):
def execute_cli(self):
ver = self.cli("show version", cached=True)
for match in self.rx_ver.finditer(ver):
print match
version = match.group("version")
sw_backup = match.group("sw_backup")
platform = match.group("platform")
return {
"vendor": "Ericsson",
"platform": "Mini-Link",
"version": version,
"platform": platform.replace("Traffic Node", "TN").replace("Compact Node", "CN"),
"version": version.strip(),
"attributes": {
"sw_backup": sw_backup
}
......
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