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

fix(eos_config): Handle multiline config for RCF "code unit" #526

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

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" }

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

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

@@ -153,7 +153,7 @@ def get_session_config(
cmd = line["command"]
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.

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.

3 participants