Skip to content

Example: Pre/Post-Change Interface State Validation

Scenario: Validate that all Loopback interfaces are up before a change, then intentionally shut down a loopback interface, and use the app to detect and highlight the change.

Step 1: Create the "Loopback Interfaces Up" Validation Rule

  1. Navigate to: OperationsOperational ComplianceValidation Rules Click the + button to create a new rule.

  2. Fill in the form:

    • Name: Loopback Interfaces Up
    • Rule Type: EXACT_MATCH
    • Rule Options: (leave blank)
    • Description: Ensure all Loopback interfaces are up
  3. Click: Create

Create a new validation rule Create a new validation rule

Step 2: Create the Command Parser for Loopback Interfaces

  1. Navigate to: OperationsOperational ComplianceCommand Parsers Click the + button.

  2. Fill in the form:

    • Parser: TEXTFSM
    • Command: show interfaces
    • Validation Rule: Loopback Interfaces Up
    • Platform: cisco_ios
    • Path:
    [?starts_with(interface, 'Loopback')].[interface, link_status, protocol_status]
    

    (This JMESPath expression filters for interfaces whose name starts with "Loopback" and extracts their interface name, link status, and protocol status.)

  3. Click: Create

Note

Try to use the long form of the command (e.g. show interfaces) rather than an abbreviated form (e.g. sh int) to ensure the best chance of matching the command to a parser template in any Git repositories.

Step 3: Create a Validation Rule Group

  1. Navigate to: OperationsOperational ComplianceValidation Rule Groups Click the + button.

  2. Fill in the form:

    • Name: Pre/Post Change Validation
    • Validation Rules: Add the Loopback Interfaces Up validation rule
  3. Click: Create

Create a new validation rule group Create a new validation rule group

Step 4: Collect Command Outputs (Pre-Change)

  1. Navigate to: OperationsOperational ComplianceCommand Outputs. Click the + button.

  2. Fill in the form:

    • Validation Rules: Loopback Interfaces Up
    • Devices: Select your device
  3. Click: Collect Command Outputs

    Collect Command Output Collect Command Output

  4. Navigate to the Command Outputs page and you can view the output of the command.

Step 5: Make a Change on the Device

SSH to your device and shut down a loopback interface:

conf t
interface Loopback10
shutdown
end

Step 6: Collect Command Outputs (Post-Change)

Repeat Step 4 to collect the post-change state.

Step 7: Compare the Command Outputs

  1. Navigate to: OperationsOperational ComplianceValidation Results Click the + button.

  2. Fill in the form:

    • Device: Select your device
    • Validation Rule: Loopback Interfaces Up
    • Pre Check: Select your pre-change command output
    • Post Check: Select your post-change command output
  3. Click: Compare Command Outputs

Compare command outputs form Compare command outputs form

Example Data

Pre-Change (Loopback10 up):

[
  ["Loopback0", "up", "up"],
  ["Loopback10", "up", "up"],
  ["Loopback109", "up", "up"]
]

Post-Change (Loopback10 down):

[
  ["Loopback0", "up", "up"],
  ["Loopback10", "administratively down", "down"],
  ["Loopback109", "up", "up"]
]

Compare command outputs Compare command outputs

Example Diff Output:

{
  "index_element[1][1]": {
    "new_value": "administratively down",
    "old_value": "up"
  },
  "index_element[1][2]": {
    "new_value": "down",
    "old_value": "up"
  }
}

How to read this diff:

  • index_element[1][1] means the second interface in the list (Loopback10), second field (link_status), changed from "up" to "administratively down".
  • index_element[1][2] means the second interface, third field (protocol_status), changed from "up" to "down".

This shows exactly which interface and fields changed between the two results.