napalm-automation / napalm-junos

Apache License 2.0
22 stars 42 forks source link

Error with "get_bgp_neighbors_detail' #178

Closed bdlamprecht closed 7 years ago

bdlamprecht commented 7 years ago

Description of Issue/Question

This is related to Issue #177.

When running the NAPALM getter 'get_bgp_neighbors_detail()' I get a TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType' error.

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

[X] Yes [ ] No

Setup

napalm-junos version

(Paste verbatim output from pip freeze | grep napalm-junos between quotes below)

$ pip list | grep napalm-junos
napalm-junos      0.10.3

JunOS version

(Paste verbatim output from show version and haiku between quotes below)

bl839s@pok-vsc-b> show version and haiku
Hostname: pok-vsc-b
Model: mx480
Junos: 14.2R6.5
JUNOS Base OS boot [14.2R6.5]
JUNOS Base OS Software Suite [14.2R6.5]
JUNOS platform Software Suite [14.2R6.5]
JUNOS Web Management [14.2R6.5]
JUNOS Runtime Software Suite [14.2R6.5]
JUNOS Online Documentation [14.2R6.5]
JUNOS Services AACL Container package [14.2R6.5]
JUNOS Services Application Level Gateways [14.2R6.5]
JUNOS AppId Services [14.2R6.5]
JUNOS Services Captive Portal and Content Delivery Container package [14.2R6.5]
JUNOS Border Gateway Function package [14.2R6.5]
JUNOS Services HTTP Content Management package [14.2R6.5]
JUNOS IDP Services [14.2R6.5]
JUNOS Services LL-PDF Container package [14.2R6.5]
JUNOS Services Jflow Container package [14.2R6.5]
JUNOS Services MobileNext Software package [14.2R6.5]
JUNOS Services Mobile Subscriber Service Container package [14.2R6.5]
JUNOS Services NAT [14.2R6.5]
JUNOS Services RPM [14.2R6.5]
JUNOS Services PTSP Container package [14.2R6.5]
JUNOS Services Stateful Firewall [14.2R6.5]
JUNOS Voice Services Container package [14.2R6.5]
JUNOS Macsec Software Suite [14.2R6.5]
JUNOS Services Crypto [14.2R6.5]
JUNOS Services SSL [14.2R6.5]
JUNOS Services IPSec [14.2R6.5]
JUNOS py-base-i386 [14.2R6.5]
JUNOS Kernel Software Suite [14.2R6.5]
JUNOS Crypto Software Suite [14.2R6.5]
JUNOS Packet Forwarding Engine Support (M/T/EX Common) [14.2R6.5]
JUNOS Packet Forwarding Engine Support (MX Common) [14.2R6.5]
JUNOS Routing Software Suite [14.2R6.5]

        Holiday spirit
        Christmas comes but once a year
        Keep it shining bright

Steps to Reproduce the Issue

Run the following code:

#!/usr/bin/env python

from getpass import getpass
from pprint import pprint as pp

from napalm_base import get_network_driver

hostname = 'pok-vsc-b'
username = 'ansible'
optional_args = {}
password = getpass()

driver = get_network_driver('junos')
device = driver(hostname, username, password, optional_args=optional_args)

print(">>>Test device open")
device.open()

print(">>>Test get facts")
output = device.get_bgp_neighbors_detail()
pp(output)

Error Traceback

Provides the following error:

>>>Test device open
>>>Test get facts
Traceback (most recent call last):
  File "./testing_junos_bgp_neighbors.py", line 20, in <module>
    output = device.get_bgp_neighbors_detail()
  File "/home/bl839s/.virtualenvs/napalm/local/lib/python2.7/site-packages/napalm_junos/junos.py", line 1011, in get_bgp_neighbors_detail
    _bgp_iter_core(neighbor_data, instance=instance)
  File "/home/bl839s/.virtualenvs/napalm/local/lib/python2.7/site-packages/napalm_junos/junos.py", line 995, in _bgp_iter_core
    neighbor_rib_details[elem[0]] += elem[1]
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'
mirceaulinic commented 7 years ago

Closed via https://github.com/napalm-automation/napalm-junos/commit/04ec8ba9c229530d694440be67cae52b54932f8b