It is possible to compare the output of an NQE query using the Diffs feature by first adding the NQE query to Inventory+.
Consider the following NQE query, which lists all the static routes on all devices. (Note that the next hop is listed in this example provided that the next hop is an IP address. The query could be expanded to handle other types of next hops).
getStaticRoutes(routingTable) =
foreach ipEntry in routingTable.ipEntries
foreach nextHop in ipEntry.nextHops
where nextHop.originProtocol == OriginProtocol.STATIC
select {
prefix: ipEntry.prefix,
nextHopType: nextHop.nextHopType,
nextHop: ipEntry.nextHops
};
foreach device in network.devices
foreach networkInstance in device.networkInstances
let afts = networkInstance.afts
where isPresent(afts.ipv4Unicast)
let ipv4Unicast = afts.ipv4Unicast
let staticRouteCount = length(getStaticRoutes(ipv4Unicast))
where staticRouteCount > 0
foreach entry in getStaticRoutes(ipv4Unicast)
select {
Device: device.name,
"Network Instance": networkInstance.name,
"IP Prefix": entry.prefix,
"Next Hop Type": entry.nextHopType,
"Next Hop": max(entry.nextHop).ipAddress
}
Here is the result from running the NQE query in the Library on a single snapshot:

If we want to use this query with Diffs, we first have to add it to Inventory+.
From Inventory+, click on Add NQE queries:

Then select the query (called “static-route-check”) and Add.

Click on the query static-route-check in Inventory+ to run the query:

Now go to Diffs, select two snapshots, choose Inventory+ (NQE), and select static-route-check from the Org Repository.

Note that Diffs shows a summary of the changes in the results of the NQE query for the two selected snapshots (Added / Removed / Modified).
In the example above, two static routes have been Added, one on each of two routers in the network.
The preceding steps can also be used with, for example, an NQE query showing the state of BGP neighbors or OSPF neighbors, or indeed any change of state or configuration that can be measured by an NQE query!