Ошибка при discovery interfaces Orion Alpha-A26
./noc script --debug --pretty get_interfaces "dev.name"
Orion Alpha A26 Device, Compiled on Jul 08 16:32:20 2013
sysLocation I.Kazaka_32
CPU Mac f8:f0:82:10:41:af
Vlan MAC f8:f0:82:10:41:ae
SoftWare Version 7.0.3.1(R0073.0008)
BootRom Version 7.1.10
HardWare Version 1.0.1
CPLD Version N/A
Serial No.:ONSA2610D814002473
Copyright (C) 2012 Orion Networks International, Inc.
All rights reserved
Last reboot is cold reset.
Uptime is 0 weeks, 2 days, 17 hours, 7 minutes
2021-06-15 12:53:38,809 [script] [Orion.NOS.get_interfaces|10.13.1.76] [telnet] Closing stream
2021-06-15 12:53:38,809 [asyncio] Using selector: EpollSelector
2021-06-15 12:53:38,809 [script] [Orion.NOS.get_interfaces|10.13.1.76] [telnet] Send: b'exit'
2021-06-15 12:53:38,830 [noc.core.debug] UNHANDLED EXCEPTION (2021-06-15 12:53:38.818044)
PROCESS: ./commands/script.py
VERSION: 20.4.4
BRANCH: HEAD CHANGESET: 24fcd851
ERROR FINGERPRINT: 81eac772-1c61-516f-9518-15907ee24ec5
WORKING DIRECTORY: /opt/noc
EXCEPTION: <class 'AttributeError'> 'NoneType' object has no attribute 'groupdict'
START OF TRACEBACK
------------------------------------------------------------------------
File: sa/profiles/Orion/NOS/profile.py (Line: 66)
Function: get_version
59 )
60
61 def get_version(self, script):
62 c = script.cli("show version", cached=True)
63 match = self.rx_ver.search(c)
64 if not match:
65 match = self.rx_ver2.search(c)
66 ==> return match.groupdict()
67
68 def convert_interface_name(self, s):
69 if self.rx_interface_name.match(s):
70 return self.rx_interface_name.match(s).group("re_port")
71 return s
Variables:
self = <noc.sa.profiles.Orion.NOS.profile.Profile object at 0x7feb46e69370>
script =
<noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>
c =
(' Orion Alpha A26 Device, Compiled on Jul 08 16:32:20 2013\n'
' sysLocation I.Kazaka_32\n'
' CPU Mac f8:f0:82:10:41:af\n'
' Vlan MAC f8:f0:82:10:41:ae\n'
' SoftWare Version 7.0.3.1(R0073.0008)\n'
' BootRom Version 7.1.10\n'
' HardWare Version 1.0.1\n'
' CPLD Version N/A\n'
' Serial No.:ONSA2610D814002473\n'
' Copyright (C) 2012 Orion Networks International, Inc.\n'
' All rights reserved\n'
' Last reboot is cold reset.\n'
' Uptime is 0 weeks, 2 days, 17 hours, 7 minutes\n')
match = None
------------------------------------------------------------------------
File: sa/profiles/Orion/NOS/get_interfaces.py (Line: 148)
Function: execute_cli
141 elif match1.group("mode") == "trunk":
142 sub["untagged_vlan"] = int(match1.group("native_vlan"))
143 sub["tagged_vlans"] = self.expand_rangelist(match1.group("vlans"))
144 else:
145 raise self.NotSupportedError()
146 iface["subinterfaces"] += [sub]
147 interfaces += [iface]
148 ==> mac = self.profile.get_version(self)["mac"]
149 descr = []
150 for l in self.cli("show interface ip description").split("\n"):
151 match = self.rx_descr.match(l.strip())
152 if match:
153 if match.group("port") == "Port":
154 continue
Variables:
self =
<noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>
interfaces = []
descr = []
gvrp = []
stp = []
ctp = []
lldp = []
oam = []
l = ''
match = None
------------------------------------------------------------------------
File: core/script/base.py (Line: 488)
Function: call_method
481 if isinstance(handler, str):
482 handler = getattr(self, handler, None)
483 if handler is None:
484 self.logger.debug("No '%s' handler. Passing to next method" % m)
485 continue
486 # Call handler
487 try:
488 ==> r = handler(**kwargs)
489 if isinstance(r, PartialResult):
490 if self.partial_result:
491 self.partial_result.update(r.result)
492 else:
493 self.partial_result = r.result
494 self.logger.debug(
Variables:
self =
<noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>
cli_handler =
<bound method Script.execute_cli of <noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>>
snmp_handler =
<bound method BaseScript.execute_snmp of <noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>>
fallback_handler = None
kwargs = {}
access_preference = 'CS*'
m = 'C'
handler =
<bound method Script.execute_cli of <noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>>
------------------------------------------------------------------------
File: core/script/base.py (Line: 451)
Function: execute
444 for f in self._execute_chain:
445 if f._match(self, self.version):
446 return f(self, **kwargs)
447 # Raise error
448 raise self.NotSupportedError()
449 else:
450 # New SNMP/CLI API
451 ==> return self.call_method(
452 cli_handler=self.execute_cli, snmp_handler=self.execute_snmp, **kwargs
453 )
454
455 def call_method(self, cli_handler=None, snmp_handler=None, fallback_handler=None, **kwargs):
456 """
457 Call function depending on access_preference
Variables:
self =
<noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>
kwargs = {}
------------------------------------------------------------------------
File: core/script/base.py (Line: 307)
Function: run
300 self.logger.info("Using cached result")
301 cache_hit = True
302 except KeyError:
303 pass
304 # Execute script
305 if not cache_hit:
306 try:
307 ==> result = self.execute(**self.args)
308 if self.cache and self.parent and result:
309 self.logger.info("Caching result")
310 self.set_cache(self.name, self.args, result)
311 finally:
312 if not self.parent:
313 # Close SNMP socket when necessary
Variables:
self =
<noc.sa.profiles.Orion.NOS.get_interfaces.Script object at 0x7feb46e639a0>
cache_hit = False
------------------------------------------------------------------------
File: commands/script.py (Line: 149)
Function: handle
142 name=script,
143 )
144 span_sample = 1 if update_spec or beef_output else 0
145 result = ""
146 if beef_output:
147 scr.start_tracking()
148 with Span(sample=span_sample, suppress_trace=span_sample):
149 ==> result = scr.run()
150 if pretty:
151 pprint.pprint(result)
152 elif yaml_o:
153 import sys
154
155 yaml.dump(result, sys.stdout)