cisco.radkit.genie_diff module – This module compares the results across multiple devices and outputs the differences.

Note

This module is part of the cisco.radkit collection (version 2.0.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install git+https://wwwin-github.cisco.com/scdozier/cisco.radkit-ansible.git. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: cisco.radkit.genie_diff.

New in cisco.radkit 0.2.0

Synopsis

  • This module compares the results across multiple devices and outputs the differences between the parsed command output or the learned model output.

  • If diff_snapshots is used, compares differences in results from the same device.

Requirements

The below requirements are needed on the host that executes this module.

  • radkit

Parameters

Parameter

Comments

diff_snapshots

boolean

Set to true if comparing output from the same device.

Choices:

  • false ← (default)

  • true

result_a

dictionary / required

Result A from previous genie_parsed_command

result_b

dictionary / required

Result B from previous genie_parsed_command

Examples

- name:  Get show version parsed (initial snapshot)
  cisco.radkit.genie_parsed_command:
    commands: show version
    device_name: daa-csr1
    os: iosxe
  register: cmd_output
  delegate_to: localhost

- name:  Get show version parsed (2nd snapshot)
  cisco.radkit.genie_parsed_command:
    commands: show version
    device_name: daa-csr1
    os: iosxe
  register: cmd_output2
  delegate_to: localhost

- name:  Get a diff from snapshots daa-csr1
  cisco.radkit.genie_diff:
    result_a: "{{ cmd_output }}"
    result_b: "{{ cmd_output2 }}"
    diff_snapshots: yes
  delegate_to: localhost

- name:  Get show version parsed from routerA
  cisco.radkit.genie_parsed_command:
    commands: show version
    device_name: daa-csr1
    os: iosxe
  register: cmd_output
  delegate_to: localhost

- name: Get show version parsed from routerB
  cisco.radkit.genie_parsed_command:
    commands: show version
    device_name: daa-csr2
    os: iosxe
  register: cmd_output2
  delegate_to: localhost

- name:  Get a diff from snapshots of routerA and routerB
  cisco.radkit.genie_diff:
    result_a: "{{ cmd_output }}"
    result_b: "{{ cmd_output2 }}"
    diff_snapshots: no
  delegate_to: localhost

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

genie_diff_result

string

Result from Genie Diff

Returned: success

genie_diff_result_lines

string

Result from Genie Diff split into a list

Returned: success

Authors

  • Scott Dozier (@scdozier)