Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

PyEZ OspfNeighborTable how to specify instance='all'

‎07-18-2018 03:04 AM
def get_ospf_neighbor_status(self, address, instance='master', *args, **kwargs):
        ospf_table = OspfNeighborTable(self._dev)
        ospf_table.get()
        print(ospf_table.items())

I can get ospf_table of master instance, how could I get ospf_table of instalce all?

3 REPLIES 3
Highlighted
Junos Automation (Scripting)

Re: PyEZ OspfNeighborTable how to specify instance='all'

‎07-18-2018 03:20 AM

rpc request get_ospf_neighbor_information(instance="all") should shows you all neighbors in all instances

Highlighted
Junos Automation (Scripting)

Re: PyEZ OspfNeighborTable how to specify instance='all'

‎07-18-2018 03:24 AM

Yes, I had that working. Are you saying that it is not possible to spicify within "OspfNeighborTable"?

Highlighted
Junos Automation (Scripting)
Solution
Accepted by topic author Nexus J. Xi
‎07-18-2018 11:38 PM

Re: PyEZ OspfNeighborTable how to specify instance='all'

‎07-18-2018 07:19 PM

Hi,

 

The builtin OspfNeighborTable does not include the instance argument. You can make your own table/view which uses any arguments that you require.

 

https://www.juniper.net/documentation/en_US/junos-pyez/topics/task/program/junos-pyez-tables-op-defi...

 

This is the builtin table/view that you are calling

 

OspfNeighborTable:
  rpc: get-ospf-neighbor-information
  args:
    extensive: True
  item: ospf-neighbor
  key:
    - interface-name
    - neighbor-id
  view: OspfNeighborView

OspfNeighborView:
  fields:
    neighbor_address: neighbor-address
    interface_name: interface-name
    ospf_neighbor_state: ospf-neighbor-state
    neighbor_id: neighbor-id
    activity_timer: activity-timer
    ospf_area: ospf-area
    dr_address: dr-address
    bdr_address: bdr-address
    neighbor_up_time: neighbor-up-time
    neighbor_adjacency_time: neighbor-adjacency-time

 

Tim