Your first policy
A Policy Definition is a set of rules. Each rule checks one or several things in a device’s config.
In this guide you will make one rule and run it. The rule looks for test interfaces that someone forgot to remove. If it finds one, the device fails. If not, the device passes.
You need two things:
- rConfig 8.0.2 or later.
- One Cisco IOS-XE device that rConfig has already backed up (
show running-config).
Video overviewHow to Create and Test Network Compliance Policies in rConfig V8 ProfessionalA short look at how compliance policies are written, tested and applied to devices in rConfig.Watch on YouTube
The rule
A rule has three lines:
- A note that starts with
//. You see this note in the results. - The method, which tells rConfig how to check. It goes inside
#[ ]. - The text to look for in the config.
Here is the rule:
// No lab or test interfaces in the running configuration#[wildcard_must_not_match_single_string]interface *test*This method means “this text must not be in the config”. The * means “anything can go here”. So interface *test* finds any interface line with the word test in it. Capital letters count, so Test is not the same as test.
Step 1: Create the definition
A definition is the file that holds your rules.
- Go to Compliance → Definitions and click New Policy Definition.
- Give it a name, such as
IOS-XE-Baseline-Draft, and a short description. Click Create. - Paste the rule into the editor and click Save.
Step 2: Test it
Testing checks the rule against a saved backup. It does not touch the device.
- Open a backup for one of your IOS-XE devices.
- Click Test Policy Definition and pick
IOS-XE-Baseline-Draft. - Look at the result.
Here are two example configs. This one passes, because it has no test interface:
interface GigabitEthernet0/0/1 description Production-Server-Link ip address 192.0.2.1 255.255.255.0 no shutdowninterface GigabitEthernet0/0/2 description Production-Client-Link ip address 198.51.100.1 255.255.255.0 no shutdowninterface Loopback0 description Management-Interface ip address 203.0.113.1 255.255.255.255This one fails, because it has interface test-lab-connection:
interface GigabitEthernet0/0/1 description Production-Server-Link ip address 192.0.2.1 255.255.255.0 no shutdowninterface test-lab-connection description Temporary-Test-Interface ip address 203.0.113.100 255.255.255.0 shutdowninterface GigabitEthernet0/0/2 description Production-Client-Link ip address 198.51.100.1 255.255.255.0 no shutdown| Config | Rule result | Overall result |
|---|---|---|
| First config | pass |
PASS |
| Second config | fail |
FAIL |
Always test with one config that should pass and one that should fail. A rule that always passes is just as broken as one that always fails.
Step 3: Assign it
Assigning tells rConfig which devices to check.
- Go to Compliance → Assignments and click New Policy Assignment.
- Give it a name. Set the Scope to one device to start.
- Set Command to
show running-config. - Set Policy Definition to
IOS-XE-Baseline-Draft. - Leave it Enabled and click Save.
To check more devices or run checks after every backup, see Policy Assignments.
Step 4: Run it
On the Policy Assignments page, open the menu for your assignment and click Run now. rConfig checks the latest backup.
Step 5: Read the results
Go to Compliance → Reports. Open your assignment, then your device. Policy Method Results shows each rule and whether it passed.
A device passes only if every rule passes. If one rule fails, the device fails.
For more on the report screens, see Policy Compliance Results.
Next steps
- Want to see every method? All policy methods lists all 17, each with a rule to copy and a config that passes or fails.
- Want more rules? The IOS-XE baseline standard is a full set you can import and change. You can add this rule to it too.
- Writing your own rules? Read avoiding false positives first.