Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAPALM returns two equal IPv6 with get_bgp_neighbors() #659

Closed
gmazoyer opened this issue Feb 24, 2018 · 5 comments
Closed

NAPALM returns two equal IPv6 with get_bgp_neighbors() #659

gmazoyer opened this issue Feb 24, 2018 · 5 comments
Milestone

Comments

@gmazoyer
Copy link

I have found a strange issue on JUNOS and IPv6 BGP neighbors.

When using the get_bgp_neighbors method the inner the dictionary of peers for a given VRF might return two times the same IPv6 address. Here is a minimized output of a result.

            '2001:db8:10:100:0:5:4100:1': {
                'uptime': 738
            },
            '2001:db8:10:100::5:4100:1': {
                'local_as': 64545,
                'remote_as': 64546,
                'remote_id': '',
                'is_up': False,
                'is_enabled': True,
                'description': '',
                'uptime': 0,
                'address_family': {
                    'ipv4': {
                        'received_prefixes': -1,
                        'accepted_prefixes': -1,
                        'sent_prefixes': -1
                    },
                    'ipv6': {
                        'received_prefixes': -1,
                        'accepted_prefixes': -1,
                        'sent_prefixes': -1
                    }
                }
            }

If you take a look this is the same peer but with the address in two different format. The issue may come from JUNOS itself. In fact I've noticed that in the configuration the 2001:db8:10:100::5:4100:1 is used but when showing the BGP summary on the router itself the address is expanded to 2001:db8:10:100:0:5:4100:1.

The expected output would be to have only one peer in the dictionary (address being expanded or not).

gmazoyer added a commit to peering-manager/peering-manager that referenced this issue Feb 24, 2018
It seems that sometimes NAPALM returns BGP peers without giving their
remote autonomous systems. It's probably a bug and an issue has been
created (napalm-automation/napalm#659).

Waiting to see if it is indeed an issue in the JUNOS module of NAPALM a
(temporary) fix is now submitted.

Import peering sessions from router feature is now tested and seems to
be working as expected. Close #8.
@dbarrosop
Copy link
Member

That's unfortunate, I guess we will have to parse the IP with netaddr library to make sure this doesn't happen.

@mirceaulinic mirceaulinic added this to the APPROVED milestone Mar 6, 2018
@KalleDK
Copy link

KalleDK commented Apr 6, 2018

You might want to use the official module instead https://docs.python.org/3/library/ipaddress.html

@ktbyers
Copy link
Contributor

ktbyers commented Apr 6, 2018

Can we just normalize using the ip helper in napalm/base/helpers.py. This helper uses netaddr's IPAddress:

Looks like it should work.

>>> from netaddr import IPAddress
>>> IPAddress("2001:db8:10:100:0:5:4100:1")
IPAddress('2001:db8:10:100:0:5:4100:1')
>>> IPAddress("2001:db8:10:100::5:4100:1")
IPAddress('2001:db8:10:100:0:5:4100:1')

@ckishimo ckishimo mentioned this issue Jul 4, 2018
@ckishimo
Copy link
Contributor

ckishimo commented Jul 4, 2018

#761 should fix it. @respawner are you able to test ? I was not able to reproduce it using Junos 14.1

@gmazoyer
Copy link
Author

gmazoyer commented Jul 5, 2018

@ckishimo it seems to be working with your PR yes. Thank you 👍

mirceaulinic pushed a commit that referenced this issue Jul 21, 2018
* junos: normalize ipv6 address bgp peer in routing-instance

* fix E501 line too long
cspeidel pushed a commit to cspeidel/napalm that referenced this issue Aug 9, 2018
* junos: normalize ipv6 address bgp peer in routing-instance

* fix E501 line too long
ExaneServerTeam pushed a commit to ExaneServerTeam/napalm that referenced this issue Mar 6, 2020
* junos: normalize ipv6 address bgp peer in routing-instance

* fix E501 line too long
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants