Presets with wildcards

Can i use presets by precondition product class with wildcard like that: “My-Model-*”? If yes, what syntax?

My preset1 not working:

Product class = My-model
Product class = My-model-revision-A1

My preset2 it`s working:

Product class = My-model-revision-A
Product class = My-model-revision-C
Product class = My-model-revision-B

It would help to know what version of GeneiACS you are using…

GenieACS v1.1.3 Dockerfile

To the best of my knowledge this isn’t possible with v1.1. In v1.2 the query/matching syntax has changed to be more SQL like and you might be able to do LIKE syntax. But we haven’t upgraded to v1.2 yet so I cannot offer any help on that.

-dan

Sounds intresting. But using mongoDB or it’s change with new version to sql? What DB using with new version?

We haven’t switched yet so I haven’t dug into that.

Still mongodb, it’s just the query-language that has been expanded. With my limited knowledge (I don’t really know programming or SQL but I can google and we have akcoder on the forum…) we use it like this:

Find a unit that begins with Nokia:
InternetGatewayDevice.DeviceInfo.ProductClass LIKE "Nokia%"
Find a unit that contains Nokia:
InternetGatewayDevice.DeviceInfo.ProductClass LIKE "%Nokia%"
Find a unit that ends with Nokia:
InternetGatewayDevice.DeviceInfo.ProductClass LIKE "%Nokia"

Here’s an OR example:
InternetGatewayDevice.DeviceInfo.ModelName LIKE "%DRG719%" OR InternetGatewayDevice.DeviceInfo.ModelName LIKE "%DRG711%" OR InternetGatewayDevice.DeviceInfo.ModelName LIKE "%v2%"

One can also group conditions:
(Device.DeviceInfo.ProductClass = "Polar" OR Device.DeviceInfo.ProductClass = "Lunar") AND Tags.bridge IS NULL AND Tags.iptv IS NULL AND Tags.get IS NOT NULL AND Tags.nat IS NOT NULL AND Device.DeviceInfo.ModelName <> "FiberTwist-P2410"

1 Like

Where are you using it? It’s not working for Presets.

You need to be on v1.2 to get the SQL like syntax.

1 Like

Not a very elegant solution, but you could use a pair of ‘greater than’ and ‘less than’ conditions to simulate a ‘starts with’ condition:

Product class >= My-model
Product class < My-model-ZZZ

But this compares the length only. The comparison will work for and “Your-model” too. Is’n it?

Not length. Strings are compared alphanumerically.