Skip to content

Conversation

@ClausHolbechArista
Copy link

SUMMARY

Fix error when configuring router control-functions by handling them as multiline inputs similar to how "banner" is handled.

Also added testing of multi line config. Using "banner" for this test, since RCF requires a much newer EOS version.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

eos_config

ADDITIONAL INFORMATION

Fix handling of multi line config sections starting with "code unit" similar to how "banner" commands are handles.

Example of configuration failing today:

router general
   control-functions
      code unit MYUNIT1
         function ACCEPT_ALL() {
           return true;
           }
         EOF
      compile
      commit

Without this fix, the module returns an error:

fatal: [leaf1-dc1]: FAILED! => { "changed": false, "module_stderr": "Invalid input (at token 0: 'function')", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error" }

@softwarefactory-project-zuul
Copy link

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/76828ba3d5e24aabba4b0dea0df56d94

ansible-test-network-integration-eos-httpapi-python39-stable215 FAILURE in 15m 05s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable214 SUCCESS in 45m 14s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable213 SUCCESS in 41m 20s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable212 SUCCESS in 35m 17s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable211 SUCCESS in 41m 05s
✔️ ansible-test-network-integration-eos-network_cli-python39-stable215-scenario01 SUCCESS in 33m 46s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable215-scenario02 SUCCESS in 31m 24s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario01 SUCCESS in 40m 17s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario02 SUCCESS in 36m 39s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable214-scenario01 SUCCESS in 38m 11s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable214-scenario02 SUCCESS in 35m 55s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario01 SUCCESS in 33m 31s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario02 SUCCESS in 35m 33s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable213-scenario01 SUCCESS in 37m 53s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable213-scenario02 SUCCESS in 35m 24s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario01 SUCCESS in 39m 37s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario02 SUCCESS in 36m 35s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable212-scenario01 SUCCESS in 37m 28s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable212-scenario02 SUCCESS in 36m 02s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario01 SUCCESS in 38m 43s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario02 SUCCESS in 35m 34s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable211-scenario01 SUCCESS in 39m 17s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-python39-stable211-scenario02 SUCCESS in 35m 18s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario01 SUCCESS in 37m 24s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario02 SUCCESS in 36m 07s (non-voting)
✔️ build-ansible-collection SUCCESS in 11m 50s
✔️ ansible-tox-linters SUCCESS in 14m 12s
✔️ ansible-galaxy-importer SUCCESS in 4m 22s

@softwarefactory-project-zuul
Copy link

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/1f0e02cdbb10420eab7e885f9d5127ac

ansible-test-network-integration-eos-httpapi-python39-stable215 ERROR Failed to update project ansible/ansible in 3s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable214 SUCCESS in 44m 33s
ansible-test-network-integration-eos-httpapi-python39-stable213 ERROR Failed to update project ansible/ansible in 6s
ansible-test-network-integration-eos-httpapi-python39-stable212 ERROR Failed to update project ansible/ansible in 4s
✔️ ansible-test-network-integration-eos-httpapi-python39-stable211 SUCCESS in 36m 06s
✔️ ansible-test-network-integration-eos-network_cli-python39-stable215-scenario01 SUCCESS in 33m 58s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable215-scenario02 ERROR Failed to update project ansible/ansible in 3s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario01 SUCCESS in 34m 02s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39-stable215-scenario02 ERROR Failed to update project ansible/ansible in 5s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable214-scenario01 ERROR Failed to update project ansible/ansible in 4s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable214-scenario02 ERROR Failed to update project ansible/ansible in 5s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario01 ERROR Failed to update project ansible/ansible in 7s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39-stable214-scenario02 ERROR Failed to update project ansible/ansible in 6s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable213-scenario01 ERROR Failed to update project ansible/ansible in 7s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable213-scenario02 ERROR Failed to update project ansible/ansible in 5s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario01 SUCCESS in 33m 32s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable213-scenario02 SUCCESS in 30m 46s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable212-scenario01 ERROR Failed to update project ansible/ansible in 8s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable212-scenario02 ERROR Failed to update project ansible/ansible in 5s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario01 ERROR Failed to update project ansible/ansible in 3s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39-stable212-scenario02 ERROR Failed to update project ansible/ansible in 5s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable211-scenario01 ERROR Failed to update project ansible/ansible in 5s (non-voting)
ansible-test-network-integration-eos-network_cli-python39-stable211-scenario02 ERROR Failed to update project ansible/ansible in 5s (non-voting)
✔️ ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario01 SUCCESS in 37m 56s (non-voting)
ansible-test-network-integration-eos-network_cli-libssh-python39-stable211-scenario02 ERROR Failed to update project ansible/ansible in 5s (non-voting)
✔️ build-ansible-collection SUCCESS in 9m 44s
✔️ ansible-tox-linters SUCCESS in 11m 47s
✔️ ansible-galaxy-importer SUCCESS in 4m 50s

if cmd == "end":
continue
if cmd.startswith("banner") or multiline:
if cmd.startswith(("banner", "code unit")) or multiline:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting with code unit will not capture all the RCF multiline code units. We also have the singular unnamed code unit whose EOS config cmd is simply code instead of code unit FOO.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is no context awareness here, we would then catch all lines starting with code no matter where in the CLI they are placed. Can you guarantee that we do not have code anywhere else? or maybe code is on a line by itself?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't guarantee that we do not have "code" in any other CLI command. In the absense of mode/context awareness, I think checking for "code" on a line by itself is probably the best option.

@somakelemen
Copy link

Hi @rohitthakur2590 ,

did you have a chance to take a look on this PR?

And/or @ClausHolbechArista @keon-arista is there any other option to use RCF?
Thanks!

@keon-arista
Copy link

Hi @rohitthakur2590 ,

did you have a chance to take a look on this PR?

And/or @ClausHolbechArista @keon-arista is there any other option to use RCF? Thanks!

Hi @somakelemen, can you expand on what you mean by "other option to use RCF"? Are you looking for alternative configuration workflows with ansible, without it, or something entirely different?

@somakelemen
Copy link

Hi @rohitthakur2590 ,
did you have a chance to take a look on this PR?
And/or @ClausHolbechArista @keon-arista is there any other option to use RCF? Thanks!

Hi @somakelemen, can you expand on what you mean by "other option to use RCF"? Are you looking for alternative configuration workflows with ansible, without it, or something entirely different?

Yes, I am looking for an alternative workaround until this PR will be approved/merged and ready to configure RCF with ansible.

@keon-arista
Copy link

Hi @rohitthakur2590 ,
did you have a chance to take a look on this PR?
And/or @ClausHolbechArista @keon-arista is there any other option to use RCF? Thanks!

Hi @somakelemen, can you expand on what you mean by "other option to use RCF"? Are you looking for alternative configuration workflows with ansible, without it, or something entirely different?

Yes, I am looking for an alternative workaround until this PR will be approved/merged and ready to configure RCF with ansible.

I am not very familiar with Ansible, so I will let Claus address if there are any workarounds using Ansible. If you are comfortable staging the RCF code unit as a text file on the box, you can use the "pull unit " command to pull the contents of a file into a RCF code unit. That will avoid having to specify the RCF code unit contents as a multiline input.

Outside Ansible, you are free to use any other mechanism of configuring EOS (native CLI, EAPI, etc.) to configure RCF.

@ClausHolbechArista
Copy link
Author

@somakelemen I do not have a workaround, but this works well if you use CloudVision for deploying the configs (also from Ansible). This PR stalled because I discovered that netcommon components also silently remove lines with a single }. While trying to fix that I found more components that modifies the CLI commands, so it required too many changes for what I could do.

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

Successfully merging this pull request may close these issues.

4 participants