- 21 Oct 2024
-
DarkLight
-
PDF
Using Analytic Templates
- Updated on 21 Oct 2024
-
DarkLight
-
PDF
The various UI elements and user actions to define an Analytic Template are outlined in the table below.
Figure: Defining the Analytic Template
UI Label | Description |
---|---|
1 | Select a device from the Device Name field dropdown, or click the magnifying glass to search for a device. |
2 | Set the global pass flag (All Commands/One Command must pass) using the dropdown. See the Global Command Pass section below. |
3 | Select the appropriate Command Template in the Pre Template and Post Template dropdown list to pull commands from. |
4 | Set the appropriate command pair (Pre and Post Command) to test against the device. |
5 | Select the Rules type and Severity level. |
6 | Click the + Rule button to add a new rule to the command. |
7 | Set the global pass flag (All Rules/One Rule must pass) for rules using the dropdown. See the Global Rules Pass section below. |
8 | Click Test Run to test the command. After evaluating the response, the associated rules will be marked with either a green check mark (passed) or red minus sign (failed). The device response will also appear at the bottom of the screen. |
9 | Click + Command Pair to add a new command to the Analytic template. |
Global Command Pass
At the top of the template is a dropdown menu (All Commands must pass/ One Command must pass) that works on a global level.
Figure: Command Pass Options
- All commands must pass (default): Pass for every rule in every command.
- All commands must pass (warn/info as pass checked): Zero errors errors present in the template.
- One command must pass (default behavior): Pass for all rules in ONE (or more) commands.
- One command must pass (warn/info as pass checked): One command with zero errors must be present in the template.
Rules
The following options are available in the Rules dropdown for all Analytic Templates.
Figure: Analytic Template Rules
Rule | Description |
---|---|
regex |
Allows you to extract specific values (using parentheses) and compare them against each other with one of the following relationships. See the section below for available operators. |
table |
Allows the extraction of key and values from a table dataset, and then compares if all keys and values are the same. It is useful for datasets that may change their order. |
matches |
Compares the Pre and Post responses entirely. This rule passes when both responses are equivalent. Under the ignore pattern, it is possible (not mandatory) to specify a regular expression to be ignored during comparison. |
!matches |
Compares the Pre and Post responses entirely. This rule passes when the responses are different. Under the ignore pattern, it is possible (not mandatory) to specify a regular expression to be ignored during comparison. |
Regex Operators
The following regex operators are available.
Figure: Regex Operator Options
Operator | Description |
---|---|
= | String. Numbers are equal. |
!= | String. Numbers are not equal. |
<= | Pre-number is less than or equal to Post-number. |
< | Pre-number is less than Post-number. |
>= | Pre-number is greater than or equal to Post-number. |
> | Pre-number is greater than Post-number. |
% | Evaluates a percentage value calculation against a threshold. The percentage value is calculated by multiplying 100 times the Post-Regex value divided by the Pre-Regex value: 100 x (Post-Regex / Pre-Regex). The threshold is a static number typed in the Post/Pre % field. The rule returns true if the calculated percentage value is greater than or equal to the threshold; otherwise it returns false. |
Severity
Apply a Severity level to a rule after it has failed. The default severity is error
.
Figure: Rule Severity Options
Level | Description |
---|---|
error | Something is wrong or is not behaving normally, and a specific action may need to be taken. |
warning | There is something to be aware of that could potentially cause a problem. |
info | Informational messages have been logged. |
Flags
For select Rules (matches, !matches
), a command may have one or more rules which are bound by a boolean Flag called a "pass flag".
- When a pass flag is set to
true
(on), the logic between the rules is "AND". This means all rules must pass in order for the command to pass. - When a pass flag is set to
false
(off), the logic is "OR". This means that only one rule has to pass for the command to pass.
Flag | Description |
---|---|
i |
Ignore case. Make the whole expression case-insensitive. |
g |
Global search. Retain the index of the last match, allowing iterative searches. |
m |
Multi-line. Beginning/end anchors (^ /$ ) will match the start/end of a line. |
Global Rules Pass
For each command there is a dropdown (All Rules must pass/ One Rule must pass) that works the same as setting rules on each command, except on a global level.
- All Rules must pass: Pass for every rule in a command.
- One Rule must pass: Pass for one rule (or more) in a command.
Figure: Flag Options & Global Rules Pass