-
Notifications
You must be signed in to change notification settings - Fork 1k
Improve "Verify all interfaces are up" error handling #749
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| - block: | ||
| - name: Gathering lab graph facts about the device | ||
| conn_graph_facts: host={{ inventory_hostname }} | ||
| connection: local | ||
|
|
||
| - name: Fanout hostname | ||
| set_fact: fanout_switch={{ device_conn['Ethernet0']['peerdevice'] }} | ||
|
|
||
| - name: Check Fanout interfaces | ||
| local_action: shell ansible-playbook -i lab fanout.yml -l {{ fanout_switch }} --tags check_interfaces_status | ||
| ignore_errors: yes | ||
|
|
||
| when: | ||
| - check_fanout is defined | ||
|
|
||
| - block: | ||
| - name: Get Portchannel status | ||
| shell: show interfaces portchannel | ||
| register: portchannel_status | ||
| ignore_errors: yes | ||
|
|
||
| - name: Get teamd dump | ||
| shell: teamdctl '{{ item }}' state dump | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where the output does go?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All gathered info goes to the execution console, where it will be extracted if needed.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we save the output into the variable and output it as
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, its simple imrovement, but will be done as new PR (this source branch doesn't exist anymore).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To handle this case, I opened another PR, that includes this changes as well |
||
| with_items: "{{ minigraph_portchannels }}" | ||
| ignore_errors: yes | ||
| when: | ||
| - minigraph_portchannels is defined | ||
|
|
||
| - name: Define testbed_name when not obtained | ||
| set_fact: | ||
| testbed_name: "{{ inventory_hostname + '-' + topo }}" | ||
| when: testbed_name is not defined | ||
|
|
||
| - name: Gathering testbed information | ||
| test_facts: testbed_name="{{ testbed_name }}" | ||
| connection: local | ||
| ignore_errors: yes | ||
|
|
||
| - name: Gather vm list from Testbed server | ||
| local_action: shell ansible-playbook testbed_vm_status.yml -i veos -l "{{ testbed_facts['server'] }}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where the output does go?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All gathered info goes to the execution console, where it will be extracted if needed.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we save the output into the variable and output it as
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the same explanation as in the first conversation. When interfaces.yml fails, check_testbed_interface.yml plays another playbook - testbed_vm_status.yml: testbed_vm_status.yml has register/debug of output but it only will be shown in verbose mode -vvvvv of the outer playbook: |
||
| ignore_errors: yes | ||
|
|
||
| - set_fact: | ||
| vms: "{{ minigraph_devices }}" | ||
| peer_hwsku: 'Arista-VM' | ||
|
|
||
| - name: Gather Port-Channel status from VMs | ||
| action: apswitch template=roles/vm_set/templates/show_int_portchannel_status.j2 | ||
| args: | ||
| host: "{{ vms[item]['mgmt_addr'] }}" | ||
| login: "{{ switch_login[hwsku_map[peer_hwsku]] }}" | ||
| connection: switch | ||
| ignore_errors: yes | ||
| when: vms["{{ item }}"]['hwsku'] == 'Arista-VM' | ||
| with_items: vms | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where the output does go?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All gathered info goes to the execution console, where it will be extracted if needed.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we save the output into the variable and output it as
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, its simple imrovement, but will be done as new PR (this source brunch doesn't exist anymore).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To handle this case, I opened another PR, that includes this changes as well |
||
|
|
||
| when: check_vms is defined | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| show interfaces Port-Channel 1-$ status |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Example: | ||
| # ansible-playbook testbed_vm_status.yml -i veos -l server_1 | ||
| - hosts: servers:&vm_host | ||
| tasks: | ||
| - name: Get VM statuses from Testbed server | ||
| shell: virsh list | ||
| register: virsh_list | ||
| - name: Show VM statuses | ||
| debug: msg="{{ virsh_list['stdout_lines'] }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where the output does go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All gathered info goes to the execution console, where it will be extracted if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we save the output into the variable and output it as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it has register/debug of output:
When interfaces.yml fails,
it calls check_testbed_interfaces.yml with check_fanout: true
check_testbed_interface.yml plays another playbook - fanout.yml with tag check_interfaces_status:
local_action: shell ansible-playbook -i lab fanout.yml -l {{ fanout_switch }} --tags check_interfaces_statuswhich in turns calls fanout main.yml
which contains our custom block (which was not upstreamed):
Here we expect any team may have their own block relevant to specific vendor, called by
tags: check_interfaces_statusThat is why you might have not got any information when you ran the test.