Ошибка при discovery interfaces NAG SNR-S3650G-48S
./noc script --debug get_interfaces "dev.name"
EXCEPTION: <class 'AttributeError'> 'NoneType' object has no attribute 'group'
<re.Match object; span=(78582, 78900), match=' Ethernet1/0/51 is down, line protocol is down\n>
name = 'Ethernet1/0/51'
a_stat = False
o_stat = False
other =
(' Ethernet1/0/51 is layer 2 port, alias name is (null), index is 51\n'
' Hardware is Unknown(card not installed), address is f8-f0-82-10-1b-51\n'
' PVID is 1\n'
' MTU 1500 bytes, BW 10000 Kbit\n'
' Time since last status change:25w-0d-9h-1m-16s (15152476 seconds)\n')
match1 = None
iface =
{'admin_status': False,
'name': 'Ethernet1/0/51',
'oper_status': False,
'type': 'physical'}
sub =
{'admin_status': False,
'enabled_afi': ['BRIDGE'],
'name': 'Ethernet1/0/51',
'oper_status': False}
------------------------------------------------------------------------
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.NAG.SNR.get_interfaces.Script object at 0x7fb7f6f5e4c0>
cli_handler =
<bound method Script.execute_cli of <noc.sa.profiles.NAG.SNR.get_interfaces.Script object at 0x7fb7f6f5e4c0>>
snmp_handler =
<bound method BaseScript.execute_snmp of <noc.sa.profiles.NAG.SNR.get_interfaces.Script object at 0x7fb7f6f5e4c0>>
fallback_handler = None
kwargs = {}
access_preference = 'CS*'
m = 'C'
handler =
<bound method Script.execute_cli of <noc.sa.profiles.NAG.SNR.get_interfaces.Script object at 0x7fb7f6f5e4c0>>
------------------------------------------------------------------------
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.NAG.SNR.get_interfaces.Script object at 0x7fb7f6f5e4c0>
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.NAG.SNR.get_interfaces.Script object at 0x7fb7f6f5e4c0>
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)
Variables:
self = <__main__.Command object at 0x7fb80635ad60>
script = 'NAG.SNR.get_interfaces'
object_name = ['dev.name']
arguments = []
pretty = False
yaml_o = False
use_snmp = True
access_preference = None
snmp_rate_limit = 0
update_spec = None
beef_output = None
args = {}
options = {}
obj = <ManagedObject: dev.name>
credentials =
{'access_preference': 'CS',
'address': '172.10.0.10',
'cli_protocol': 'telnet',
'password': 'passwd',
'path': None,
'raise_privileges': True,
'snmp_rate_limit': None,
'snmp_ro': 'public',
'snmp_version': 'v2c',
'super_password': None,
'user': 'user'}
script_class = <class 'noc.sa.profiles.NAG.SNR.get_interfaces.Script'>
caps =
{'Network | LLDP': True,
'SNMP': True,
'SNMP | Bulk': True,
'SNMP | IF-MIB': True,
'SNMP | IF-MIB | HC': True,
'SNMP | OID | EnterpriseID': 40418,
'SNMP | v1': True,
'SNMP | v2c': True}
version =
{'caps': {'Network | LLDP': True,
'SNMP': True,
'SNMP | Bulk': True,
'SNMP | IF-MIB': True,
'SNMP | IF-MIB | HC': True,
'SNMP | OID | EnterpriseID': 40418,
'SNMP | v1': True,
'SNMP | v2c': True},
'image': None,
'platform': 'SNR-S3650G-48S',
'vendor': 'NAG',
'version': '7.0.3.1(R0244.0165)'}
service = <__main__.ServiceStub object at 0x7fb7f6fb5a00>
scr = <noc.sa.profiles.NAG.SNR.get_interfaces.Script object at 0x7fb7f6f5e4c0>
span_sample = 0
result = ''
------------------------------------------------------------------------
File: core/management/base.py (Line: 78)
Function: run_from_argv
71 self.no_progressbar = cmd_options.pop("no_progressbar", False)
72 if enable_profiling:
73 # Start profiler
74 import yappi
75
76 yappi.start()
77 try:
78 ==> return self.handle(*args, **cmd_options) or 0
79 except CommandError as e:
80 self.print(str(e))
81 return 1
82 except KeyboardInterrupt:
83 self.print("Ctrl+C")
84 return 3
Variables:
self = <__main__.Command object at 0x7fb80635ad60>
argv = ['--debug', 'get_interfaces', 'dev.name']
parser =
ArgumentParser(prog='noc script', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
options =
Namespace(access_preference=None, arguments=[], beef_output=None, object_name=['dev.name'], pretty=False, script=['get_interfaces'], snmp_rate_limit=0, update_spec=None, use_snmp=True, yaml_o=False)
cmd_options =
{'access_preference': None,
'arguments': [],
'beef_output': None,
'object_name': ['dev.name'],
'pretty': False,
'script': ['get_interfaces'],
'snmp_rate_limit': 0,
'update_spec': None,
'use_snmp': True,
'yaml_o': False}
args = ()
loglevel = 'debug'
enable_profiling = False
show_metrics = False
error_report = <function error_report at 0x7fb84bbeb940>
------------------------------------------------------------------------
END OF TRACEBACK