Unable to gather address families from BGP configuration using tables&views
When traversing back in the tree using the PyEZ tables and views for configuration it is unable to gather the address family information at the group level.
This works. The families evaluate correctly.
BgpNeighborTable:
get: protocols/bgp/group
view: BgpNeighborView
BgpNeighborView:
fields:
groupName: name
groupFamilies: family
groupFamilyInet: family/inet/any
groupFamilyInetVPN: family/inet/any
groupFamilyInet6: family/inet6/any
groupCluster: cluster
neighborName: neighbor/name
neighborDescription: neighbor/description
neighborImport: neighbor/import
neighborExport: neighbor/export
This does not work. All that is returned for any of the address families is None. Both the groupCluster and groupName return the values properly using this method.
---
BgpNeighborTable:
get: protocols/bgp/group/neighbor
view: BgpNeighborView
BgpNeighborView:
fields:
groupName: ../name
groupFamilies: ../family
groupFamilyInet: ../family/inet/any
groupFamilyInetVPN: ../family/inet/any
groupFamilyInet6: ../family/inet6/any
groupCluster: ../cluster
neighborName: name
neighborDescription: description
neighborImport: import
neighborExport: export
Adding logs for reference:
Using get: protocols/bgp/group
{'external-peers': {'groupFamilies': 'family',
'groupFamilyInet': 'any',
'groupName': 'external-peers',
'neighborName': ['10.10.10.2',
'10.10.10.6',
'10.10.10.10',
'10.21.7.2']}}
Using get: protocols/bgp/group/neighbor
groupFamilyInet and groupFamilies are set to None, which was not the case using earlier table.
{'10.10.10.10': {'groupFamilies': None,
'groupFamilyInet': None,
'groupName': 'external-peers',
'neighborName': '10.10.10.10'},
'10.10.10.2': {'groupFamilies': None,
'groupFamilyInet': None,
'groupName': 'external-peers',
'neighborName': '10.10.10.2'},
'10.10.10.6': {'groupFamilies': None,
'groupFamilyInet': None,
'groupName': 'external-peers',
'neighborName': '10.10.10.6'},
'10.21.7.2': {'groupFamilies': None,
'groupFamilyInet': None,
'groupName': 'external-peers',
'neighborName': '10.21.7.2'}}
@jhay317a When you use get: protocols/bgp/group/neighbor it doesn't return the details about groupFamilies or groupFamilyInet. So, the alternative is to use get: protocols/bgp/group and use key option get the result in the desired format.
@vnitinv I tried it out, but it resulted in some confusing results. It returns the following output. Please note it only prints 1 entry instead of all 4 entries.
Table view:
BgpNeighborTable:
get: protocols/bgp/group
key: neighbor/name
view: BgpNeighborView
BgpNeighborView:
fields:
groupName: name
groupFamilies: family
groupFamilyInet: family/inet/any
Output:
{'10.10.10.2': {'groupFamilies': 'family',
'groupFamilyInet': 'any',
'groupName': 'external-peers'}}