2017-07-12 17:09:27 +00:00
|
|
|
---
|
2017-08-10 09:29:13 +00:00
|
|
|
# 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
|
2016-10-28 18:50:29 +00:00
|
|
|
provider: "{{ cli }}"
|
2017-06-29 18:55:08 +00:00
|
|
|
ignore_errors: yes
|
2017-07-12 17:09:27 +00:00
|
|
|
|
2017-08-10 09:29:13 +00:00
|
|
|
# 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
|
|
|
|
|
2017-07-12 17:09:27 +00:00
|
|
|
# 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 }}"
|
|
|
|
|
2017-09-13 12:03:06 +00:00
|
|
|
# Get image version information for this device
|
|
|
|
- name: "Gather image version info"
|
|
|
|
nxos_command:
|
|
|
|
commands: ['sh version | json']
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
register: nxos_version_output
|
|
|
|
|
|
|
|
- set_fact: image_version="{{ nxos_version_output.stdout[0]['kickstart_ver_str'] }}"
|
|
|
|
|
2017-07-12 17:09:27 +00:00
|
|
|
# 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] }}"
|
2017-09-13 12:03:06 +00:00
|
|
|
- set_fact: chassis_type="{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[1] }}"
|
2017-07-12 17:09:27 +00:00
|
|
|
|
|
|
|
# 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"))
|
2017-08-10 09:29:13 +00:00
|
|
|
|
|
|
|
# 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")
|
2017-09-13 12:03:06 +00:00
|
|
|
|
|
|
|
# Set platform to N35 for N3k-35xx
|
|
|
|
- set_fact: platform="N35"
|
|
|
|
when: (chassis_type | search("C35"))
|
|
|
|
|
|
|
|
# Set platform to N35NG for N3k-35xx running image version
|
|
|
|
# 7.0(3)I7 or later. NG(Next Gen)
|
|
|
|
- set_fact: platform="N35NG"
|
|
|
|
when: (chassis_type | search("C35")) and image_version | search("7.0\(3\)I7")
|
|
|
|
|
|
|
|
# Create matrix of simple keys based on platform
|
|
|
|
# and image version for use within test playbooks.
|
|
|
|
- set_fact: imagetag=""
|
|
|
|
- set_fact: imagetag="I2"
|
|
|
|
when: image_version | search("7.0\(3\)I2")
|
|
|
|
- set_fact: imagetag="I3"
|
|
|
|
when: image_version | search("7.0\(3\)I3")
|
|
|
|
- set_fact: imagetag="I4"
|
|
|
|
when: image_version | search("7.0\(3\)I4")
|
|
|
|
- set_fact: imagetag="I5"
|
|
|
|
when: image_version | search("7.0\(3\)I5")
|
|
|
|
- set_fact: imagetag="I6"
|
|
|
|
when: image_version | search("7.0\(3\)I6")
|
|
|
|
- set_fact: imagetag="I7"
|
|
|
|
when: image_version | search("7.0\(3\)I7")
|
|
|
|
- set_fact: imagetag="F1"
|
|
|
|
when: image_version | search("7.0\(3\)F1")
|
|
|
|
- set_fact: imagetag="F2"
|
|
|
|
when: image_version | search("7.0\(3\)F2")
|
|
|
|
- set_fact: imagetag="F3"
|
|
|
|
when: image_version | search("7.0\(3\)F3")
|