Skip to content
Guides & References

Your first policy

Build your first rConfig policy step by step. Write one rule, test it, assign it to a device and read the result. No experience needed.

Policy LibraryUpdated
On this page

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).
Thumbnail for the video: How to Create and Test Network Compliance Policies in rConfig V8 ProfessionalVideo 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:

  1. A note that starts with //. You see this note in the results.
  2. The method, which tells rConfig how to check. It goes inside #[ ].
  3. 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.

  1. Go to Compliance → Definitions and click New Policy Definition.
  2. Give it a name, such as IOS-XE-Baseline-Draft, and a short description. Click Create.
  3. 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.

  1. Open a backup for one of your IOS-XE devices.
  2. Click Test Policy Definition and pick IOS-XE-Baseline-Draft.
  3. 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 shutdown
interface GigabitEthernet0/0/2
description Production-Client-Link
ip address 198.51.100.1 255.255.255.0
no shutdown
interface Loopback0
description Management-Interface
ip address 203.0.113.1 255.255.255.255

This 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 shutdown
interface test-lab-connection
description Temporary-Test-Interface
ip address 203.0.113.100 255.255.255.0
shutdown
interface 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.

  1. Go to Compliance → Assignments and click New Policy Assignment.
  2. Give it a name. Set the Scope to one device to start.
  3. Set Command to show running-config.
  4. Set Policy Definition to IOS-XE-Baseline-Draft.
  5. 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

Type to search.