Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the 'show commit config diff' output available from the IOSXR #54875

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@marouim
Copy link

marouim commented Apr 4, 2019

SUMMARY

When running iosxr_config module in both check and diff mode, the module only returns
the commands that needs to be applied on the device. The diff is never displayed in check mode
because the module cannot anticipate the result of the changes on the cisco device. This is
valid for IOS, NXOS and IOSXR.

IOS XR architecture is very different from IOS and now provides candidates configurations
with commit feature. In addition, the IOS XR can now calculate the diff between the
candidate and the running configurations using the "show commit changes diff" command.

This proposal is to leverage the "show commit changes diff" functionality in network_cli mode.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

/lib/module_utils/network/iosxr/iosxr.py
/lib/plugins/cliconf/iosxr.py

ADDITIONAL INFORMATION

Use case for testing: prefix-set

When configuring any routing policy in IOS XR, the command replaces the block of configuration and there is no way to see the result of this kind of modification.

Configuration from the IOS-XR device:

prefix-set testmo
  3.3.3.3/32,
  4.4.4.4/32
end-set

Playbook task example:

- name: Edit config EVPN bridge domain
  iosxr_config:
    parents:
      - prefix-set testmo
    lines:
      - 1.1.1.1/32 , 2.2.2.2/32
    after:
      - end-set
ACTUAL RESULTS

The dry run does not show that 3.3.3.3/32 and 4.4.4.4/32 will be gone after the configuration is applied.

changed: [tor50] => {"changed": true, "commands": ["prefix-set testmo", "1.1.1.1/32 , 2.2.2.2/32", "end-set"]}
PROPOSED CHANGE - EXPECTED RESULTS

With the proposal applied, the output is now:

TASK [debug] *************************************************************************************************************************************************************************************************************************************************
ok: [tor50] => {
    "output": {
        "changed": true,
        "commands": [
            "prefix-set testmo",
            "1.1.1.1/32 , 2.2.2.2/32",
            "end-set"
        ],
        "diff": {
            "prepared": "Building configuration...\n!! IOS XR Configuration version = 6.3.2\n   !\n   prefix-set testmo\n-    3.3.3.3/32,\n-    4.4.4.4/32\n+    1.1.1.1/32,\n+    2.2.2.2/32\n   end-set\nend"
        },
        "failed": false
    }
}
TASK [debug] *************************************************************************************************************************************************************************************************************************************************
ok: [tor50] => {
    "msg": [
        "Building configuration...",
        "!! IOS XR Configuration version = 6.3.2",
        "   !",
        "   prefix-set testmo",
        "-    3.3.3.3/32,",
        "-    4.4.4.4/32",
        "+    1.1.1.1/32,",
        "+    2.2.2.2/32",
        "   end-set",
        "end"
    ]
}
@ansibot

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.