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

No --diff output from network resource modules #57

Closed
dataolle opened this issue Jan 28, 2022 · 6 comments
Closed

No --diff output from network resource modules #57

dataolle opened this issue Jan 28, 2022 · 6 comments
Assignees
Milestone

Comments

@dataolle
Copy link

SUMMARY

Implement "--diff" output in network resource modules such as sonic_interfaces, sonic_vlans etc etc.
This works with other vendors network resource modules, and also dellemc.os10 implements diff output.
I see the data is there when running in verbose mode (before and after) so i guess the data for ansible-playbook to display the diff is not implemented in the dellemc.enterprise_sonic network resource modules.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

implement diff mode for sonic network resource modules.

ADDITIONAL INFORMATION

It would be grate for sanity check in combination with "check mode" to see what effective changes to a device will be compared to the current running configuration.

- hosts: all
  connection: httpapi
  gather_facts: true
  collections:
    - dellemc.enterprise_sonic

  tasks:
    - name: Create Interfaces
      sonic_interfaces:
        config: '{{sonic_interfaces}}'
      when: sonic_interfaces is defined and sonic_interfaces

Using this variable data:

sonic_interfaces:
  - description: '"MCLAG to LEAF-2 Eth1/51"'
    enabled: true
    name: Eth1/51

Run this command

ansible-playbook -i inventory.yaml playbook.yaml

Change variable to this

sonic_interfaces:
  - description: '"MCLAG to LEAF-4 Eth1/51"'
    enabled: true
    name: Eth1/51

And run this:

ansible-playbook -i inventory.yaml playbook.yaml --check --diff

I would expact to return the diff (interface description for Eth1/51).
This is what happens with other network resource modules and i would expect the enterprise sonic ones to do the same.

@kerry-meyer
Copy link
Collaborator

We have added implementation of --diff output to our list of pending features and will add this functionality in the near future.

@shatalabi
Copy link

@dataolle Could you clarify what your expectations are for the output? Using the data already available in our modules, when the user executes a playbook with both --check and --diff parameters specified, I could return a "prepared" diff. The "prepared" diff would be a JSON representation of the commands to be issued. See the output below based on your example.

Configuration to be  merged:
{
   "sonic_interfaces": [
      {
         "description": "\"MCLAG to LEAF-4 Eth1/51\"",
      }
   ]
}

@dataolle
Copy link
Author

Sorry for the very late reply.
Would it be possible for it to have more context.
I.e. it would be nice to show that Eth1/51 is the one that is changed.
Also it would be nice to show that it is added or removed in some way (like "diff -u" command does for example).

@kerry-meyer
Copy link
Collaborator

We agree that some context is needed in the diff output to enable clear determination of where the change was made.

Attached is a document describing three output format options we are considering for our implementation. Please let us know your thoughts and preferences on these options or any other alternatives that you think would be preferable.

Proposed Ansible Diff Formats.docx

@jeff-yin jeff-yin added this to the v2.2.0 milestone Mar 8, 2023
@kerry-meyer
Copy link
Collaborator

This issue has been addressed by the merging of "#279" to provide the global "check and diff" mode functionality for use by individual resource modules, and by numerous follow-on merges to provide the "check" and "diff" mode functionality for individual resource modules and to improve the readability of the "diff" output. This initial functionality is being provided for the 2.3.0 release of the Dell enterprise_sonic Ansible collection, with "check and diff" mode support for any remaining resource modules (BGP modules) planned for the 2.4.0 release.

@kerry-meyer
Copy link
Collaborator

kerry-meyer commented Jan 19, 2024

This issue has been addressed by the merging of "#279" to provide the global "check and diff" mode functionality for use by individual resource modules, and by numerous follow-on merges to provide the "check" and "diff" mode functionality for individual resource modules and to improve the readability of the "diff" output. This initial functionality is being provided for the 2.4.0 release of the Dell enterprise_sonic Ansible collection, with "check and diff" mode support for any remaining resource modules (BGP modules) planned for the 3.0.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants