How to extract BGP configuration of specific group?

243 views Asked by At

How to extract junos mx bgp configuration of specific group using pyez configuration tables?

i have tried using the following table/view:

BGPConfigTable:
  get: groups/protocols/bgp/group/neighbor
  view: BgpconfigView

BgpconfigView:
  fields:
    description: description
    group: { name : group }
    peer: name
    asn: peer-as

but when i run dev.get(group=my_group) it retrieves bgp configuration from all groups.

i would expect to get only bgp configuration under 'my_group' group.

1

There are 1 answers

0
tahoe On

Have you tried:

from jnpr.junos.op.bgp import bgpTable

... create your dev ...

cr = bgpTable
result = cr.get()[0](dev)
print(result.to_json())

I am not a network engineer and only started learning about PyEZ because I'm the Python guy at work... So this might not be what you want, but it does spit out neighbor information when I specify one...