Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Match Mode

Line order matters

Lines must be consecutive

Loose

No

No

Sequential

Yes

No

Strict

Yes

Yes

Reference

...

source:

The compliance condition examples throughout this article are matching against the following device configuration:

...

"Source contains" condition type:

Loose Modemode

Loose mode verifies that all input lines exist somewhere in the source. Their order is ignored, and any content may appear between matching lines in the source.

...

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. Additional text/lines may appear between them.

...

The input lines appear in the source in reverse order.

Strict

...

mode

Strict mode requires input lines to appear consecutively in the source. No additional text/lines may exist between the matching lines in the source.

...

The same three match modes is available for the Source matches regex condition type. Each input line is treated as a separate regular expression and matched against the source. The selected match mode controls how these regex inputs are matched: whether they can match in any order, must match in the specified order, or must match consecutively.

Loose

...

mode

Example Input 7:

Code Block
languagetext
router ospf
hostname R[0-9]+

...

This verifies that the device follows the R<number> hostname convention and has OSPF enabled. The two matches are independent, so their order does not matter.

Sequential

...

mode

Example Input 8:

Code Block
languagetext
router ospf
 network [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/([0-9]+) area [0-9]+

...

This verifies that an OSPF network statement appears after the router ospf command. Other matching lines may appear between the two lines.

Strict

...

mode

Example Input 9:

Code Block
languagetext
interface Loopback[0-9]+
 description Management Loopback
 ip address 10\.255\.255\.[0-9]+ 255\.255\.255\.255

...

This verifies that a Loopback interface with a variable interface number has the required "Management Loopback" description and uses a /32 address from the 10.255.255.0/24 management subnet.

Choosing the

...

right Match

...

mode

Requirement

Recommended match mode

Required lines can appear anywhere and in any order

Loose

Required lines must appear in a specific order, but may have other lines between them

Sequential

Required lines must appear in a specific order with no lines between them

Strict

...