TODO
Note: This feature is currently in beta and is available only to early adopters.
All condition types support three match modes:
Loose
Sequential
Strict
Match mode determines how the order of the input lines or regular expressions affects evaluation of the condition against the selected source.
Mode | Order required | Content allowed between matches |
Loose | No | Yes |
Sequential | Yes | Yes |
Strict | Yes | No |
Example Source:
| Code Block | ||
|---|---|---|
| ||
hostname R1
interface Ethernet1
description Uplink
ip address 10.0.0.1/24
interface Ethernet2
description LAN
ip address 192.168.1.1/24
router ospf
network 10.0.0.0/24 area 0 |
Suppose the input is:
| Code Block | ||
|---|---|---|
| ||
interface Ethernet1
ip address 10.0.0.1/24 |
Match mode | Condition Status | Explanation |
Loose | Successful | Both lines exist in the source. |
Sequential | Successful | The lines appear in the correct order. |
Strict | Failed | The description Uplink line appears between them. |
Loose Mode
Loose mode verifies that all input lines exist somewhere in the source. The order is ignored. Additional content between matching lines is irrelevant.
Example Input 1:
| Code Block | ||
|---|---|---|
| ||
description LAN
hostname R1 |
Result
Condition successful
Although the order of the input lines differs from the source, both lines are present.
Example Input2:
| Code Block | ||
|---|---|---|
| ||
hostname R1
description WAN |
Result
Condition failed
The line description WAN does not exist in the source.
Sequential Mode
Sequential mode requires all input lines to appear in the source in the same order as entered. Other lines may appear between them.
Example Input 1:
| Code Block | ||
|---|---|---|
| ||
interface Ethernet1
ip address 10.0.0.1/24 |
Result
Condition successful
The two lines appear in the source in the correct order.
The description Uplink line between them is ignored.
Example Input 2:
| Code Block | ||
|---|---|---|
| ||
ip address 10.0.0.1/24
interface Ethernet1 |
Result
Condition failed
The input lines appear in the source in reverse order.
Strict Mode
Strict mode requires the input lines to appear consecutively. No additional text may exist between the matching lines in the source.
Example Input 1:
| Code Block | ||
|---|---|---|
| ||
interface Ethernet1
description Uplink
ip address 10.0.0.1/24 |
Result
Condition successful
These three lines appear consecutively.
Example Input 2:
| Code Block | ||
|---|---|---|
| ||
interface Ethernet1
ip address 10.0.0.1/24 |
Result
Condition failed
The source contains the line
description Uplink
between the two input lines.
Strict mode therefore fails.
Choosing the Right Match Mode
Use case | Recommended mode |
Verify several independent configuration lines exist | Loose |
Verify the order of configuration commands | Sequential |
Verify an exact configuration block | Strict |