Exclude config content from comparison in NCM
You can identify lines or blocks of text that you do not want NCM to evaluate when it compares configs. For example, you can exclude:
- Empty lines
- Lines that do not represent substantive changes, such as a Last Updated line
- Expected differences, such as the hostname value
- Blocks of text that do not represent substantive changes, such as the certificate section of the config
Excluding this content speeds up the comparison process and makes reviewing the compared configs easier. It can also prevent NCM from flagging inconsequential or expected differences when it compares a downloaded config to a baseline.
NCM uses regular expressions to identify the content that it should ignore during comparisons. You can create and manage regular expressions on the Comparison Criteria page. NCM uses comparison criteria in the following comparison operations:
Comparison operation | When Comparison criteria is used |
---|---|
Manual comparisons | Always |
Config change reports | Always |
Scheduled jobs | Always |
Comparing configs to baselines | If the option to apply comparison criteria is selected in the baseline definition |
Access the Comparison Criteria page
From the Comparison Criteria page, you can create, edit, enable, disable, or delete a regular expression.
- Click Settings > All Settings.
- Under Product Specific Settings, click NCM Settings.
- Under Config Settings, click Comparison Criteria.
Create a regular expression
Create a regular expression that identifies the text that NCM should ignore when comparing configs.
See Regular expression examples for some regular expressions that are commonly used to exclude lines and blocks. Other resources, such as www.Regular-Expressions.info, are available online to help you learn more about regular expressions.
- On the Comparison Criteria page, click Add New.
- Enter a descriptive title.
-
Identify the text to exclude:
-
To exclude a single line, enter a regular expression that identifies the beginning of the line.
-
To exclude a block of text:
-
In the RegEx pattern box, enter the regular expression that identifies the beginning of the first line in the block.
-
Select Is block.
-
In the End RegEx pattern box, enter the regular expression that identifies the beginning of the last line in the block.
The search for the pattern that identifies the end of the block is "lazy." That means if the pattern occurs multiple times, NCM finds the first occurrence of the pattern.
-
-
- To activate this regular expression, select Enable NCM to ignore this pattern. Otherwise, leave it disabled for future editing.
- Click OK.
When you create and enable a new regular expression, it applies to manual config comparisons immediately. However, you must download the config again before the new regular expression affects config change reports and charts (such as the Overall Configuration Changes Snapshot).
Edit a regular expression
- Select a regular expression on the Comparison Criteria screen, and click Edit.
- Update any values on the Edit RegEx Pattern dialog.
- Click OK.
Enable or disable a regular expression
Select one or more regular expressions on the Comparison Criteria screen, and click Enable or Disable.
Delete a regular expression
Select one or more regular expressions on the Comparison Criteria screen, and click Delete.
Regular expression examples
The following are examples of regular expression patterns you can use to exclude config lines or blocks from comparison.
RegEx pattern | End RegEx pattern | Description |
---|---|---|
^! Last
|
Ignores the !Last Configuration change line in Cisco configurations. |
|
^ntp clock-period
|
Ignores the |
|
^wlccp ap username cisco
|
Ignores the wlccp line in Cisco access point configurations. |
|
certificate ca
|
quit
|
Ignores all lines in a certificate block that starts with certificate ca and ends with quit . |