Skip to main content

I am trying to get the output from commandType NHRP_STATE so I can then pull out the tunnel peer IPs with a patternmatch.

 

When the NHRP table was a custom command the command.commandText was able to get this information, now how to do so that NHRP is part of the data model?

foreach device in network.devices
foreach command in device.outputs.commands
where command.commandType == CommandType.NHRP_STATE
let response = parseConfigBlocks(device.platform.os, command.response)
foreach match in patternMatches(response, pattern)

This will allow you to define your pattern and match it against the command output. 


Thanks - I had gotten misled by the lowercase commandType vs the uppercase C CommandType to call it in the data model.

 


The case is trying to be a difference between the lowercase position on the model tree and the upper case data type.  Unfortunately it is confusing.  If you hover over the commandType in “command.commandType” you will see a popup showing a yellow “CommandType” which indicates the data type.  The data type is what you use on the right hand side of the ==.


Reply