1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/prepare_nxos_tests/tasks/main.yml
rahushen 85fc4c67ef Add integration tests for nxos_facts, nxos_bgp, nxos_bgp_af, nxos_bgp_neighbor, and nxos_evpn_global (#26924)
* Add new ITs for nxos_bgp, nxos_bgp_af, nxos_bgp_neighbor, and nxos_evpn_global

* Add nxos_facts IT and enhance existing tests

* switch nxos_feature tests to use bgp

* misc. test fixes

* Add checks for titanium in IT

* Handle non-titanium case in tests
2017-08-10 05:29:13 -04:00

76 lines
2.2 KiB
YAML

---
# There is a bug currently where the nxapi server can get
# stuck in a bad state when enabling/disabling rapidly by
# the integration tests.
#
# Toggle the command off/on as mitigation.
- name: Toggle feature nxapi - Disable
nxos_config:
lines:
- no feature nxapi
provider: "{{ cli }}"
ignore_errors: yes
# Pause after disabling nxapi
- pause:
seconds: 3
- name: Toggle feature nxapi - Enable
nxos_config:
lines:
- feature nxapi
provider: "{{ cli }}"
ignore_errors: yes
# Pause after enabling nxapi
- pause:
seconds: 3
# Gather the list of interfaces on this device and make the list
# available for integration tests that need them.
#
# Usage in integration test playbook:
#
# - set_fact: testint="{{ nxos_int1 }}"
#
# - name: "Interface selected for this test"
# debug: msg="{{ testint }}"
#
- name: "Collect interface list"
nxos_command:
commands: ['show interface brief | json']
provider: "{{ nxapi }}"
timeout: 60
register: intout
- set_fact: intdataraw="{{ intout.stdout_lines[0]['TABLE_interface']['ROW_interface'] }}"
- set_fact: nxos_int1="{{ intdataraw[1].interface }}"
- set_fact: nxos_int2="{{ intdataraw[2].interface }}"
- set_fact: nxos_int3="{{ intdataraw[3].interface }}"
# Get platform information for this device
#
# Usage in integration test playbook:
#
# - name: "nxos platform "
# debug: msg="{{ platform }}"
#
- name: "Gather platform info"
nxos_command:
commands: ['sh inventory | json']
provider: "{{ cli }}"
register: nxos_inventory_output
- set_fact: platform="{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[0] }}"
# Check if platform is fretta
- set_fact: fretta={% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if 'FM-R' in row['productid'] %}"true"{% endfor %}
when: platform | match("N9K")
# Set platform to N9K-F for fretta
- set_fact: platform="N9K-F"
when: (platform | match("N9K")) and (fretta | search("true"))
# Check if platform is titanium
- set_fact: titanium={% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if 'NX-OSv' in row['desc']%}"true"{% endfor %}
when: platform | match("N7K")