I am trying to get the BGP advertised and received prefixes for Arista EOS and Cisco NXOA devices. I tried the below two queries and they only work for IOS and IOS-XE. devices
BGP Received routes -
---------------------------------------------------------
foreach device in network.devices
// where device.name == "jcdwans01"
where isPresent(device.bgpRib)
let bgpRib = device.bgpRib
foreach afiSafi in bgpRib.afiSafis
foreach neighbor in afiSafi.neighbors
where isPresent(neighbor.adjRibInPost)
let adjRibInPost = neighbor.adjRibInPost
select {
deviceName: device.name,
platform: device.platform.os,
afiSafiAfiSafiName: afiSafi.afiSafiName,
neighborNeighborAddress: neighbor.neighborAddress,
routesCount: length(adjRibInPost.routes)
}
BGP advertised routes -
foreach device in network.devices
where isPresent(device.bgpRib)
let bgpRib = device.bgpRib
foreach afiSafi in bgpRib.afiSafis
foreach neighbor in afiSafi.neighbors
where isPresent(neighbor.adjRibOutPost)
let adjRibOutPost = neighbor.adjRibOutPost
foreach route in adjRibOutPost.routes
select {
deviceName: device.name,
platform: device.platform.os,
afiSafiAfiSafiName: afiSafi.afiSafiName,
neighborNeighborAddress: neighbor.neighborAddress,
routesCount: length(adjRibOutPost.routes)
}