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

[BUG] Cisco xrd - show inventory stops initialisation #1435

Closed
sdargoeuves opened this issue Oct 26, 2024 · 10 comments
Closed

[BUG] Cisco xrd - show inventory stops initialisation #1435

sdargoeuves opened this issue Oct 26, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@sdargoeuves
Copy link
Contributor

sdargoeuves commented Oct 26, 2024

Describe the bug

Started to play with the Cisco xrd, but the initialisation fails

To Reproduce

Start a lab with Cisco xrd, I have the same behaviour with verison 7.1.1 or 7.1.2

Lab topology

---
message: "TEST on XRd"
plugin: [ multilab ]
defaults.multilab.id: 3
defaults.addressing.mgmt.start: 10
provider: clab

groups:
  vl1_gws:
    device: iosxr
    module: [ ospf]
    members: [ gw1, gw2 ]

nodes:
  gw1:
    image: ios-xr/xrd-control-plane:7.11.1
  gw2:
    image: ios-xr/xrd-control-plane:7.11.1

links:
  - gw1:
    gw2:

Output

TASK [iosxr_config: deploying initial from /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/templates/initial/iosxr.j2] ********************************************************************************
fatal: [gw2]: FAILED! => changed=false
  msg: |-
    show inventory
                             ^
    % Invalid input detected at '^' marker.
    RP/0/RP0/CPU0:gw2#
fatal: [gw1]: FAILED! => changed=false
  msg: |-
    show inventory
                             ^
    % Invalid input detected at '^' marker.
    RP/0/RP0/CPU0:gw1#

PLAY RECAP *************************************************************************************************************************************************************************************************
gw1                        : ok=9    changed=0    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0
gw2                        : ok=9    changed=0    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0

Error executing ansible-playbook /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/initial-config.ansible:
  Command '['ansible-playbook', '/home/sa/code/quick-netlab-lab/netlab/netsim/ansible/initial-config.ansible']' returned non-zero exit status 2.
[FATAL]   Executing Ansible playbook /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/initial-config.ansible failed
Error executing netlab initial --no-message:
  Command '['netlab', 'initial', '--no-message']' returned non-zero exit status 1.
[FATAL]   netlab up: netlab initial failed, aborting...

Version

  • netlab version: dev

Additional context

I don't see where the command show inventory is passed to the device.

@sdargoeuves sdargoeuves added the bug Something isn't working label Oct 26, 2024
@ipspace
Copy link
Owner

ipspace commented Oct 26, 2024

"show inventory" is triggered by the Ansible iosxr_config module, it looks like that happens in the CLI plugin:

https://github.com/ansible-collections/cisco.iosxr/blob/6ba5a521c300d3ca4837c72558c9e13427a2ca40/plugins/cliconf/iosxr.py#L252

@sdargoeuves
Copy link
Contributor Author

Thanks, I should have searched for that command!
I'll investigate tonight, but from a quick look at that plugin, it's possible that the show version doesn't return enough information, but I can't remember exactly, and I don't have access to my lab

@ipspace
Copy link
Owner

ipspace commented Oct 26, 2024

Thanks, I should have searched for that command!

No problem, I knew I had never used it, so it was easy to find the culprit ;)

@sdargoeuves
Copy link
Contributor Author

sdargoeuves commented Oct 26, 2024

I was ready to look at this, and check what needs to be done, when I've realised, it's not something netlab is doing, but the iosxr ansible. I didn't pay attention to that earlier!
Looking in more details, this is something which has already been reported and potentially fixed
Not sure what can be done in the meantime as a workaround, has someone got any idea?

@ipspace
Copy link
Owner

ipspace commented Oct 27, 2024

I was ready to look at this, and check what needs to be done, when I've realised, it's not something netlab is doing, but the iosxr ansible. I didn't pay attention to that earlier! Looking in more details, this is something which has already been reported and potentially fixed Not sure what can be done in the meantime as a workaround, has someone got any idea?

Looking at the code blame and assuming I understood the printouts right, it looks like the "fix" was introduced after collection version 5.0.0, so you might try using that one.

Anyway, whatever you find, please add it to the IOS XR caveats and submit a PR.

@sdargoeuves
Copy link
Contributor Author

thanks for this tip, I had to check how to install an ansible-galaxy from a git repo, and it worked using the fork from the PR mentioned above. It didn't work using the official cisco.iosxr on the main branch:

ansible-galaxy collection install git+https://github.com/jmussmann/ansible_collection_cisco.iosxr.git,issue/509
pip install jmespath
netlab initial

Output:

  ~/code/quick-netlab-lab/minitest ❯ devlab initial                                                                                                                 netsim-main-lab with sa@sa-netlab01a
[WARNING]: Could not match supplied host pattern, ignoring: unprovisioned

PLAY [Deploy initial device configuration] *****************************************************************************************************************************************************************

TASK [Set variables that cannot be set with VARS] **********************************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Find device readiness script] ************************************************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Wait for device to become ready] *********************************************************************************************************************************************************************
included: /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/tasks/readiness-check/iosxr-clab.yml for gw1, gw2

TASK [Waiting up to 10 minutes for XRd SSH daemon to start] ************************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Deploy initial configuration] ************************************************************************************************************************************************************************
included: /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/tasks/deploy-module.yml for gw1, gw2

TASK [Figure out whether to deploy the module initial on current device] ***********************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Find configuration template for initial] *************************************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Print deployed configuration when running in verbose mode] *******************************************************************************************************************************************
skipping: [gw1]
skipping: [gw2]

TASK [Find configuration deployment deploy_script for initial] *********************************************************************************************************************************************
ok: [gw2]
ok: [gw1]

TASK [Deploy initial configuration] ************************************************************************************************************************************************************************
included: /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/tasks/deploy-config/iosxr.yml for gw1, gw2

TASK [iosxr_config: deploying initial from /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/templates/initial/iosxr.j2] ********************************************************************************
[WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device including the indentation
changed: [gw2]
changed: [gw1]

PLAY [Deploy module-specific configurations] ***************************************************************************************************************************************************************

TASK [Set variables that cannot be set with VARS] **********************************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Deploy individual configuration modules] *************************************************************************************************************************************************************
included: /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/tasks/deploy-module.yml for gw1, gw2 => (item=ospf)

TASK [Figure out whether to deploy the module ospf on current device] **************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Find configuration template for ospf] ****************************************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Print deployed configuration when running in verbose mode] *******************************************************************************************************************************************
skipping: [gw1]
skipping: [gw2]

TASK [Find configuration deployment deploy_script for ospf] ************************************************************************************************************************************************
ok: [gw1]
ok: [gw2]

TASK [Deploy ospf configuration] ***************************************************************************************************************************************************************************
included: /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/tasks/deploy-config/iosxr.yml for gw1, gw2

TASK [iosxr_config: deploying ospf from /home/sa/code/quick-netlab-lab/netlab/netsim/ansible/templates/ospf/iosxr.j2] **************************************************************************************
changed: [gw1]
changed: [gw2]

PLAY [Deploy custom deployment templates] ******************************************************************************************************************************************************************
skipping: no hosts matched

PLAY RECAP *************************************************************************************************************************************************************************************************
gw1                        : ok=17   changed=2    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0
gw2                        : ok=17   changed=2    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0

I have asked if it was possible to merge the PR, let's see... In the meantime, I'm happy to add this caveat in the docs. Let me know what you think.

@ipspace
Copy link
Owner

ipspace commented Oct 27, 2024

You could also try with ansible-galaxy collection install cisco.iosxr==5.0.0

@sdargoeuves
Copy link
Contributor Author

no luck with the 5.0.0, the latest version is cisco.iosxr:10.2.1 and that didn't work either. I don't think the fix has been merged yet.

It works with this one, but I don't know if we want to add this to the documentation, or if we prefer to wait for the merge?

ansible-galaxy collection install git+https://github.com/jmussmann/ansible_collection_cisco.iosxr.git,issue/509

@ipspace
Copy link
Owner

ipspace commented Oct 27, 2024

It works with this one, but I don't know if we want to add this to the documentation, or if we prefer to wait for the merge?

We claim XRd is supported, but when someone tries to use it, the Ansible playbook crashes. Of course we have to modify the caveats.

This was referenced Oct 27, 2024
@ipspace
Copy link
Owner

ipspace commented Oct 28, 2024

Documented as a caveat, waiting for a new version of the cisco.iosxr collection

@ipspace ipspace closed this as completed Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants