Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@Node1:/opt/noc# ./noc script --debug --pretty get_mpls_vpn "sw3850"
- 2018-05-01 11:19:42,474 [noc.core.dcs.base] Resolve near service postgres
- 2018-05-01 11:19:42,474 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/postgres?passing=1&near=_agent
- 2018-05-01 11:19:42,477 [noc.core.http.client] HTTP Response 200
- 2018-05-01 11:19:42,477 [noc.core.dcs.base] Resolved near service postgres to ['10.220.21.122:5432']
- 2018-05-01 11:19:43,334 [noc.core.dcs.base] Running resolver for service mongo
- 2018-05-01 11:19:43,335 [noc.core.dcs.base] [mongo] Starting resolver
- 2018-05-01 11:19:43,335 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?passing=1
- 2018-05-01 11:19:43,336 [noc.core.http.client] HTTP Response 200
- 2018-05-01 11:19:43,337 [noc.core.dcs.base] [mongo] Set active services to: mongo: 10.220.21.122:27017
- 2018-05-01 11:19:43,337 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?index=2342965&passing=1
- 2018-05-01 11:19:43,338 [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:19:43,393 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
- 2018-05-01 11:19:43,454 [noc.main.models.doccategory] Registering Capability
- 2018-05-01 11:19:43,455 [noc.main.models.doccategory] Registering MetricType
- 2018-05-01 11:19:43,488 [noc.main.models.doccategory] Registering ConnectionType
- 2018-05-01 11:19:43,491 [noc.main.models.doccategory] Registering ObjectModel
- 2018-05-01 11:19:43,502 [noc.main.models.textindex] Adding FTS index for sa.managedobject
- 2018-05-01 11:19:43,517 [noc.main.models.textindex] Adding FTS index for ip.vrf
- 2018-05-01 11:19:43,519 [noc.main.models.textindex] Adding FTS index for vc.vc
- 2018-05-01 11:19:43,521 [noc.main.models.textindex] Adding FTS index for ip.prefix
- 2018-05-01 11:19:43,526 [noc.main.models.textindex] Adding FTS index for ip.address
- 2018-05-01 11:19:43,573 [noc.core.script.loader] Loading script Cisco.IOS.get_mpls_vpn
- 2018-05-01 11:19:43,594 [noc.core.profile.loader] Loading profile Cisco.IOS
- 2018-05-01 11:19:43,595 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] Running. Input arguments: {}, timeout 3600
- 2018-05-01 11:19:43,595 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] Open telnet CLI
- 2018-05-01 11:19:43,597 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Setup session
- 2018-05-01 11:19:43,597 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] Disable paging
- 2018-05-01 11:19:43,597 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Creating IOLoop
- 2018-05-01 11:19:43,598 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Connecting (u'10.220.20.100', 23)
- 2018-05-01 11:19:43,600 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Connection refused
- 2018-05-01 11:19:43,600 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Closing IOLoop
- 2018-05-01 11:19:43,778 [noc.core.debug] UNHANDLED EXCEPTION (2018-05-01 11:19:43.609932)
- 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 0x7fc7dc132ed0>
- parser =
- <bound method TelnetCLI.read_until_prompt of <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc7dc132ed0>>
- cmd_stop = None
- cmd_next = None
- s = <noc.core.span.Span object at 0x7fc7dc0ded10>
- 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 0x7fc7dc0ea848>
- nowait = False
- stream = <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc7dc132ed0>
- 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_mpls_vpn.Script object at 0x7fc7dc1325d0>
- ------------------------------------------------------------------------
- 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_mpls_vpn.Script object at 0x7fc7dc1325d0>
- 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 0x7fc7dc0c5758>
- nowait = False
- cached = False
- obj_parser = None
- bulk_lines = None
- cmd = 'show ip vrf detail'
- cmd_stop = None
- cmd_next = None
- file = None
- list_re = None
- ignore_errors = False
- self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
- ------------------------------------------------------------------------
- File: sa/profiles/Cisco/IOS/get_mpls_vpn.py (Line: 46)
- Function: execute_cli
- 39 return self.portchannel_members[iface]
- 40 else:
- 41 return []
- 42
- 43 def execute_cli(self, **kwargs):
- 44 vpns = []
- 45 try:
- 46 ==> v = self.cli("show ip vrf detail")
- 47 except self.CLISyntaxError:
- 48 return self.execute_vrf()
- 49 vrf, rd = None, None
- 50 vrf_block = defaultdict(list)
- 51 block = None
- 52 tab = 100
- Variables:
- self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
- kwargs = {}
- vpns = []
- ------------------------------------------------------------------------
- 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_mpls_vpn.Script object at 0x7fc7dc1325d0>
- m = u'C'
- fallback_handler = None
- cli_handler =
- <bound method Script.execute_cli of <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>>
- handler =
- <bound method Script.execute_cli of <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>>
- kwargs = {}
- snmp_handler =
- <bound method Script.execute_snmp of <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>>
- access_preference = u'CS*'
- ------------------------------------------------------------------------
- File: core/script/base.py (Line: 385)
- Function: execute
- 378 # Raise error
- 379 raise self.NotSupportedError()
- 380 else:
- 381 # New SNMP/CLI API
- 382 return self.call_method(
- 383 cli_handler=self.execute_cli,
- 384 snmp_handler=self.execute_snmp,
- 385 ==> **kwargs
- 386 )
- 387
- 388 def call_method(self, cli_handler=None, snmp_handler=None,
- 389 fallback_handler=None, **kwargs):
- 390 """
- 391 Call function depending on access_preference
- Variables:
- self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
- kwargs = {}
- ------------------------------------------------------------------------
- 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_mpls_vpn.Script object at 0x7fc7dc1325d0>
- ------------------------------------------------------------------------
- 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 0x7fc7dc132590>
- script = u'Cisco.IOS.get_mpls_vpn'
- script_class = <class 'noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script'>
- self = <__main__.Command object at 0x7fc7e4a803d0>
- 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'xxxxx',
- '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_mpls_vpn.Script object at 0x7fc7dc1325d0>
- ------------------------------------------------------------------------
- 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_mpls_vpn'],
- 'use_snmp': True,
- 'yaml': False}
- argv = ['--debug', '--pretty', 'get_mpls_vpn', 'sw3850']
- self = <__main__.Command object at 0x7fc7e4a803d0>
- show_metrics = False
- options =
- Namespace(access_preference=None, arguments=[], beef=None, object_name=['sw3850'], pretty=True, script=['get_mpls_vpn'], use_snmp=True, yaml=False)
- ------------------------------------------------------------------------
- END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement