Skip to main content

I am looking for for BGP protocol which will show below details:

 

device name

NeighborAddress

outbound Interface description

peerDeviceName

 peerVrf

peer outbound Interface description

sessionState: neighbor.sessionState

peerType (Internal/External)

 

The one I created, but its not loading:

 

import "@fwd/L3/Interface Utilities"; //getL3Interfaces(device: Device)

 

getPeerInfo(neighbor, sourceRouterId) =

  max(foreach device in network.devices

      where device.name == neighbor.peerDeviceName

      let l3IfaceList = getL3Interfaces(device)

      foreach networkInstance in device.networkInstances

      foreach protocol in networkInstance.protocols

      where isPresent(protocol.bgp)

      let bgp = protocol.bgp

      foreach neighbor in bgp.neighbors

      where neighbor.peerRouterId == sourceRouterId

      let outIface = max(foreach l3Iface in l3IfaceList

                         foreach address in l3Iface.ipv4.addresses

                         where neighbor.neighborAddress in

                               ipSubnet(address.ip, address.prefixLength)

                         select l3Iface)

      select outIface);

 

foreach device in network.devices

let l3IfaceList = getL3Interfaces(device)

  foreach networkInstance in device.networkInstances

  foreach protocol in networkInstance.protocols

  where isPresent(protocol.bgp)

  let bgp = protocol.bgp

  foreach neighbor in bgp.neighbors

  where neighbor.enabled //

where isPresent(neighbor.sessionState)//

  let peerInfo = getPeerInfo(neighbor, bgp.routerId)

  let outIface = max(foreach l3Iface in l3IfaceList

                     foreach address in l3Iface.ipv4.addresses

                     where neighbor.neighborAddress in

                           ipSubnet(address.ip, address.prefixLength)

                     select l3Iface)

                               

select {

    "device name": device.name,

    networkInstanceName: networkInstance.name,

    neighborNeighborAddress: neighbor.neighborAddress,

    "outbound Interface": outIface?.name,

    peerDeviceName: neighbor.peerDeviceName,

    peerVrf: neighbor.peerVrf,

    peerRouterId: neighbor.peerRouterId,

    "peer outbound Interface": peerInfo?.name,

    sessionState: neighbor.sessionState,

    enabled: neighbor.enabled,

    description: neighbor.description,

    peerAS: neighbor.peerAS,

    localAS: bgp.asNumber,

    peerType: neighbor.peerType

  }

Be the first to reply!

Reply