Skip to main content

how can i merger 2 or 3 NQE Query into 1 , so that i can get output in single file.

Hi @Rohit_809 Kumar :

Here is one method:

NQE Before

NQE1

foreach device in network.devices
where device.platform.os == OS.PAN_OS
select {
deviceName: device.name,
version: device.platform.osVersion
}

NQE2

foreach device in network.devices
where device.platform.os == OS.ARISTA_EOS
select {
deviceName: device.name,
version: device.platform.osVersion
}

NQE After

NQE1

export nqe1Result(device:Device)=
foreach device in ndevice]
where device.platform.os == OS.PAN_OS
select {
deviceName: device.name,
version: device.platform.osVersion
};

NQE2

export nqe2Result(device:Device)=
foreach device in ndevice]
where device.platform.os == OS.ARISTA_EOS
select {
deviceName: device.name,
version: device.platform.osVersion
};

NQE3

import "NQE1";
import "NQE2";

foreach device in network.devices
foreach record in nqe1Result(device) + nqe2Result(device)
select record

 

Edit:

See Christopher’s post for a more advanced example: https://community.forwardnetworks.com/nqe%2D39/combining%2Dnqe%2Dqueries%2Dinto%2Da%2Dsingle%2Dcheck%2D442


Roberts answers are good.  Also, a post by Christopher was added resently that discusses this as well.

 


Reply