Skip to main content
Solved

"Or" statement in NQE?

  • 13 September 2023
  • 2 replies
  • 46 views

Is there a way to add an "or" statement in a NQE? We are checking IOS versions against a model and Cisco says it can be this or that but the NQE we have looks like it's looking for both and throwing a false positive.

the syntax for logical OR in NQE is ||

Here is an example to identify this or that model: 

 

foreach d in network.devices

where device.platform.model == “model1” || device.platform.model == “model2” || device.platform.model == “model3”



 

An alternative to check multiple device model is to 

  1. generate a list of device model that you want to include
  2. take advantage of the item in list method 

for example, the above nqe query can be rewritten as: 

 

my_ios_model=>

“model1”, 

“model2”,

“model3”

]

foreach d in network.devices

where d.platform.model in my_ios_model

...

...

 

 


Thanks @jack.shen!


Reply