py-junos-eznc icon indicating copy to clipboard operation
py-junos-eznc copied to clipboard

Unable to gather address families from BGP configuration using tables&views

Open jhay317a opened this issue 6 years ago • 2 comments

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

jhay317a avatar Jul 23 '19 17:07 jhay317a

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'}}

rsmekala avatar Sep 24 '19 09:09 rsmekala

@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'}}

rsmekala avatar Jan 22 '20 05:01 rsmekala