The MTU query that comes canned in Forward Networks was pretty cool. However, I just wanted the MTU info on links that contained an LLDP or CDP neighbor entry, b/c I just don’t care about the MTU of of access devices, just the infrastructure links.
I tried to also modify to not pull MTU on Mgmt Interfaces (ma1, MA1, mgmt0) However, I’m still pulling some ‘ma1’ interfaces! Oh well .I just sort it out later, but if anyone sees the issue, chime in.
/**
* @intent Return the MTU of interfaces that contain a CDP or LLDP neighbor
* @description rcariddi 6/30/2023 Find All links of CDP/LLDP, make sure each side of the link matches. This allows us to ignore non infrastructure links
* If we want all values, remove the line: where isPresent(interface1.cdp) || isPresent(interface1.lldp)
**/
foreach device1 in network.devices
foreach interface1 in device1.interfaces
where isPresent(interface1.mtu)
where isPresent(interface1.cdp) || isPresent(interface1.lldp)
where toLowerCase(interface1.name) not in e"ma*", "mgmt0", "bond0"]
foreach link in interface1.links
where device1.name < link.deviceName || (device1.name == link.deviceName && interface1.name < link.ifaceName)
foreach device2 in network.devices
where device2.name == link.deviceName
foreach interface2 in device2.interfaces
where isPresent(interface2.mtu)
where isPresent(interface2.cdp) || isPresent(interface2.lldp)
where toLowerCase(interface2.name) not in e"ma*", "mgmt0", "bond0"]
where interface2.name == link.ifaceName
where isPresent(interface2.mtu)
select {
violation: interface1.mtu != interface2.mtu,
Device1: device1.name,
Interface1: interface1.name,
Mtu1: interface1.mtu,
Device2: device2.name,
Interface2: interface2.name,
Mtu2: interface2.mtu
}
Questions/Enhancements - rcariddi@gmail.com