diff --git a/sa/profiles/Orion/NOS/get_interfaces.py b/sa/profiles/Orion/NOS/get_interfaces.py index 598526864473e0e92a1905c728e4539215821cc9..4cdcefa9fa84e90d25ff4b529137ae33216a8a45 100644 --- a/sa/profiles/Orion/NOS/get_interfaces.py +++ b/sa/profiles/Orion/NOS/get_interfaces.py @@ -5,12 +5,14 @@ # Copyright (C) 2007-2018 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# Python modules +import re + +# NOC Modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces from noc.core.ip import IPv4 -import re class Script(BaseScript): @@ -53,11 +55,11 @@ class Script(BaseScript): def get_stp(self): # Need more examples return [] - try: - v = self.cli("show spanning-tree") - return self.rx_enabled.findall(v) - except self.CLISyntaxError: - return [] + # try: + # v = self.cli("show spanning-tree") + # return self.rx_enabled.findall(v) + # except self.CLISyntaxError: + # return [] def get_ctp(self): try: @@ -85,7 +87,6 @@ class Script(BaseScript): return self.rx_enabled.findall(v) except self.CLISyntaxError: return [] - return [] def execute_cli(self): interfaces = [] diff --git a/sa/profiles/Orion/NOS/profile.py b/sa/profiles/Orion/NOS/profile.py index 907129a5acb08ffb28b1965d92e565b1a684a85d..acd3eaa83539d281170971ccf43e8b2acf9bb380 100644 --- a/sa/profiles/Orion/NOS/profile.py +++ b/sa/profiles/Orion/NOS/profile.py @@ -29,6 +29,8 @@ class Profile(BaseProfile): r"tacacs(-server | accounting-server )encrypt-key \S+\n", ] + rx_interface_name = re.compile(r"port\s*(?P\d+)") + rx_ver = re.compile( r"^Product name\s*:\s*(?P.+)\s*\n" r"^NOS\s+Version:? NOS_(?P\d+\.\d+\.\d+).+\n" @@ -63,3 +65,8 @@ class Profile(BaseProfile): if not match: match = self.rx_ver2.search(c) return match.groupdict() + + def convert_interface_name(self, s): + if self.rx_interface_name.match(s): + return self.rx_interface_name.match(s).group("re_port") + return s