napalm-automation / napalm-base

Apache License 2.0
32 stars 48 forks source link

Incorrect outer key returned for get_bgp_neighbors_detail() #227

Closed jeffgallagher closed 7 years ago

jeffgallagher commented 7 years ago

According to the documentation both get_bgp_neighbors() and get_bgp_neighbors_detail() should: "Returns a dictionary of dictionaries. The keys for the first dictionary will be the vrf (global if no vrf)." However different values seem to be returned for the outer keys of each calls. (i.e. one is the vrf the other the routing instance?)

get_bgp_neighbors_detail() appears to return a dictionary of routing instances and not a dictionary containing the VRF as returned in get_bgp_neighbors(); it would seem that the get_bgp_neighbors_detail method should also return 'global' vrf as outer key. (only default/global VRF configured)

neighbor_facts = device.get_bgp_neighbors()
print("get_bgp_neighbors():")

for vrf in neighbor_facts:
    print("Outer key values: " + vrf)

detail_facts = device.get_bgp_neighbors_detail()
print("get_bgp_neighbors_detail():")

for vrf in detail_facts:
    print("Outer key values: " + vrf)

Results -

Cisco (ASR9010 - 5.3.3):

get_bgp_neighbors():
Outer key values: global
get_bgp_neighbors_detail():
Outer key values: default
JunOS (15.1F5-S4.6)
get_bgp_neighbors():
Outer key values: global
get_bgp_neighbors_detail():
Outer key values: inet6.0
Outer key values: inet.0
Outer key values: inetflow.0
JunOS (12.3R9.4)
get_bgp_neighbors():
Outer key values: global
get_bgp_neighbors_detail():
Outer key values: inet6.0
Outer key values: inet.0
Outer key values: inetflow.0

In examples above outer dict isn't returning the same value for both calls.

mirceaulinic commented 7 years ago

Hi @jeffgallagher - thanks for reporting this.

get_bgp_neighbors_detail is implemented only in napalm-junos, iosxr and eos. So I will close this in the favor of https://github.com/napalm-automation/napalm-junos/issues/139