Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ansible/roles/test/tasks/check_fanout_interfaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- 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
register: fanout_interfaces_status

- name: Debug Fanout interfaces
debug: msg={{ fanout_interfaces_status }}
when: fanout_interfaces_status is defined

when: check_fanout is defined
57 changes: 57 additions & 0 deletions ansible/roles/test/tasks/check_sw_vm_interfaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
- block:
- name: Get Portchannel status
shell: show interfaces portchannel
register: portchannel_status
ignore_errors: yes

- name: Get teamd dump
shell: teamdctl '{{ item }}' state dump
with_items: "{{ minigraph_portchannels }}"
ignore_errors: yes
register: teamd_dump
when:
- minigraph_portchannels is defined

- name: Debug teamd dump
debug: msg={{ teamd_dump }}
when: teamd_dump 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'] }}"
ignore_errors: yes
register: testbed_vm_list

- name: Debug VM list on Testbed
debug: msg={{ testbed_vm_list }}
when: testbed_vm_list is defined

- 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
register: vm_portchannel_status

- name: Debug Port-Channel on VMs
debug: msg={{ vm_portchannel_status }}
when: vm_portchannel_status is defined

when: check_vms is defined
24 changes: 19 additions & 5 deletions ansible/roles/test/tasks/interface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,26 @@
- debug: msg="Found link down ports {{ansible_interface_link_down_ports}}"
when: ansible_interface_link_down_ports | length > 0

- name: Verify interfaces are up correctly
assert: { that: "{{ ansible_interface_link_down_ports | length }} == 0" }
- block:
- name: Verify interfaces are up correctly
assert: { that: "{{ ansible_interface_link_down_ports | length }} == 0" }
rescue:
- include: check_fanout_interfaces.yml
vars:
check_fanout: true
- debug: msg="Not all Interfaces are up"

- name: Verify port channel interfaces are up correctly
assert: { that: "'{{ ansible_interface_facts[item]['active'] }}' == 'True'" }
with_items: "{{ minigraph_portchannels.keys() }}"
- block:
- name: Verify port channel interfaces are up correctly
assert: { that: "'{{ ansible_interface_facts[item]['active'] }}' == 'True'" }
with_items: "{{ minigraph_portchannels.keys() }}"

rescue:
- include: check_sw_vm_interfaces.yml
vars:
check_vms: true
- debug: msg="Not all PortChannels are up '{{ portchannel_status['stdout_lines'] }}' "
when: portchannel_status is defined

- name: Verify VLAN interfaces are up correctly
assert: { that: "'{{ ansible_interface_facts[item]['active'] }}' == 'True'" }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
show interfaces Port-Channel 1-$ status
7 changes: 7 additions & 0 deletions ansible/testbed_vm_status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- 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'] }}"