Advertisement
Izya12

Cisco-3850-mpls_vpn

May 1st, 2018
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 16.60 KB | None | 0 0
  1. root@Node1:/opt/noc# ./noc script --debug --pretty get_mpls_vpn "sw3850"
  2. 2018-05-01 11:19:42,474 [noc.core.dcs.base] Resolve near service postgres
  3. 2018-05-01 11:19:42,474 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/postgres?passing=1&near=_agent
  4. 2018-05-01 11:19:42,477 [noc.core.http.client] HTTP Response 200
  5. 2018-05-01 11:19:42,477 [noc.core.dcs.base] Resolved near service postgres to ['10.220.21.122:5432']
  6. 2018-05-01 11:19:43,334 [noc.core.dcs.base] Running resolver for service mongo
  7. 2018-05-01 11:19:43,335 [noc.core.dcs.base] [mongo] Starting resolver
  8. 2018-05-01 11:19:43,335 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?passing=1
  9. 2018-05-01 11:19:43,336 [noc.core.http.client] HTTP Response 200
  10. 2018-05-01 11:19:43,337 [noc.core.dcs.base] [mongo] Set active services to: mongo: 10.220.21.122:27017
  11. 2018-05-01 11:19:43,337 [noc.core.http.client] HTTP GET http://consul:8500/v1/health/service/mongo?index=2342965&passing=1
  12. 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': '********'}
  13. 2018-05-01 11:19:43,393 [noc.core.cache.base] Using cache backend: noc.core.cache.mongo.MongoCache
  14. 2018-05-01 11:19:43,454 [noc.main.models.doccategory] Registering Capability
  15. 2018-05-01 11:19:43,455 [noc.main.models.doccategory] Registering MetricType
  16. 2018-05-01 11:19:43,488 [noc.main.models.doccategory] Registering ConnectionType
  17. 2018-05-01 11:19:43,491 [noc.main.models.doccategory] Registering ObjectModel
  18. 2018-05-01 11:19:43,502 [noc.main.models.textindex] Adding FTS index for sa.managedobject
  19. 2018-05-01 11:19:43,517 [noc.main.models.textindex] Adding FTS index for ip.vrf
  20. 2018-05-01 11:19:43,519 [noc.main.models.textindex] Adding FTS index for vc.vc
  21. 2018-05-01 11:19:43,521 [noc.main.models.textindex] Adding FTS index for ip.prefix
  22. 2018-05-01 11:19:43,526 [noc.main.models.textindex] Adding FTS index for ip.address
  23. 2018-05-01 11:19:43,573 [noc.core.script.loader] Loading script Cisco.IOS.get_mpls_vpn
  24. 2018-05-01 11:19:43,594 [noc.core.profile.loader] Loading profile Cisco.IOS
  25. 2018-05-01 11:19:43,595 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] Running. Input arguments: {}, timeout 3600
  26. 2018-05-01 11:19:43,595 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] Open telnet CLI
  27. 2018-05-01 11:19:43,597 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Setup session
  28. 2018-05-01 11:19:43,597 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] Disable paging
  29. 2018-05-01 11:19:43,597 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Creating IOLoop
  30. 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)
  31. 2018-05-01 11:19:43,600 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Connection refused
  32. 2018-05-01 11:19:43,600 [script] [Cisco.IOS.get_mpls_vpn|10.220.20.100] [telnet] Closing IOLoop
  33. 2018-05-01 11:19:43,778 [noc.core.debug] UNHANDLED EXCEPTION (2018-05-01 11:19:43.609932)
  34. PROCESS: ./commands/script.py
  35. VERSION: 15.05.1+microservices.9559.0ce3c50f
  36. BRANCH: microservices CHANGESET: 0ce3c50f
  37. ERROR FINGERPRINT: ec2ee0cd-9c68-51fc-b692-1f5faa5df5d4
  38. WORKING DIRECTORY: /opt/noc
  39. EXCEPTION: <class 'noc.core.script.cli.error.CLIConnectionRefused'> Connection refused
  40. START OF TRACEBACK
  41. ------------------------------------------------------------------------
  42. File: core/script/cli/base.py (Line: 179)
  43. Function: execute
  44.   172                 parser = self.read_until_prompt
  45.   173             with Span(server=self.script.credentials.get("address"),
  46.   174                       service=self.name, in_label=cmd) as s:
  47.   175                 self.ioloop.run_sync(functools.partial(self.submit, parser))
  48.   176                 if self.error:
  49.   177                     if s:
  50.   178                         s.error_text = str(self.error)
  51.   179 ==>                 raise self.error
  52.   180                 else:
  53.   181                     return self.result
  54.   182
  55.   183         @tornado.gen.coroutine
  56.   184         def submit(self, parser=None):
  57.   185             # Create iostream and connect, when necessary
  58. Variables:
  59.                  cmd = 'terminal length 0\n'
  60.           obj_parser = None
  61.                 self = <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc7dc132ed0>
  62.               parser =
  63. <bound method TelnetCLI.read_until_prompt of <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc7dc132ed0>>
  64.             cmd_stop = None
  65.             cmd_next = None
  66.                    s = <noc.core.span.Span object at 0x7fc7dc0ded10>
  67.        ignore_errors = True
  68. ------------------------------------------------------------------------
  69. File: core/script/base.py (Line: 768)
  70. Function: cli
  71.   761                 if r is not None:
  72.   762                     self.logger.debug("Use cached result")
  73.   763                     return format_result(r)
  74.   764             command_submit = command_submit or self.profile.command_submit
  75.   765             stream = self.get_cli_stream()
  76.   766             r = stream.execute(cmd + command_submit, obj_parser=obj_parser,
  77.   767                                cmd_next=cmd_next, cmd_stop=cmd_stop,
  78.   768 ==>                            ignore_errors=ignore_errors)
  79.   769             if isinstance(r, six.string_types):
  80.   770                 if self.beef:
  81.   771                     self.beef.set_cli(cmd, r)
  82.   772                 # Check for syntax errors
  83.   773                 if not ignore_errors:
  84.   774                     # Then check for operation error
  85. Variables:
  86.       command_submit = '\n'
  87.        format_result = <function format_result at 0x7fc7dc0ea848>
  88.               nowait = False
  89.               stream = <noc.core.script.cli.telnet.TelnetCLI object at 0x7fc7dc132ed0>
  90.               cached = False
  91.           obj_parser = None
  92.           bulk_lines = None
  93.                  cmd = 'terminal length 0'
  94.             cmd_stop = None
  95.             cmd_next = None
  96.                 file = None
  97.              list_re = None
  98.        ignore_errors = True
  99.                 self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  100. ------------------------------------------------------------------------
  101. File: core/script/base.py (Line: 830)
  102. Function: get_cli_stream
  103.   823                 # @todo: Move to CLI
  104.   824                 if self.to_disable_pager:
  105.   825                     self.logger.debug("Disable paging")
  106.   826                     self.to_disable_pager = False
  107.   827                     if isinstance(self.profile.command_disable_pager, six.string_types):
  108.   828                         self.cli(
  109.   829                             self.profile.command_disable_pager,
  110.   830 ==>                         ignore_errors=True
  111.   831                         )
  112.   832                     elif isinstance(self.profile.command_disable_pager, list):
  113.   833                         for cmd in self.profile.command_disable_pager:
  114.   834                             self.cli(cmd, ignore_errors=True)
  115.   835                     else:
  116.   836                         raise UnexpectedResultError
  117. Variables:
  118.                 self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  119.             protocol = 'telnet'
  120. ------------------------------------------------------------------------
  121. File: core/script/base.py (Line: 765)
  122. Function: cli
  123.   758                     return format_result(f.read())
  124.   759             if cached:
  125.   760                 r = self.root.cli_cache.get(cmd)
  126.   761                 if r is not None:
  127.   762                     self.logger.debug("Use cached result")
  128.   763                     return format_result(r)
  129.   764             command_submit = command_submit or self.profile.command_submit
  130.   765 ==>         stream = self.get_cli_stream()
  131.   766             r = stream.execute(cmd + command_submit, obj_parser=obj_parser,
  132.   767                                cmd_next=cmd_next, cmd_stop=cmd_stop,
  133.   768                                ignore_errors=ignore_errors)
  134.   769             if isinstance(r, six.string_types):
  135.   770                 if self.beef:
  136.   771                     self.beef.set_cli(cmd, r)
  137. Variables:
  138.       command_submit = '\n'
  139.        format_result = <function format_result at 0x7fc7dc0c5758>
  140.               nowait = False
  141.               cached = False
  142.           obj_parser = None
  143.           bulk_lines = None
  144.                  cmd = 'show ip vrf detail'
  145.             cmd_stop = None
  146.             cmd_next = None
  147.                 file = None
  148.              list_re = None
  149.        ignore_errors = False
  150.                 self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  151. ------------------------------------------------------------------------
  152. File: sa/profiles/Cisco/IOS/get_mpls_vpn.py (Line: 46)
  153. Function: execute_cli
  154.    39                 return self.portchannel_members[iface]
  155.    40             else:
  156.    41                 return []
  157.    42
  158.    43         def execute_cli(self, **kwargs):
  159.    44             vpns = []
  160.    45             try:
  161.    46 ==>             v = self.cli("show ip vrf detail")
  162.    47             except self.CLISyntaxError:
  163.    48                 return self.execute_vrf()
  164.    49             vrf, rd = None, None
  165.    50             vrf_block = defaultdict(list)
  166.    51             block = None
  167.    52             tab = 100
  168. Variables:
  169.                 self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  170.               kwargs = {}
  171.                 vpns = []
  172. ------------------------------------------------------------------------
  173. File: core/script/base.py (Line: 422)
  174. Function: call_method
  175.   415                 if isinstance(handler, six.string_types):
  176.   416                     handler = getattr(self, handler, None)
  177.   417                 if handler is None:
  178.   418                     self.logger.debug("No '%s' handler. Passing to next method" % m)
  179.   419                     continue
  180.   420                 # Call handler
  181.   421                 try:
  182.   422 ==>                 r = handler(**kwargs)
  183.   423                     if isinstance(r, PartialResult):
  184.   424                         if self.partial_result:
  185.   425                             self.partial_result.update(r.result)
  186.   426                         else:
  187.   427                             self.partial_result = r.result
  188.   428                         self.logger.debug("Partial result: %r. Passing to next method", self.partial_result)
  189. Variables:
  190.                 self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  191.                    m = u'C'
  192.     fallback_handler = None
  193.          cli_handler =
  194. <bound method Script.execute_cli of <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>>
  195.              handler =
  196. <bound method Script.execute_cli of <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>>
  197.               kwargs = {}
  198.         snmp_handler =
  199. <bound method Script.execute_snmp of <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>>
  200.    access_preference = u'CS*'
  201. ------------------------------------------------------------------------
  202. File: core/script/base.py (Line: 385)
  203. Function: execute
  204.   378                     # Raise error
  205.   379                 raise self.NotSupportedError()
  206.   380             else:
  207.   381                 # New SNMP/CLI API
  208.   382                 return self.call_method(
  209.   383                     cli_handler=self.execute_cli,
  210.   384                     snmp_handler=self.execute_snmp,
  211.   385 ==>                 **kwargs
  212.   386                 )
  213.   387
  214.   388         def call_method(self, cli_handler=None, snmp_handler=None,
  215.   389                         fallback_handler=None, **kwargs):
  216.   390             """
  217.  391             Call function depending on access_preference
  218. Variables:
  219.                self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  220.              kwargs = {}
  221. ------------------------------------------------------------------------
  222. File: core/script/base.py (Line: 247)
  223. Function: run
  224.  240                         self.logger.info("Using cached result")
  225.  241                         cache_hit = True
  226.  242                     except KeyError:
  227.  243                         pass
  228.  244                 # Execute script
  229.  245                 if not cache_hit:
  230.  246                     try:
  231.  247 ==>                     result = self.execute(**self.args)
  232.  248                         if self.cache and self.parent and result:
  233.  249                             self.logger.info("Caching result")
  234.  250                             self.set_cache(self.name, self.args, result)
  235.  251                     finally:
  236.  252                         if not self.parent:
  237.  253                             # Close SNMP socket when necessary
  238. Variables:
  239.           cache_hit = False
  240.                self = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  241. ------------------------------------------------------------------------
  242. File: commands/script.py (Line: 118)
  243. Function: handle
  244.  111                 capabilities=caps,
  245.  112                 args=args,
  246.  113                 version=version,
  247.  114                 timeout=3600,
  248.  115                 name=script,
  249.  116                 collect_beef=bool(beef)
  250.  117             )
  251.  118 ==>         result = scr.run()
  252.  119             if pretty:
  253.  120                 pprint.pprint(result)
  254.  121             elif yaml:
  255.  122                 import yaml
  256.  123                 import sys
  257.  124                 yaml.dump(result, sys.stdout)
  258. Variables:
  259.                 obj = <ManagedObject: sw3850>
  260.                beef = None
  261.             service = <__main__.ServiceStub object at 0x7fc7dc132590>
  262.              script = u'Cisco.IOS.get_mpls_vpn'
  263.        script_class = <class 'noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script'>
  264.                self = <__main__.Command object at 0x7fc7e4a803d0>
  265.                args = {}
  266.            use_snmp = True
  267.                caps =
  268. {u'Cisco | IOS | Syntax | IP SLA': 0,
  269. u'DB | Interfaces': 75,
  270. u'Network | CDP': True,
  271. u'Network | IPv6': True,
  272. u'Network | LACP': True,
  273. u'Network | OAM': True,
  274. u'Network | STP': True,
  275. u'SNMP': True,
  276. u'SNMP | Bulk': True,
  277. u'SNMP | IF-MIB': True,
  278. u'SNMP | IF-MIB | HC': True,
  279. u'SNMP | v1': True,
  280. u'SNMP | v2c': True,
  281. u'SNMP | v3': False}
  282.                yaml = False
  283.         object_name = ['sw3850']
  284.             version = None
  285.           arguments = []
  286.              pretty = True
  287.         credentials =
  288. {'access_preference': u'CS',
  289. 'address': u'10.220.20.100',
  290. 'cli_protocol': 'telnet',
  291. 'password': u'xxxxx',
  292. 'path': None,
  293. 'raise_privileges': True,
  294. 'snmp_ro': u'xxxxxx',
  295. 'snmp_version': 'v2c',
  296. 'super_password': u'cisco',
  297. 'user': u'noc'}
  298.   access_preference = None
  299.             options = {}
  300.                 scr = <noc.sa.profiles.Cisco.IOS.get_mpls_vpn.Script object at 0x7fc7dc1325d0>
  301. ------------------------------------------------------------------------
  302. File: core/management/base.py (Line: 76)
  303. Function: run_from_argv
  304.   69             enable_profiling = cmd_options.pop("enable_profiling", False)
  305.   70             show_metrics = cmd_options.pop("show_metrics", False)
  306.   71             if enable_profiling:
  307.   72                 # Start profiler
  308.   73                 import yappi
  309.   74                 yappi.start()
  310.   75             try:
  311.   76 ==>             return self.handle(*args, **cmd_options) or 0
  312.   77             except CommandError as e:
  313.   78                 self.print(str(e))
  314.   79                 return 1
  315.   80             except KeyboardInterrupt:
  316.   81                 self.print("Ctrl+C")
  317.   82                 return 3
  318. Variables:
  319.              parser =
  320. ArgumentParser(prog='script.py', usage=None, description=None, version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
  321.            loglevel = 'debug'
  322.    enable_profiling = False
  323.                args = ()
  324.         cmd_options =
  325. {'access_preference': None,
  326. 'arguments': [],
  327. 'beef': None,
  328. 'object_name': ['sw3850'],
  329. 'pretty': True,
  330. 'script': ['get_mpls_vpn'],
  331. 'use_snmp': True,
  332. 'yaml': False}
  333.                argv = ['--debug', '--pretty', 'get_mpls_vpn', 'sw3850']
  334.                self = <__main__.Command object at 0x7fc7e4a803d0>
  335.        show_metrics = False
  336.             options =
  337. Namespace(access_preference=None, arguments=[], beef=None, object_name=['sw3850'], pretty=True, script=['get_mpls_vpn'], use_snmp=True, yaml=False)
  338. ------------------------------------------------------------------------
  339. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement