2017-07-12 19:09:27 +02:00
|
|
|
---
|
2019-03-08 10:59:34 +01:00
|
|
|
- name: Enable Feature Privilege
|
2017-08-10 11:29:13 +02:00
|
|
|
nxos_config:
|
|
|
|
lines:
|
2018-05-08 12:01:02 +02:00
|
|
|
- feature privilege
|
2018-01-05 18:39:04 +01:00
|
|
|
connection: network_cli
|
2017-08-10 11:29:13 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-07-02 20:58:37 +02:00
|
|
|
- name: Enable Feature NXAPI
|
2017-09-28 21:09:30 +02:00
|
|
|
nxos_nxapi:
|
2018-07-02 20:58:37 +02:00
|
|
|
state: present
|
2018-01-05 18:39:04 +01:00
|
|
|
connection: network_cli
|
2017-08-10 11:29:13 +02:00
|
|
|
|
2018-08-14 06:44:13 +02:00
|
|
|
- name: Enable lldp
|
|
|
|
nxos_config:
|
|
|
|
lines:
|
|
|
|
- feature lldp
|
2018-10-12 15:41:16 +02:00
|
|
|
connection: network_cli
|
2018-08-14 06:44:13 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-07-12 19:09:27 +02: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 }}"
|
2017-09-28 21:09:30 +02:00
|
|
|
|
2017-07-12 19:09:27 +02:00
|
|
|
- name: "Collect interface list"
|
|
|
|
nxos_command:
|
|
|
|
commands: ['show interface brief | json']
|
|
|
|
timeout: 60
|
2018-01-05 18:39:04 +01:00
|
|
|
connection: network_cli
|
2017-07-12 19:09:27 +02:00
|
|
|
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 14:03:06 +02:00
|
|
|
# Get image version information for this device
|
|
|
|
- name: "Gather image version info"
|
|
|
|
nxos_command:
|
2019-06-06 12:22:55 +02:00
|
|
|
commands: ['show version | json']
|
2018-01-05 18:39:04 +01:00
|
|
|
connection: network_cli
|
2017-09-13 14:03:06 +02:00
|
|
|
register: nxos_version_output
|
|
|
|
|
|
|
|
- set_fact: image_version="{{ nxos_version_output.stdout[0]['kickstart_ver_str'] }}"
|
|
|
|
|
2017-07-12 19:09:27 +02:00
|
|
|
# Get platform information for this device
|
|
|
|
#
|
|
|
|
# Usage in integration test playbook:
|
|
|
|
#
|
|
|
|
# - name: "nxos platform "
|
|
|
|
# debug: msg="{{ platform }}"
|
|
|
|
#
|
|
|
|
- name: "Gather platform info"
|
|
|
|
nxos_command:
|
2019-06-06 12:22:55 +02:00
|
|
|
commands: ['show inventory | json']
|
2018-01-05 18:39:04 +01:00
|
|
|
connection: network_cli
|
2017-07-12 19:09:27 +02:00
|
|
|
register: nxos_inventory_output
|
|
|
|
|
|
|
|
- set_fact: platform="{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[0] }}"
|
2017-09-13 14:03:06 +02:00
|
|
|
- set_fact: chassis_type="{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[1] }}"
|
2017-07-12 19:09:27 +02:00
|
|
|
|
|
|
|
# Check if platform is fretta
|
2018-11-14 16:43:35 +01:00
|
|
|
- set_fact: fretta={% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if '-R' in row['productid'] %}"true"{% endfor %}
|
|
|
|
when: platform is match("N9K|N3K")
|
|
|
|
|
|
|
|
# Set platform to N3K-F for fretta
|
|
|
|
- set_fact: platform="N3K-F"
|
|
|
|
when: ( platform is match("N3K")) and ( fretta is search("true"))
|
2017-07-12 19:09:27 +02:00
|
|
|
|
|
|
|
# Set platform to N9K-F for fretta
|
|
|
|
- set_fact: platform="N9K-F"
|
2017-11-27 23:58:08 +01:00
|
|
|
when: ( platform is match("N9K")) and ( fretta is search("true"))
|
2017-08-10 11:29:13 +02:00
|
|
|
|
|
|
|
# Check if platform is titanium
|
2017-10-26 17:27:55 +02:00
|
|
|
- set_fact: titanium="false"
|
2017-08-10 11:29:13 +02:00
|
|
|
- set_fact: titanium={% for row in nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'] if 'NX-OSv' in row['desc']%}"true"{% endfor %}
|
2017-11-27 23:58:08 +01:00
|
|
|
when: platform is match("N7K")
|
2017-09-13 14:03:06 +02:00
|
|
|
|
|
|
|
# Set platform to N35 for N3k-35xx
|
|
|
|
- set_fact: platform="N35"
|
2017-11-27 23:58:08 +01:00
|
|
|
when: ( chassis_type is search("C35"))
|
2017-09-13 14:03:06 +02:00
|
|
|
|
|
|
|
# Set platform to N35NG for N3k-35xx running image version
|
|
|
|
# 7.0(3)I7 or later. NG(Next Gen)
|
|
|
|
- set_fact: platform="N35NG"
|
2017-11-27 23:58:08 +01:00
|
|
|
when: ( chassis_type is search("C35")) and image_version is search("7.0\(3\)I7")
|
2017-09-13 14:03:06 +02:00
|
|
|
|
2018-05-17 16:59:00 +02:00
|
|
|
# Set platform to N3L(N3K Legacy) for C3048 platform.
|
|
|
|
- set_fact: platform="N3L"
|
|
|
|
when: ( chassis_type is search("C3048"))
|
|
|
|
|
2017-09-13 14:03:06 +02:00
|
|
|
# Create matrix of simple keys based on platform
|
|
|
|
# and image version for use within test playbooks.
|
|
|
|
- set_fact: imagetag=""
|
2018-02-05 07:43:30 +01:00
|
|
|
- set_fact: imagemr=""
|
|
|
|
|
|
|
|
# Examples
|
|
|
|
# 8.0(1)
|
|
|
|
# 7.3(0)D1(1)
|
|
|
|
# 7.0(3)IHD8(1)
|
2018-07-02 20:58:37 +02:00
|
|
|
- set_fact: major_version="{{ image_version[0:3] }}"
|
2018-02-05 07:43:30 +01:00
|
|
|
- set_fact: imagetag="{{ image_version[0:3] }}"
|
|
|
|
when: image_version is search("\d\.\d\(\d\)")
|
|
|
|
- set_fact: imagetag="{{ image_version[6:8] }}"
|
|
|
|
when: image_version is search("\d\.\d\(\d\)\S\S\(\d\)")
|
|
|
|
- set_fact: imagetag="{{ image_version[6:10] }}"
|
|
|
|
when: image_version is search("\d\.\d\(\d\)\S\S\S\S\(\d\)")
|
|
|
|
|
|
|
|
- set_fact: imagemr="{{ image_version[4:5] }}"
|
|
|
|
when: image_version is search("\d\.\d\(\d\)")
|
|
|
|
- set_fact: imagemr="{{ image_version[9:10] }}"
|
|
|
|
when: image_version is search("\d\.\d\(\d\)\S\S\(\d\)")
|
|
|
|
- set_fact: imagemr="{{ image_version[11:12] }}"
|
|
|
|
when: image_version is search("\d\.\d\(\d\)\S\S\S\S\(\d\)")
|
|
|
|
|
|
|
|
- debug: msg="IMAGE VERSION {{ image_version }}"
|
|
|
|
- debug: msg="IMAGE TAG {{ imagetag }}"
|
|
|
|
- debug: msg="IMAGE MR {{ imagemr }}"
|
2018-02-17 05:46:03 +01:00
|
|
|
|
|
|
|
- set_fact: ipv6_supported="true"
|
|
|
|
- set_fact: ipv6_supported="false"
|
|
|
|
when: platform is match("N35")
|