Skip to main content

Is there a way to filter out duplicate MAC entries to get a unique MAC address count? Using the standard NQE library query under "L2 -> Mac Entries" returns every VLAN and device a MAC entry is seen on, skewing the results as shown in the example image.

 

 

Try this NQE query.

/**
* @intent Unique MAC Address counts and their details
*/

foreach device in network.devices
foreach networkInstance in device.networkInstances
foreach macEntry in networkInstance.fdb.macEntries
group { deviceName: device.name, macEntry } as macEntriesPerAddress
by macEntry.macAddress as macAddress
let deviceNameAndMacEntry = min(macEntriesPerAddress)
let macEntry = deviceNameAndMacEntry.macEntry
select {
Device: deviceNameAndMacEntry.deviceName,
"MAC Address": macAddress,
"Address Count": length(macEntriesPerAddress),
OUI: ouiAssignee(macEntry.macAddress),
Type: macEntry.entryType,
Interfaces: (foreach i in macEntry.interfaces
select if isPresent(i.subinterfaceName)
then i.subinterfaceName
else i.interfaceName)
}

 


Reply