I am trying to filter devices within a specific range.
In order to get all devices with in a /24 I can do InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress LIKE '192.168.0.%'
which works
I have tried to search for devices in smaller a range but I haven’t found a solution that works.
Any Ideas?
There is nothing in the box to do a search by CIDR. One option is two download the CSV and do the filtering in Excel or some other sort of lang/app. Another option is to implement something like the Postgres inet
keyword or mariadb inet_aton
function.
It shouldn’t be hard to patch lib/common/expression/parser.ts to add the inet
keyword. It looks like the parser is using Parsimmon, so you’d have to sort out how to add your keyword.
Thank you, I was thinking of doing an OR statement
'192.168.0._' OR '192.168.0.1_'
Is there a way to use an OR statement instead of an AND statement?
I’m not seeing how your example will give you the ability to search for a device in an IP range.
The way I will do it for a /27 for example is.
'192.168.0._' OR '192.168.0.1_' OR '192.168.0.2_' OR '192.168.0.30'
Which would be the same as 192.168.0.0/27
I have found a solution to this.
I have to type the paremeter before each statement and use the LIKE statement instead of ‘=’
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress LIKE '192.168.0._' OR InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress LIKE '192.168.0.1_'