Cisco
Steps to reproduce
При запуске скриптов на железе Cisco 3850 с профилем Cisco IOS
root@Node1:/opt/noc# ./noc script --debug --pretty get_version "sw3850"
root@Node1:/opt/noc# ./noc script --debug --pretty get_capabilities "sw3850"
Relevant logs and/or screenshots
get_version
2018-05-01 11:13:28,412 [noc.core.dcs.base] Resolve near service postgres
2018-05-01 11:13:28,412 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/postgres?passing=1&near=_agent
2018-05-01 11:13:28,414 [noc.core.http.client] HTTP Response 200
2018-05-01 11:13:28,415 [noc.core.dcs.base] Resolved near service postgres to ['10.220.21.122:5432']
2018-05-01 11:13:29,720 [noc.core.dcs.base] Running resolver for service mongo
2018-05-01 11:13:29,721 [noc.core.dcs.base] [mongo] Starting resolver
2018-05-01 11:13:29,721 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?passing=1
2018-05-01 11:13:29,722 [noc.core.http.client] HTTP Response 200
2018-05-01 11:13:29,723 [noc.core.dcs.base] [mongo] Set active services to: mongo: 10.220.21.122:27017
2018-05-01 11:13:29,723 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?index=2342734&passing=1
2018-05-01 11:13:29,724 [noc.lib.nosql] Connecting to MongoDB {'username': 'noc', 'authentication_source': 'noc', 'readPreference': 'secondaryPreferred', 'replicaSet': 'noc', 'db': 'noc', 'socketKeepAlive': True, 'host': 'mongodb://noc:********@10.220.21.122:27017/noc', 'password': '********'}
2018-05-01 11:13:29,779 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
2018-05-01 11:13:29,845 [noc.main.models.doccategory] Registering Capability
2018-05-01 11:13:29,846 [noc.main.models.doccategory] Registering MetricType
2018-05-01 11:13:29,882 [noc.main.models.doccategory] Registering ConnectionType
2018-05-01 11:13:29,886 [noc.main.models.doccategory] Registering ObjectModel
2018-05-01 11:13:29,895 [noc.main.models.textindex] Adding FTS index for sa.managedobject
2018-05-01 11:13:29,912 [noc.main.models.textindex] Adding FTS index for ip.vrf
2018-05-01 11:13:29,915 [noc.main.models.textindex] Adding FTS index for vc.vc
2018-05-01 11:13:29,916 [noc.main.models.textindex] Adding FTS index for ip.prefix
2018-05-01 11:13:29,923 [noc.main.models.textindex] Adding FTS index for ip.address
2018-05-01 11:13:29,986 [noc.core.script.loader] Loading script Cisco.IOS.get_version
2018-05-01 11:13:29,989 [noc.core.mib] Loading compiled MIBs
2018-05-01 11:13:29,989 [noc.core.mib] Loading compiled MIBs from 'cmibs'
2018-05-01 11:13:29,989 [noc.core.mib] Loading MIB: ENTITY-STATE-MIB
2018-05-01 11:13:29,989 [noc.core.mib] Loading MIB: SNMPv2-MIB
2018-05-01 11:13:29,990 [noc.core.mib] Loading MIB: CISCO-PPPOE-MIB
2018-05-01 11:13:29,990 [noc.core.mib] Loading MIB: RMON2-MIB
2018-05-01 11:13:29,990 [noc.core.mib] Loading MIB: IF-MIB
2018-05-01 11:13:29,990 [noc.core.mib] Loading MIB: RFC1213-MIB
2018-05-01 11:13:29,991 [noc.core.mib] Loading MIB: BRIDGE-MIB
2018-05-01 11:13:29,991 [noc.core.mib] Loading MIB: EtherLike-MIB
2018-05-01 11:13:29,991 [noc.core.mib] Loading MIB: ENTITY-MIB
2018-05-01 11:13:29,991 [noc.core.mib] Loading MIB: IP-MIB
2018-05-01 11:13:29,991 [noc.core.mib] Loading MIB: ENTITY-SENSOR-MIB
2018-05-01 11:13:29,992 [noc.core.mib] Loading MIB: CISCO-VPDN-MGMT-MIB
2018-05-01 11:13:29,992 [noc.core.mib] Loading MIB: LLDP-MIB
2018-05-01 11:13:30,016 [noc.core.profile.loader] Loading profile Cisco.IOS
2018-05-01 11:13:30,016 [script] [Cisco.IOS.get_version|10.220.20.100] Running. Input arguments: {}, timeout 3600
2018-05-01 11:13:30,017 [script] [Cisco.IOS.get_version|10.220.20.100] [snmp] Creating IOLoop
2018-05-01 11:13:30,017 [script] [Cisco.IOS.get_version|10.220.20.100] [snmp] Create UDP socket
2018-05-01 11:13:30,017 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GET ['1.3.6.1.2.1.1.1.0']
2018-05-01 11:13:30,020 [noc.core.ioloop.snmp] [10.220.20.100] GET result: 'Cisco IOS Software [Denali], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.3.5b, RELEASE SOFTWARE (fc1)\r\nTechnical Support: http://www.cisco.com/techsupport\r\nCopyright (c) 1986-2017 by Cisco Systems, Inc.\r\nCompiled Thu 02-Nov-17 11:07 '
2018-05-01 11:13:30,021 [script] [Cisco.IOS.get_version|10.220.20.100] [snmp] Closing UDP socket
2018-05-01 11:13:30,021 [script] [Cisco.IOS.get_version|10.220.20.100] [snmp] Closing IOLoop
2018-05-01 11:13:30,315 [noc.core.debug] UNHANDLED EXCEPTION (2018-05-01 11:13:30.049069)
PROCESS: ./commands/script.py
VERSION: 15.05.1+microservices.9559.0ce3c50f
BRANCH: microservices CHANGESET: 0ce3c50f
ERROR FINGERPRINT: 17c76bd3-7dc0-55b1-90f5-98006ea7c95c
WORKING DIRECTORY: /opt/noc
EXCEPTION: <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'group'
START OF TRACEBACK
------------------------------------------------------------------------
File: sa/profiles/Cisco/IOS/get_version.py (Line: 81)
Function: execute
74 # https://wiki.opennms.org/wiki/Hardware_Inventory_Entity_MIB
75 platform = ""
76 try:
77 v = self.snmp.get(mib["SNMPv2-MIB::sysDescr.0"], cached=True)
78 if v:
79 s = ""
80 match = self.rx_snmp_ver.search(v)
81 ==> platform = match.group("platform")
82 # inventory
83 # p = self.snmp.get("1.3.6.1.2.1.47.1.1.1.1.2.1001")
84 p = self.snmp.get(mib["ENTITY-MIB::entPhysicalDescr.1001"])
85 if p and p.startswith("WS-C"):
86 platform = p
87 s = self.snmp.get(mib["ENTITY-MIB::entPhysicalSerialNum.1001"])
Variables:
platform = ''
s = ''
self = <noc.sa.profiles.Cisco.IOS.get_version.Script object at 0x7f53ccab64d0>
match = None
v =
'Cisco IOS Software [Denali], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.3.5b, RELEASE SOFTWARE (fc1)\r\nTechnical Support: http://www.cisco.com/techsupport\r\nCopyright (c) 1986-2017 by Cisco Systems, Inc.\r\nCompiled Thu 02-Nov-17 11:07 '
------------------------------------------------------------------------
File: core/script/base.py (Line: 247)
Function: run
240 self.logger.info("Using cached result")
241 cache_hit = True
242 except KeyError:
243 pass
244 # Execute script
245 if not cache_hit:
246 try:
247 ==> result = self.execute(**self.args)
248 if self.cache and self.parent and result:
249 self.logger.info("Caching result")
250 self.set_cache(self.name, self.args, result)
251 finally:
252 if not self.parent:
253 # Close SNMP socket when necessary
Variables:
cache_hit = False
self = <noc.sa.profiles.Cisco.IOS.get_version.Script object at 0x7f53ccab64d0>
------------------------------------------------------------------------
File: commands/script.py (Line: 118)
Function: handle
111 capabilities=caps,
112 args=args,
113 version=version,
114 timeout=3600,
115 name=script,
116 collect_beef=bool(beef)
117 )
118 ==> result = scr.run()
119 if pretty:
120 pprint.pprint(result)
121 elif yaml:
122 import yaml
123 import sys
124 yaml.dump(result, sys.stdout)
Variables:
obj = <ManagedObject: sw3850>
beef = None
service = <__main__.ServiceStub object at 0x7f53ccab6650>
script = u'Cisco.IOS.get_version'
script_class = <class 'noc.sa.profiles.Cisco.IOS.get_version.Script'>
self = <__main__.Command object at 0x7f53d54043d0>
args = {}
use_snmp = True
caps =
{u'Cisco | IOS | Syntax | IP SLA': 0,
u'DB | Interfaces': 75,
u'Network | CDP': True,
u'Network | IPv6': True,
u'Network | LACP': True,
u'Network | OAM': True,
u'Network | STP': True,
u'SNMP': True,
u'SNMP | Bulk': True,
u'SNMP | IF-MIB': True,
u'SNMP | IF-MIB | HC': True,
u'SNMP | v1': True,
u'SNMP | v2c': True,
u'SNMP | v3': False}
yaml = False
object_name = ['sw3850']
version = None
arguments = []
pretty = True
credentials =
{'access_preference': u'CS',
'address': u'xx.xx.xx.100',
'cli_protocol': 'telnet',
'password': u'xxxxx',
'path': None,
'raise_privileges': True,
'snmp_ro': u'xxxxx',
'snmp_version': 'v2c',
'super_password': u'cisco',
'user': u'noc'}
access_preference = None
options = {}
scr = <noc.sa.profiles.Cisco.IOS.get_version.Script object at 0x7f53ccab64d0>
------------------------------------------------------------------------
File: core/management/base.py (Line: 76)
Function: run_from_argv
69 enable_profiling = cmd_options.pop("enable_profiling", False)
70 show_metrics = cmd_options.pop("show_metrics", False)
71 if enable_profiling:
72 # Start profiler
73 import yappi
74 yappi.start()
75 try:
76 ==> return self.handle(*args, **cmd_options) or 0
77 except CommandError as e:
78 self.print(str(e))
79 return 1
80 except KeyboardInterrupt:
81 self.print("Ctrl+C")
82 return 3
Variables:
parser =
ArgumentParser(prog='script.py', usage=None, description=None, version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
loglevel = 'debug'
enable_profiling = False
args = ()
cmd_options =
{'access_preference': None,
'arguments': [],
'beef': None,
'object_name': ['sw3850'],
'pretty': True,
'script': ['get_version'],
'use_snmp': True,
'yaml': False}
argv = ['--debug', '--pretty', 'get_version', 'sw3850']
self = <__main__.Command object at 0x7f53d54043d0>
show_metrics = False
options =
Namespace(access_preference=None, arguments=[], beef=None, object_name=['sw3850'], pretty=True, script=['get_version'], use_snmp=True, yaml=False)
------------------------------------------------------------------------
END OF TRACEBACK
get_capabilities
2018-05-01 11:16:37,024 [noc.core.dcs.base] Resolve near service postgres
2018-05-01 11:16:37,025 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/postgres?passing=1&near=_agent
2018-05-01 11:16:37,028 [noc.core.http.client] HTTP Response 200
2018-05-01 11:16:37,028 [noc.core.dcs.base] Resolved near service postgres to ['10.220.21.122:5432']
2018-05-01 11:16:37,876 [noc.core.dcs.base] Running resolver for service mongo
2018-05-01 11:16:37,876 [noc.core.dcs.base] [mongo] Starting resolver
2018-05-01 11:16:37,877 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?passing=1
2018-05-01 11:16:37,878 [noc.core.http.client] HTTP Response 200
2018-05-01 11:16:37,878 [noc.core.dcs.base] [mongo] Set active services to: mongo: 10.220.21.122:27017
2018-05-01 11:16:37,878 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?index=2342803&passing=1
2018-05-01 11:16:37,879 [noc.lib.nosql] Connecting to MongoDB {'username': 'noc', 'authentication_source': 'noc', 'readPreference': 'secondaryPreferred', 'replicaSet': 'noc', 'db': 'noc', 'socketKeepAlive': True, 'host': 'mongodb://noc:********@10.220.21.122:27017/noc', 'password': '********'}
2018-05-01 11:16:37,948 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
2018-05-01 11:16:38,010 [noc.main.models.doccategory] Registering Capability
2018-05-01 11:16:38,011 [noc.main.models.doccategory] Registering MetricType
2018-05-01 11:16:38,044 [noc.main.models.doccategory] Registering ConnectionType
2018-05-01 11:16:38,048 [noc.main.models.doccategory] Registering ObjectModel
2018-05-01 11:16:38,057 [noc.main.models.textindex] Adding FTS index for sa.managedobject
2018-05-01 11:16:38,072 [noc.main.models.textindex] Adding FTS index for ip.vrf
2018-05-01 11:16:38,075 [noc.main.models.textindex] Adding FTS index for vc.vc
2018-05-01 11:16:38,077 [noc.main.models.textindex] Adding FTS index for ip.prefix
2018-05-01 11:16:38,081 [noc.main.models.textindex] Adding FTS index for ip.address
2018-05-01 11:16:38,129 [noc.core.script.loader] Loading script Cisco.IOS.get_capabilities
2018-05-01 11:16:38,132 [noc.core.mib] Loading compiled MIBs
2018-05-01 11:16:38,132 [noc.core.mib] Loading compiled MIBs from 'cmibs'
2018-05-01 11:16:38,132 [noc.core.mib] Loading MIB: ENTITY-STATE-MIB
2018-05-01 11:16:38,132 [noc.core.mib] Loading MIB: SNMPv2-MIB
2018-05-01 11:16:38,133 [noc.core.mib] Loading MIB: CISCO-PPPOE-MIB
2018-05-01 11:16:38,133 [noc.core.mib] Loading MIB: RMON2-MIB
2018-05-01 11:16:38,133 [noc.core.mib] Loading MIB: IF-MIB
2018-05-01 11:16:38,133 [noc.core.mib] Loading MIB: RFC1213-MIB
2018-05-01 11:16:38,134 [noc.core.mib] Loading MIB: BRIDGE-MIB
2018-05-01 11:16:38,134 [noc.core.mib] Loading MIB: EtherLike-MIB
2018-05-01 11:16:38,134 [noc.core.mib] Loading MIB: ENTITY-MIB
2018-05-01 11:16:38,134 [noc.core.mib] Loading MIB: IP-MIB
2018-05-01 11:16:38,134 [noc.core.mib] Loading MIB: ENTITY-SENSOR-MIB
2018-05-01 11:16:38,135 [noc.core.mib] Loading MIB: CISCO-VPDN-MGMT-MIB
2018-05-01 11:16:38,135 [noc.core.mib] Loading MIB: LLDP-MIB
2018-05-01 11:16:38,154 [noc.core.profile.loader] Loading profile Cisco.IOS
2018-05-01 11:16:38,155 [script] [Cisco.IOS.get_capabilities|10.220.20.100] Running. Input arguments: {}, timeout 3600
2018-05-01 11:16:38,155 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [snmp] Creating IOLoop
2018-05-01 11:16:38,155 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [snmp] Create UDP socket
2018-05-01 11:16:38,155 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GET ['1.3.6.1.2.1.1.2.0']
2018-05-01 11:16:38,158 [noc.core.ioloop.snmp] [10.220.20.100] GET result: '1.3.6.1.4.1.9.1.1745'
2018-05-01 11:16:38,158 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GET ['1.3.6.1.2.1.1.2.0']
2018-05-01 11:16:38,160 [noc.core.ioloop.snmp] [10.220.20.100] GET result: '1.3.6.1.4.1.9.1.1745'
2018-05-01 11:16:38,160 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GETNEXT 1.3.6.1.2.1.1.1
2018-05-01 11:16:38,162 [noc.core.ioloop.snmp] [10.220.20.100] GETNEXT result: [('1.3.6.1.2.1.1.1.0', 'Cisco IOS Software [Denali], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.3.5b, RELEASE SOFTWARE (fc1)\r\nTechnical Support: http://www.cisco.com/techsupport\r\nCopyright (c) 1986-2017 by Cisco Systems, Inc.\r\nCompiled Thu 02-Nov-17 11:07 ')]
2018-05-01 11:16:38,163 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GETNEXT 1.3.6.1.2.1.2.2.1.1
2018-05-01 11:16:38,166 [noc.core.ioloop.snmp] [10.220.20.100] GETNEXT result: [('1.3.6.1.2.1.2.2.1.1.1', 1)]
2018-05-01 11:16:38,166 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GETNEXT 1.3.6.1.2.1.31.1.1.1.6
2018-05-01 11:16:38,169 [noc.core.ioloop.snmp] [10.220.20.100] GETNEXT result: [('1.3.6.1.2.1.31.1.1.1.6.1', 5743866954)]
2018-05-01 11:16:38,169 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GET ['1.3.6.1.4.1.9.10.24.1.1.4.1.2.2']
2018-05-01 11:16:38,171 [noc.core.ioloop.snmp] [10.220.20.100] GET result: None
2018-05-01 11:16:38,171 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GET ['1.3.6.1.4.1.9.9.194.1.1.1.0']
2018-05-01 11:16:38,172 [noc.core.ioloop.snmp] [10.220.20.100] GET result: None
2018-05-01 11:16:38,173 [noc.core.ioloop.snmp] [10.220.20.100] SNMP GET ['1.3.6.1.4.1.9.10.24.1.1.4.1.2.3']
2018-05-01 11:16:38,174 [noc.core.ioloop.snmp] [10.220.20.100] GET result: None
2018-05-01 11:16:38,174 [script] [Cisco.IOS.get_capabilities|10.220.20.100] Open telnet CLI
2018-05-01 11:16:38,177 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [telnet] Setup session
2018-05-01 11:16:38,177 [script] [Cisco.IOS.get_capabilities|10.220.20.100] Disable paging
2018-05-01 11:16:38,177 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [telnet] Creating IOLoop
2018-05-01 11:16:38,177 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [telnet] Connecting (u'10.220.20.100', 23)
2018-05-01 11:16:38,179 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [telnet] Connection refused
2018-05-01 11:16:38,179 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [snmp] Closing UDP socket
2018-05-01 11:16:38,179 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [snmp] Closing IOLoop
2018-05-01 11:16:38,179 [script] [Cisco.IOS.get_capabilities|10.220.20.100] [telnet] Closing IOLoop
2018-05-01 11:16:38,355 [noc.core.debug] UNHANDLED EXCEPTION (2018-05-01 11:16:38.191016)
PROCESS: ./commands/script.py
VERSION: 15.05.1+microservices.9559.0ce3c50f
BRANCH: microservices CHANGESET: 0ce3c50f
ERROR FINGERPRINT: ec2ee0cd-9c68-51fc-b692-1f5faa5df5d4
WORKING DIRECTORY: /opt/noc
EXCEPTION: <class 'noc.core.script.cli.error.CLIConnectionRefused'> Connection refused
START OF TRACEBACK
------------------------------------------------------------------------
File: core/script/cli/base.py (Line: 179)
Function: execute
172 parser = self.read_until_prompt
173 with Span(server=self.script.credentials.get("address"),
174 service=self.name, in_label=cmd) as s:
175 self.ioloop.run_sync(functools.partial(self.submit, parser))
176 if self.error:
177 if s:
178 s.error_text = str(self.error)
179 ==> raise self.error
180 else:
181 return self.result
182
183 @tornado.gen.coroutine
184 def submit(self, parser=None):
185 # Create iostream and connect, when necessary
Variables:
cmd = 'terminal length 0\n'
obj_parser = None
self = <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc071d98910>
parser =
<bound method TelnetCLI.read_until_prompt of <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc071d98910>>
cmd_stop = None
cmd_next = None
s = <noc.core.span.Span object at 0x7fc071db2750>
ignore_errors = True
------------------------------------------------------------------------
File: core/script/base.py (Line: 768)
Function: cli
761 if r is not None:
762 self.logger.debug("Use cached result")
763 return format_result(r)
764 command_submit = command_submit or self.profile.command_submit
765 stream = self.get_cli_stream()
766 r = stream.execute(cmd + command_submit, obj_parser=obj_parser,
767 cmd_next=cmd_next, cmd_stop=cmd_stop,
768 ==> ignore_errors=ignore_errors)
769 if isinstance(r, six.string_types):
770 if self.beef:
771 self.beef.set_cli(cmd, r)
772 # Check for syntax errors
773 if not ignore_errors:
774 # Then check for operation error
Variables:
command_submit = '\n'
format_result = <function format_result at 0x7fc071db7488>
nowait = False
stream = <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc071d98910>
cached = False
obj_parser = None
bulk_lines = None
cmd = 'terminal length 0'
cmd_stop = None
cmd_next = None
file = None
list_re = None
ignore_errors = True
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
------------------------------------------------------------------------
File: core/script/base.py (Line: 830)
Function: get_cli_stream
823 # @todo: Move to CLI
824 if self.to_disable_pager:
825 self.logger.debug("Disable paging")
826 self.to_disable_pager = False
827 if isinstance(self.profile.command_disable_pager, six.string_types):
828 self.cli(
829 self.profile.command_disable_pager,
830 ==> ignore_errors=True
831 )
832 elif isinstance(self.profile.command_disable_pager, list):
833 for cmd in self.profile.command_disable_pager:
834 self.cli(cmd, ignore_errors=True)
835 else:
836 raise UnexpectedResultError
Variables:
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
protocol = 'telnet'
------------------------------------------------------------------------
File: core/script/base.py (Line: 765)
Function: cli
758 return format_result(f.read())
759 if cached:
760 r = self.root.cli_cache.get(cmd)
761 if r is not None:
762 self.logger.debug("Use cached result")
763 return format_result(r)
764 command_submit = command_submit or self.profile.command_submit
765 ==> stream = self.get_cli_stream()
766 r = stream.execute(cmd + command_submit, obj_parser=obj_parser,
767 cmd_next=cmd_next, cmd_stop=cmd_stop,
768 ignore_errors=ignore_errors)
769 if isinstance(r, six.string_types):
770 if self.beef:
771 self.beef.set_cli(cmd, r)
Variables:
command_submit = '\n'
format_result = <function format_result at 0x7fc071d92230>
nowait = False
cached = False
obj_parser = None
bulk_lines = None
cmd = 'show spanning-tree'
cmd_stop = None
cmd_next = None
file = None
list_re = None
ignore_errors = False
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
------------------------------------------------------------------------
File: sa/profiles/Cisco/IOS/get_capabilities.py (Line: 80)
Function: has_stp_cli
73 return "% OAM is not enabled" not in r # @todo: not tested
74
75 @false_on_cli_error
76 def has_stp_cli(self):
77 """
78 Check box has stp enabled
79 """
80 ==> r = self.cli("show spanning-tree")
81 if ("No spanning tree instance exists" in r or
82 "No spanning tree instances exist" in r):
83 return False
84 return True
85
86 @false_on_cli_error
Variables:
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
------------------------------------------------------------------------
File: sa/profiles/Generic/get_capabilities.py (Line: 415)
Function: wrapper
408 self.capabilities[name] = value
409
410
411 def false_on_cli_error(f):
412 @functools.wraps(f)
413 def wrapper(*args, **kwargs):
414 try:
415 ==> return f(*args, **kwargs)
416 except (BaseScript.CLIOperationError, BaseScript.CLISyntaxError):
417 return False
418 return wrapper
Variables:
args =
(<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>,)
f = <function has_stp_cli at 0x7fc071d908c0>
kwargs = {}
------------------------------------------------------------------------
File: core/script/base.py (Line: 422)
Function: call_method
415 if isinstance(handler, six.string_types):
416 handler = getattr(self, handler, None)
417 if handler is None:
418 self.logger.debug("No '%s' handler. Passing to next method" % m)
419 continue
420 # Call handler
421 try:
422 ==> r = handler(**kwargs)
423 if isinstance(r, PartialResult):
424 if self.partial_result:
425 self.partial_result.update(r.result)
426 else:
427 self.partial_result = r.result
428 self.logger.debug("Partial result: %r. Passing to next method", self.partial_result)
Variables:
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
m = u'C'
fallback_handler =
<bound method Script.return_false of <noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>>
cli_handler = 'has_stp_cli'
handler =
<bound method Script.has_stp_cli of <noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>>
kwargs = {}
snmp_handler = 'has_stp_snmp'
access_preference = u'CS*'
------------------------------------------------------------------------
File: sa/profiles/Generic/get_capabilities.py (Line: 144)
Function: has_stp
137 def has_stp(self):
138 """
139 Returns True when STP is enabled
140 """
141 return self.call_method(
142 cli_handler="has_stp_cli",
143 snmp_handler="has_stp_snmp",
144 ==> fallback_handler=self.return_false
145 )
146
147 def has_udld(self):
148 """
149 Returns True when UDLD is enabled
150 """
Variables:
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
------------------------------------------------------------------------
File: sa/profiles/Generic/get_capabilities.py (Line: 343)
Function: execute
336 for cap, oid in self.CHECK_SNMP_GET.iteritems():
337 if self.check_snmp_get(oid):
338 caps[cap] = True
339 else:
340 caps["SNMP"] = False
341 for v in self.SNMP_CAPS:
342 caps[v] = False
343 ==> if self.has_stp():
344 caps["Network | STP"] = True
345 if self.has_lldp():
346 caps["Network | LLDP"] = True
347 if self.has_cdp():
348 caps["Network | CDP"] = True
349 if self.has_oam():
Variables:
oid = '1.3.6.1.4.1.9.10.24.1.1.4.1.2.3'
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
cap = 'BRAS | PPTP'
caps =
{'SNMP': True,
'SNMP | Bulk': True,
'SNMP | IF-MIB': True,
'SNMP | IF-MIB | HC': True,
'SNMP | v1': True,
'SNMP | v2c': True,
'SNMP | v3': False}
v = 3
svs = set([0, 1])
------------------------------------------------------------------------
File: core/script/base.py (Line: 247)
Function: run
240 self.logger.info("Using cached result")
241 cache_hit = True
242 except KeyError:
243 pass
244 # Execute script
245 if not cache_hit:
246 try:
247 ==> result = self.execute(**self.args)
248 if self.cache and self.parent and result:
249 self.logger.info("Caching result")
250 self.set_cache(self.name, self.args, result)
251 finally:
252 if not self.parent:
253 # Close SNMP socket when necessary
Variables:
cache_hit = False
self =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
------------------------------------------------------------------------
File: commands/script.py (Line: 118)
Function: handle
111 capabilities=caps,
112 args=args,
113 version=version,
114 timeout=3600,
115 name=script,
116 collect_beef=bool(beef)
117 )
118 ==> result = scr.run()
119 if pretty:
120 pprint.pprint(result)
121 elif yaml:
122 import yaml
123 import sys
124 yaml.dump(result, sys.stdout)
Variables:
obj = <ManagedObject: sw3850>
beef = None
service = <__main__.ServiceStub object at 0x7fc071ddc590>
script = u'Cisco.IOS.get_capabilities'
script_class = <class 'noc.sa.profiles.Cisco.IOS.get_capabilities.Script'>
self = <__main__.Command object at 0x7fc086ddf3d0>
args = {}
use_snmp = True
caps =
{u'Cisco | IOS | Syntax | IP SLA': 0,
u'DB | Interfaces': 75,
u'Network | CDP': True,
u'Network | IPv6': True,
u'Network | LACP': True,
u'Network | OAM': True,
u'Network | STP': True,
u'SNMP': True,
u'SNMP | Bulk': True,
u'SNMP | IF-MIB': True,
u'SNMP | IF-MIB | HC': True,
u'SNMP | v1': True,
u'SNMP | v2c': True,
u'SNMP | v3': False}
yaml = False
object_name = ['sw3850']
version = None
arguments = []
pretty = True
credentials =
{'access_preference': u'CS',
'address': u'10.220.20.100',
'cli_protocol': 'telnet',
'password': u'xxxxxxx',
'path': None,
'raise_privileges': True,
'snmp_ro': u'xxxxxx',
'snmp_version': 'v2c',
'super_password': u'cisco',
'user': u'noc'}
access_preference = None
options = {}
scr =
<noc.sa.profiles.Cisco.IOS.get_capabilities.Script object at 0x7fc071d8ec50>
------------------------------------------------------------------------
File: core/management/base.py (Line: 76)
Function: run_from_argv
69 enable_profiling = cmd_options.pop("enable_profiling", False)
70 show_metrics = cmd_options.pop("show_metrics", False)
71 if enable_profiling:
72 # Start profiler
73 import yappi
74 yappi.start()
75 try:
76 ==> return self.handle(*args, **cmd_options) or 0
77 except CommandError as e:
78 self.print(str(e))
79 return 1
80 except KeyboardInterrupt:
81 self.print("Ctrl+C")
82 return 3
Variables:
parser =
ArgumentParser(prog='script.py', usage=None, description=None, version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
loglevel = 'debug'
enable_profiling = False
args = ()
cmd_options =
{'access_preference': None,
'arguments': [],
'beef': None,
'object_name': ['sw3850'],
'pretty': True,
'script': ['get_capabilities'],
'use_snmp': True,
'yaml': False}
argv = ['--debug', '--pretty', 'get_capabilities', 'sw3850']
self = <__main__.Command object at 0x7fc086ddf3d0>
show_metrics = False
options =
Namespace(access_preference=None, arguments=[], beef=None, object_name=['sw3850'], pretty=True, script=['get_capabilities'], use_snmp=True, yaml=False)
------------------------------------------------------------------------
END OF TRACEBACK
2018-05-01 11:16:38,365 [noc.core.debug] Writing CP report to /var/lib/noc/cp/crashinfo/new/ec2ee0cd-9c68-51fc-b692-1f5faa5df5d4.json
./noc about
)
Paste NOC version (NOC version is: 15.05.1+microservices.9559.0ce3c50f