Configuration File Check Elements
Raw XML rules can use method calls running_config_text and saved_config_text to directly analyze configuration files. They may also use the same constructs used by the Simple Rule and CPD Rule editors (the <ConfigFileCheck>
and <CPDCheck>
elements, respectively).<ConfigFileCheck>
and <CPDCheck>
elements also count as "expressions." They may be used anywhere an <Expr>
element can be used. These elements can validate running configuration files and saved configuration files.
<ConfigFileCheck>
Contents of this element will be treated as one or more regular expressions, and validated against the configuration file. When a match is found, the variables "_message
" and "_lineno
" will be set, appropriate to the type of check being performed.
The ConfigFileCheck
element supports the following attributes:
Attribute | Description |
| The name of a variable holding the device object to check. Generally this may be omitted, because the current object is known as part of the context. |
| Advanced or Basic. The default is Advanced mode. In basic mode, each line is simply treated as a complete regular expression. In advanced mode, if any line starts with '/', that line will be interpreted as /regex/options. That is, you must have an ending /, and can include regular expression options (zero or more of m, x, i) after the ending /. Lines not starting with / will behave the same as basic mode. |
| Defines the type of config file check to perform. The contents (text node) of the
Block Operations – For these operators, the entire contents of the ConfigFileCheck are treated as a single multi-line regular expression:
|
Configuration Policy Definition Checks (<CPDCheck>)
Statements encapsulated in the <CPDCheck>
element are treated by the RAW XML Editor as a simple configuration policy definition (CPD).
Definition of CPDs is discussed further in the topic Using the CPD Editor.