napalm-automation / napalm-junos

Apache License 2.0
22 stars 42 forks source link

get_facts() junos TypeError #24

Closed stiltzkin10 closed 8 years ago

stiltzkin10 commented 8 years ago

I get a TypeError when I do a get_facts() on a virtual JUNOS router. I included the get_interfaces() call to show that NAPALM is able to talk to the router. It's just that get_facts() fails.

$ python Python 2.7.11+ (default, Apr 17 2016, 14:00:29) [GCC 5.3.1 20160413] on linux2 Type "help", "copyright", "credits" or "license" for more information.

from napalm import get_network_driver driver = get_network_driver('junos') device = driver('10.1.1.99', 'config_pusher', 'xxxxxxxxx') device.open() for i in device.get_interfaces(): ... i ... 'demux0' 'pime' ... 'em0' 'pp0' 'dsc' device.get_facts() Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/napalm_junos/junos.py", line 163, in get_facts 'uptime': string_parsers.convert_uptime_string_seconds(uptime), File "/usr/local/lib/python2.7/dist-packages/napalm_base/utils/string_parsers.py", line 75, in convert_uptime_string_seconds uptime_dict = regex.search(uptime) TypeError: expected string or buffer

NAPALM:

$ pip show napalm

Metadata-Version: 1.1 Name: napalm Version: 1.1.0 Summary: Network Automation and Programmability Abstraction Layer with Multivendor support Home-page: https://github.com/napalm-automation/napalm Author: David Barroso Author-email: dbarrosop@dravetech.com License: UNKNOWN Location: /usr/local/lib/python2.7/dist-packages Requires: napalm-base, napalm-eos, napalm-fortios, napalm-ibm, napalm-ios, napalm-iosxr, napalm-junos, napalm-nxos, napalm-pluribus, napalm-panos Classifiers: Topic :: Utilities Programming Language :: Python Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Operating System :: POSIX :: Linux Operating System :: MacOS

$ uname -a Linux userver 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

JUNOS router: config_pusher@J99> show version Hostname: J99 Model: olive JUNOS Base OS boot [12.1R1.9] JUNOS Base OS Software Suite [12.1R1.9] JUNOS Kernel Software Suite [12.1R1.9] JUNOS Crypto Software Suite [12.1R1.9] JUNOS Packet Forwarding Engine Support (M/T Common) [12.1R1.9] JUNOS Packet Forwarding Engine Support (M20/M40) [12.1R1.9] JUNOS Online Documentation [12.1R1.9] JUNOS Voice Services Container package [12.1R1.9] JUNOS Border Gateway Function package [12.1R1.9] JUNOS Services AACL Container package [12.1R1.9] JUNOS Services LL-PDF Container package [12.1R1.9] JUNOS Services PTSP Container package [12.1R1.9] JUNOS Services Stateful Firewall [12.1R1.9] JUNOS Services NAT [12.1R1.9] JUNOS Services Application Level Gateways [12.1R1.9] JUNOS Services Captive Portal and Content Delivery Container package [12.1R1.9] JUNOS Services RPM [12.1R1.9] JUNOS Services HTTP Content Management package [12.1R1.9] JUNOS AppId Services [12.1R1.9] JUNOS IDP Services [12.1R1.9] JUNOS Services Crypto [12.1R1.9] JUNOS Services SSL [12.1R1.9] JUNOS Services IPSec [12.1R1.9] JUNOS Runtime Software Suite [12.1R1.9] JUNOS Routing Software Suite [12.1R1.9]

mirceaulinic commented 8 years ago

Please execute the following in a console and share the output:

from napalm import get_network_driver
driver = get_network_driver('junos')
device = driver('10.1.1.99', 'config_pusher', 'xxxxxxxxx')
device.open()
print(device.device.facts)
stiltzkin10 commented 8 years ago
from napalm import get_network_driver
driver = get_network_driver('junos')
device = driver('10.1.1.99', 'config_pusher', 'xxxxxx')
device.open()
print(device.device.facts)
{'domain': None, 'serialnumber': '', 'ifd_style': 'CLASSIC', 'version_info': junos.version_info(major=(12, 1), type=R, minor=1, build=9), '2RE': False, 'hostname': 'J99', 'fqdn': 'J99', 'switch_style': 'NONE', 'version': '12.1R1.9', 'HOME': '/var/home/config_pusher', 'model': 'olive', 'vc_capable': False, 'personality': 'UNKNOWN'}