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

config replace fails when TCAM profile commands are present when using network_cli #368

Open
noredistribution opened this issue Jun 6, 2022 · 3 comments · May be fixed by #369
Open

config replace fails when TCAM profile commands are present when using network_cli #368

noredistribution opened this issue Jun 6, 2022 · 3 comments · May be fixed by #369
Labels
has_pr This issue has an associated PR.

Comments

@noredistribution
Copy link

SUMMARY

In new EOS versions (4.26+) playbooks are failing when using network_cli connection method for eos_config module if tcam profile changing commands are part of the configurations e.g.:

hardware tcam
   system profile vxlan-routing

Note that this works fine with httpapi

The problem seems to be caused by the newly introduced warning prompt when changing TCAM profiles:

Changing TCAM profile will cause forwarding agent(s) to exit and restart.
All traffic through the forwarding chip managed by the restarting
forwarding agent will be dropped.

Proceed [y/n]```

When the tcam commands are present the playbook fails with `% Invalid input` for one of the commands that are after the tcam section in the configuration as part of those commands would go missing or not attempted to be applied at the right config level. (this seems to be happening if the config after the tcam profile is a bit larger like several hundreds lines); if the config is very small then the playbook just times out (example outputs provided further down).

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
<!--- Write the short name of the module, plugin, task or feature below, use your best guess if unsure -->

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible [core 2.12.4]

but older versions have the same issue too

COLLECTION VERSION

Collection Version
---------- -------
arista.eos 5.0.1

also tried 4.1.2 and 3.1.0

CONFIGURATION
OS / ENVIRONMENT

Arista EOS 4.26 / 4.27

STEPS TO REPRODUCE

Example playbook

- hosts: leaf
  gather_facts: false
  connection: local

  tasks:
  - name: Compare generated config to running-config
    arista.eos.eos_config:
      replace: config
      src: leaf.cfg
      diff_against: session
    check_mode: true
    diff: true

example cfg file: https://gist.github.com/noredistribution/a713aa78b703c8e1a904bc1380e31851

EXPECTED RESULTS

Expect the playbook to go through and output the diff between the session-config and running-config

ACTUAL RESULTS

for longer configs such as the one provided in the gist file I get:

ansible-playbook test.yaml -i inventorytest.yaml

PLAY [test] ****************************************************************************************************************

TASK [Compare generated config to running-config] ***************************************************************************
Monday 06 June 2022  00:23:50 +0100 (0:00:00.055)       0:00:00.055 ***********
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
fatal: [192.0.5.100]: FAILED! => changed=false
  data: |-
    sion% Invalid input
    test...23:24:12(config-s-ansibl-tcam)#alias test306 show versiontest...23:24:12(config-s-ansibl)#alias test307 show versiontest...23:24:12(config-s-ansibl)#alias test308 show versiontest...23:24:12(config-s-ansibl)#alias test30
  msg: |-
    sion% Invalid input
    test...23:24:12(config-s-ansibl-tcam)#alias test306 show versiontest...23:24:12(config-s-ansibl)#alias test307 show versiontest...23:24:12(config-s-ansibl)#alias test308 show versiontest...23:24:12(config-s-ansibl)#alias test30

PLAY RECAP ******************************************************************************************************************
192.0.5.100              : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

Monday 06 June 2022  00:24:16 +0100 (0:00:25.963)       0:00:26.018 ***********
===============================================================================
Compare generated config to running-config -------------------------------------------------------------------------- 25.96s

for shorter configs (same as in the gist except for the alias commands)

fatal: [192.0.5.100]: FAILED! => changed=false
  data: 'timeout value 120 seconds reached while trying to send command: b''system profile vxlan-routing'''
  msg: 'timeout value 120 seconds reached while trying to send command: b''system profile vxlan-routing'''

or

fatal: [192.0.5.100]: FAILED! => changed=false
  data: 'timeout value 120 seconds reached while trying to send command: b''show session-config diffs'''
  msg: 'timeout value 120 seconds reached while trying to send command: b''show session-config diffs'''

Note that when doing the same via the CLI as ansible does with the eos_config module ie

configure session ansible+datetime
rollback clean-config
<paste config>

same/similar issue can be seen.
It might be better to do what CloudVision does and use copy terminal: session-config and then paste the config in one blob instead of line by line pasting. The warning would still pop up in that case but won't result in Invalid input

@Klwnt
Copy link

Klwnt commented Jun 16, 2022

Hello,

I patched the network_cli module locally to use the 'copy terminal: session-config' and did some performance tests afterwards. On our biggest router with about 6000 lines of config, the original module needs about 10 - 11 minutes to do a full config compare (initiate blank session, push the complete config, do a diff, abort). The patched module needs for the same process only about 30 seconds and it also fixes the above mentioned TCAM profile warning message issue.

If you are interested, I can provide you with my patch.

kind regards,
Claude

@GomathiselviS
Copy link
Contributor

Hi @Klwnt Please submit the PR for the same, linking this issue. We can have a look at it. Thank you for working on this.

@Klwnt Klwnt linked a pull request Jun 16, 2022 that will close this issue
@Klwnt
Copy link

Klwnt commented Jun 16, 2022

Hi @GomathiselviS , I created the PR. Hope I did everything correctly, it's my 1st contribution on Github.

@Ruchip16 Ruchip16 added the has_pr This issue has an associated PR. label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has_pr This issue has an associated PR.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants