napalm-automation / napalm

Network Automation and Programmability Abstraction Layer with Multivendor support
Apache License 2.0
2.25k stars 555 forks source link

get_bgp_neighbors on IOSXE doesn't work for IPv4 VRF address families (VPNv4) #1038

Closed sjhloco closed 4 years ago

sjhloco commented 5 years ago

Description of Issue/Question

get_bgp_neighbors doesnt seem to work on IOSXE for BGP neighbors in a VRF as isn't able to pick up the peers. If I try with neighbors in the default IPv4 address-family it works fine.

Is this meant to work, haven't been able to find information in the documentation about it. From the cmds NAPALM runs neighbors are seen in "show bgp all summary" but not in "show bgp ipv4 unicast neighbors" so wasn't sure if what I am seeing is a limitation and the expected outcome.

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

(Place an x between the square brackets where applicable)

Setup

napalm version

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

napalm==2.4.0
napalm-ansible==1.0.0

Network operating system version

(Paste verbatim output from show version - or equivalent - between quotes below)

DC1-CSR-XNET1#show version
Cisco IOS XE Software, Version 16.06.02
Cisco IOS Software [Everest], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.6.2, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2017 by Cisco Systems, Inc.
Compiled Wed 01-Nov-17 07:24 by mcpre

DC1-CSR-XNET1#show run | sec bgp
router bgp 65002
 template peer-policy BGP_PEER_ALL
  soft-reconfiguration inbound
  send-community both
 exit-peer-policy
 !
 template peer-session BGP_SESS_ALL
  timers 3 9
 exit-peer-session
 !
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 66111
 !
 address-family ipv4 vrf GTT
  network 201.76.1.144 mask 255.255.255.240
  neighbor 172.16.101.2 remote-as 901
  neighbor 172.16.101.2 inherit peer-session BGP_SESS_ALL
  neighbor 172.16.101.2 activate
  neighbor 172.16.101.2 inherit peer-policy BGP_PEER_ALL
  neighbor 172.16.101.2 route-map IN_FROM_PROVIDER in
  neighbor 172.16.101.2 route-map OUT_TO_PROVIDER out
  neighbor 192.168.12.10 remote-as 65001
  neighbor 192.168.12.10 inherit peer-session BGP_SESS_ALL
  neighbor 192.168.12.10 ebgp-multihop 2
  neighbor 192.168.12.10 activate
  neighbor 192.168.12.10 inherit peer-policy BGP_PEER_ALL
  neighbor 192.168.12.10 route-map IN_FROM_LAN in
  neighbor 192.168.12.10 route-map OUT_TO_LAN out
 exit-address-family
 !
 address-family ipv4 vrf MS
  bgp router-id 172.16.201.1
  neighbor 172.16.201.2 remote-as 12076
  neighbor 172.16.201.2 inherit peer-session BGP_SESS_ALL
  neighbor 172.16.201.2 activate
  neighbor 172.16.201.2 inherit peer-policy BGP_PEER_ALL
  neighbor 172.16.201.2 route-map IN_FROM_MS in
  neighbor 172.16.201.2 route-map OUT_TO_MS out
  neighbor 192.168.12.6 remote-as 65001
  neighbor 192.168.12.6 inherit peer-session BGP_SESS_ALL
  neighbor 192.168.12.6 activate
  neighbor 192.168.12.6 inherit peer-policy BGP_PEER_ALL
  neighbor 192.168.12.6 route-map MS_IN_FROM_LAN in
  neighbor 192.168.12.6 route-map MS_OUT_TO_LAN out
 exit-address-family
ip bgp-community new-format

Steps to Reproduce the Issue

Any BGP configuration with neighbors in different VRF address families. I haven't tried with a different version of code yet, just wanted to make sure that this is meant to be supported first.

Error Traceback

(Paste the complete traceback of the exception between quotes below)

In [1]: from napalm import get_network_driver
   ...: driver1 = get_network_driver('ios')
   ...: device1 = driver1('10.10.108.17', 'admin', 'ansible')
   ...: device1.open()

In [2]: device1.get_bgp_neighbors()
Out[2]:
{'global': {'router_id': '10.10.108.17',
  'peers': {'1.1.1.1': {'local_as': 65002,
    'remote_as': 66111,
    'remote_id': '0.0.0.0',
    'is_up': False,
    'is_enabled': True,
    'description': '',
    'uptime': -1,
    'address_family': {'ipv4': {'received_prefixes': -1,
      'accepted_prefixes': -1,
      'sent_prefixes': -1}}}}}}

In [3]:

DC1-CSR-XNET1#show bgp all summary 
For address family: IPv4 Unicast
BGP router identifier 10.10.108.17, local AS number 65002
BGP table version is 1, main routing table version 1

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4        66111       0       0        1    0    0 never    Idle

For address family: VPNv4 Unicast
BGP router identifier 10.10.108.17, local AS number 65002
BGP table version is 6, main routing table version 6
5 network entries using 1280 bytes of memory
5 path entries using 680 bytes of memory
3/3 BGP path/bestpath attribute entries using 888 bytes of memory
2 BGP AS-PATH entries using 48 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 2896 total bytes of memory
BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
172.16.101.2    4          901     475     482        6    0    0 00:24:30        1
172.16.201.2    4        12076     475     481        6    0    0 00:24:30        3
192.168.12.6    4        65001     491     481        6    0    0 00:24:28        0
192.168.12.10   4        65001     471     463        6    0    0 00:23:28        0
pehruby commented 5 years ago

Have you tried version 2.5.0 ?

sjhloco commented 4 years ago

Sorry only just got round to testing, yeah is working fine with 2.5.0, thanks