Conditions are used to define and restrict the execution logic within device classes. They allow specifying which requests are sent to a device depending on wether these conditions are true or not. Conditions are also used to assign devices to a device class.
They consist of boolean expressions that always either return true or false. The following example shows how conditions can look like inside a YAML configuration file:
logical_operator: OR conditions: - type: SysObjectID match_mode: startsWith values: - .18.104.22.168.4.1.12148.10 - type: snmpget oid: .22.214.171.124.4.1.12126.96.36.199.0 match_mode: regex values: - '(Micropack System|Smartpack S|SmartPack2 Touch)(\s*)?$'
Conditions in a YAML file always contain two parts, a
logical_operator is used to combine multiple conditions. It defines how these conditions
are evaluated. There are only two possible values, “OR” and “AND”.
conditions section contains the actual conditions, which are combined by the
A Condition always needs to have a specified
type. There are different condition types and
depending on the type being used, other parameters need to be set for a condition to be complete.
For instance, the example above consist of two conditions, which have the types
For the latter, an oid needs to be set which will be requested using snmpget. The value which will be returned
by this request will be used to evaluate the condition. This is not needed for a
as the condition type already defines which value will be used for evaluation.
As of now, the following condition types are available:
|SysDescription||The SysDescription of a device will be used to evaluate the condition.|
|SysObjectID||The SysObjectID of a device will be used to evaluate the condition.|
|snmpget||The given OID will be requested using snmpget and the returned response will be used to evaluate the condition.|
|HTTPGetBody||A HTTP Get Request for the given path will be sent to the device and the returned HTTP body will be used to evaluate the condition.|
|conditionSet||A condition of this type represents multiple conditions, which will be evaluated separately. A condition set has the same structure as conditions in general, which is described above. It consist of a logical operator and a list of conditions. This allows creating multiple levels of conditions and using different logical operators for evaluation.|
values parameters are mandatory for each condition type (except conditionSet).
Every condition retrieves a value from the device and evaluates it by comparing it to given strings,
which are defined as an array inside the
If one of these values matches the criteria, the condition will return true.
match_mode describes what kind of comparison is done.
There are four different match modes that compare the value which was read out from the device (String A)
with the strings defined in the
values list (String B) with :
|contains||String A needs to contain String B as a substring|
|equals||String A must be equal to String B|
|startsWith||String A must start with String B|
|regex||String A has to match the regular expression defined in String B|
All match modes can also be negated by adding a
! in front of it.