Document toolboxDocument toolbox

Multi-Line Config File Matches

Information in this topic applies only to rules created in the CPD Editor (see Using the CPD Editor).

Many configuration commands can span multiple lines in a configuration file, where each indentation level indicates a different sub-command specification. Similarly, config file matches can be specified as a collection of one or more sub-matches that are applied to the corresponding sub-commands.

For example, the following multi-line config file match:

[Config File Must Contain]

interface Ethernet0\/0

description.*

indicates than an interface command must exist for the Ethernet0/0 interface and that a description must be defined for that interface. Because the description sub-match only specifies the first part of the sub-command, any description will match the sub-match, as long as one has been defined. That is, the rule author doesn’t care exactly what description is defined, only that some description is defined for that device.

As with single-line config file match, you may want to include a wildcard expression as part of the top-level match or sub-matches so that the config file match can be used across a range of commands. In such cases, the multi-line config file match is applied to any configuration command that matches the top-level config file match.

or example, the following multi-line config file match:

[Config File Must Contain]

interface Ethernet.*

description.*

indicates that all interface commands associated with any Ethernet interface must have an interface description defined, whereas the following multi-line config file match:

[Config File Must Contain]

interface.*

description.*

indicates that every interface, regardless of type, must have a defined interface description.