Automation

Expand all | Collapse all

PyEZ OspfNeighborTable how to specify instance='all'

Jump to Best Answer
  • 1.  PyEZ OspfNeighborTable how to specify instance='all'

    Posted 07-18-2018 03:04
    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?



  • 2.  RE: PyEZ OspfNeighborTable how to specify instance='all'

    Posted 07-18-2018 03:20

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



  • 3.  RE: PyEZ OspfNeighborTable how to specify instance='all'

    Posted 07-18-2018 03:24

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



  • 4.  RE: PyEZ OspfNeighborTable how to specify instance='all'
    Best Answer

     
    Posted 07-18-2018 19:20

    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-defining.html

     

    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