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

Implement Context Diff option in eos_config module #485

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

rohitthakur2590
Copy link
Contributor

@rohitthakur2590 rohitthakur2590 commented Nov 20, 2023

SUMMARY
  • Implements: Allow override of supports_onbox_diff  #374

  • Implement context_diff options when taking the diff between candidate and running,
    Context Diff result is based on off-box-diff logic overriding the default arista on-box diff.

  • context_diff allows the sizing of the context lines w.r.t the diff, this is quite useful
    when having a large nested config structure.

  • To conclude this solves the issue where with on-box diff or default diff implementation the diff context is
    limited to a couple of lines.

  • This is an add-on feature and doesn't affect the existing output format.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

eos_config

Example
  - name: Display Config Diff with Full context
    arista.eos.eos_config:
      src: ../candidate.cfg
      backup: true
      context_diff:
        enable: true
        context_lines: 70
      backup_options:
        filename: backup.cfg
        dir_path: ./network_backups/

Output:

  context_diff: |-
    ---
  
    +++
  
    @@ -1,66 +1,66 @@
  
     ! Command: show running-config
    -! device: arista (vEOS, EOS-4.24.6M)
    +! device: candidate-arista-7 (vEOS, EOS-4.24.6M)
     !
     ! boot system flash:/vEOS-lab.swi
     !
     transceiver qsfp default-mode 4x10G
     !
     service routing protocols model ribd
     !
     logging buffered 81926
     logging source-interface Loopback6
     !
    -hostname candidate_arista
    +hostname candidate_arista_7
     ip name-server vrf default 1.1.1.1
     dns domain ansible.test
     !
     ntp server 1.1.1.1 local-interface Management1


while on-box diff output would look like

  diff: |-
    ---
  
    +++
  
    @@ -1,66 +1,66 @@
  
     ! Command: show running-config
    -! device: arista (vEOS, EOS-4.24.6M)
    +! device: candidate-arista-7 (vEOS, EOS-4.24.6M)
     !

     logging buffered 81926
     logging source-interface Loopback6
     !
    -hostname candidate_arista
    +hostname candidate_arista_7
     ip name-server vrf default 1.1.1.1
     dns domain ansible.test
     !

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (25aabfe) 82.76% compared to head (5f2cbae) 82.80%.

❗ Current head 5f2cbae differs from pull request most recent head 8b52b55. Consider uploading reports for the commit 8b52b55 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #485      +/-   ##
==========================================
+ Coverage   82.76%   82.80%   +0.04%     
==========================================
  Files         153      153              
  Lines       11967    11992      +25     
==========================================
+ Hits         9904     9930      +26     
+ Misses       2063     2062       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NilashishC NilashishC self-requested a review November 22, 2023 13:16
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Copy link

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/67d076772196416bb5ceaa322a46af6e

✔️ ansible-test-network-integration-eos-httpapi-python39-stable215 SUCCESS in 43m 52s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable214 SUCCESS in 44m 19s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable213 SUCCESS in 39m 34s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable212 SUCCESS in 38m 06s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable211 SUCCESS in 39m 37s
✔️ ansible-test-network-integration-eos-network_cli-python39-stable215-scenario01 SUCCESS in 34m 07s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable215-scenario02 SUCCESS in 37m 27s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario01 SUCCESS in 34m 28s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario02 RETRY_LIMIT in 3m 50s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable214-scenario01 SUCCESS in 32m 32s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable214-scenario02 SUCCESS in 34m 01s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario01 SUCCESS in 31m 54s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario02 SUCCESS in 33m 57s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable213-scenario01 SUCCESS in 36m 56s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable213-scenario02 SUCCESS in 37m 12s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario01 SUCCESS in 35m 58s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario02 SUCCESS in 37m 33s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable212-scenario01 SUCCESS in 35m 08s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable212-scenario02 SUCCESS in 37m 38s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario01 SUCCESS in 1h 02m 09s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario02 SUCCESS in 39m 36s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable211-scenario01 SUCCESS in 36m 06s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable211-scenario02 SUCCESS in 38m 05s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario01 SUCCESS in 35m 56s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario02 SUCCESS in 38m 14s (non-voting)
✔️ build-ansible-collection SUCCESS in 9m 45s
✔️ ansible-tox-linters SUCCESS in 11m 53s
✔️ ansible-galaxy-importer SUCCESS in 4m 58s

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
Copy link

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/6f3508d8cc764412ba9e456463e23e2e

✔️ ansible-test-network-integration-eos-httpapi-python39-stable215 SUCCESS in 51m 48s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable214 SUCCESS in 51m 11s
ansible-test-network-integration-eos-httpapi-python39-stable213 RETRY_LIMIT in 3m 54s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable212 SUCCESS in 42m 21s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable211 SUCCESS in 36m 25s
✔️ ansible-test-network-integration-eos-network_cli-python39-stable215-scenario01 SUCCESS in 38m 06s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable215-scenario02 SUCCESS in 42m 07s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario01 SUCCESS in 32m 49s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario02 SUCCESS in 44m 49s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable214-scenario01 SUCCESS in 40m 39s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable214-scenario02 SUCCESS in 43m 49s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario01 SUCCESS in 32m 14s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario02 SUCCESS in 44m 31s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable213-scenario01 SUCCESS in 39m 20s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable213-scenario02 SUCCESS in 33m 43s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario01 SUCCESS in 37m 52s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario02 SUCCESS in 40m 57s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable212-scenario01 SUCCESS in 32m 29s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable212-scenario02 SUCCESS in 45m 08s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario01 SUCCESS in 31m 24s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario02 SUCCESS in 33m 38s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable211-scenario01 SUCCESS in 43m 14s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable211-scenario02 SUCCESS in 34m 09s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario01 SUCCESS in 33m 18s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario02 SUCCESS in 42m 09s (non-voting)
✔️ build-ansible-collection SUCCESS in 9m 43s
✔️ ansible-tox-linters SUCCESS in 12m 05s
✔️ ansible-galaxy-importer SUCCESS in 4m 55s

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

Successfully merging this pull request may close these issues.

2 participants