Skip to main content
Question

Nqe query for BGP Admin status id down

  • 3 September 2024
  • 3 replies
  • 31 views

Hi All,

 

Can you please help me to write a NQE query for all ip details where BGP Admin status  id is showing down.

Something like this with a filter?
 

/**
* @intent Find all devices where BGP peering is enabled and session is not established state
*/


foreach device in network.devices
foreach networkInstance in device.networkInstances
foreach protocol in networkInstance.protocols
where isPresent(protocol.bgp)
let bgp = protocol.bgp
foreach neighbor in bgp.neighbors
where isPresent(neighbor.sessionState)
where neighbor.enabled
where neighbor.sessionState != BgpSessionState.ESTABLISHED
select {
deviceName: device.name,
networkInstanceName: networkInstance.name,
protocolIdentifier: protocol.identifier,
neighborNeighborAddress: neighbor.neighborAddress,
sessionState: neighbor.sessionState,
enabled: neighbor.enabled
}

 


@RobertWelch ,

 

Can you please confirm the above query is able to pull the bgp admin status ?


@Nand - Has the Source / Device been modeled?  NQEs run against the data gathered (configuration, state and normalized data such as BGP).  NQEs do not issue commands directly to the end devices.  Thus, if the Source / Device has been modeled, you can create BGQ NQEs such as this as well as use many of the Predefined BGP NQEs and those in the NQE Library.  For example, in the Predefined, there is a report for BGP peer status and triggers a pass / fail that you can then be notified upon. 

BGPs is one of the wonderful normalized states whereby one does not have to parse the syntax for the various platforms.  


Reply