Hello !
I'm still alive... Let's continue with Arista networking...
In Cloudvision, make a new Dashboard, chose Metrics > AQL > Table
1) Dashboard to display cvtemp password
Sometimes when you install a switch via ZTP, it get stuck in a weird state and the switch is no longer reachable with just "admin / ", but your config is not working either. If your switch was reaching cloudvision at one point, that means you can use the temporary account "cvptemp" to log in into the switch. Here is a CloudVision dashboard that would display switches that registered through ZTP, and match the corresponding "cvptemp" password.
Commands
let data = `cvp:/netElementCredentials/ids/*`
let inventory = `analytics:/DatasetInfo/Devices`
let res = newDict()
let id = 1
for macKey,macPass in data{
res[macKey] = newDict()
res[macKey]["Password"] = merge(macPass)[macKey]
for deviceKey, deviceVal in merge(inventory){
if deviceVal["mac"] == macKey {
res[macKey]["hostname"] = deviceVal["hostname"]
}
}
let id = id +1
}
res
Example output
Then you can ssh into your switch with cvptemp and the password.
2) Dashboard to display all BGP down per VRF
Another dashboard to build in Cloudvision. The goal is to display all BGP connections that are down. I put in a filter for equipment containing "sw" but you can remove this part.
Commands
let devicesInfo = `analytics:/Devices/*/versioned-data/Device`
let devices = newDict()
for deviceSerial, ts_details in devicesInfo {
let device_info = merge(ts_details)
# Filter only device containing sw
if strContains(device_info["hostname"] , "sw"){
devices[deviceSerial] = merge(ts_details)
}
}
let bgp = `analytics:/Devices/*/versioned-data/routing/bgp/status/vrf/*/bgpPeerInfoStatusEntry/*`
let bgp_per_devices = newDict()
for device_serial, device in devices{
if dictHasKey(bgp, device_serial){
bgp_per_devices[device["hostname"]] = bgp[device_serial]
}
}
let bgp_down_per_devices = newDict()
for switch_name, vrf in bgp_per_devices{
for vrf_name, bgp_peers in vrf {
for bgp_peer_ip, ts_bgp_peer in bgp_peers{
let bgp_peer = merge(ts_bgp_peer)
if bgp_peer["bgpState"]["Name"] != "Established"{
# check if the switch name exist
if !dictHasKey(bgp_down_per_devices, switch_name){
bgp_down_per_devices[switch_name] = newDict()
}
# check if the vrf exist
if !dictHasKey(bgp_down_per_devices[switch_name], vrf_name){
bgp_down_per_devices[switch_name][vrf_name] = newDict()
}
bgp_down_per_devices[switch_name][vrf_name][bgp_peer_ip] = bgp_peer
}
}
}
}
let dict_for_viewing = newDict()
for device_name, vrf in bgp_down_per_devices {
for vrf_name , bgp_peers in vrf {
for bgp_peer_ip, bgp_peer in bgp_peers {
if bgp_peer["bgpPeerAdminShutDown"] == false{
let detail_problemes = newDict()
detail_problemes["switch"] = device_name
detail_problemes["vrf"] = vrf_name
detail_problemes["description"] = bgp_peer["bgpPeerDescription"]
detail_problemes["admin_shut"] = bgp_peer["bgpPeerAdminShutDown"]
# check if the switch name exist
if !dictHasKey(dict_for_viewing, device_name){
dict_for_viewing[bgp_peer_ip] = newDict()
}
dict_for_viewing[bgp_peer_ip] = detail_problemes
}
}
}
}
dict_for_viewing




