ansible/test/integration/targets/prepare_nxos_tests/tasks/main.yml

117 lines
3.7 KiB
YAML
Raw Normal View History

---
- name: Toggle feature nxapi - Enable
nxos_config:
lines:
- feature nxapi
- feature privilege
connection: network_cli
ignore_errors: yes
- name: Set nxapi to default state
nxos_nxapi:
connection: network_cli
# 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']
timeout: 60
connection: network_cli
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 image version information for this device
- name: "Gather image version info"
nxos_command:
commands: ['sh version | json']
connection: network_cli
register: nxos_version_output
- set_fact: image_version="{{ nxos_version_output.stdout[0]['kickstart_ver_str'] }}"
# 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']
connection: network_cli
register: nxos_inventory_output
- set_fact: platform="{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[0] }}"
- set_fact: chassis_type="{{ nxos_inventory_output.stdout_lines[0]['TABLE_inv']['ROW_inv'][0]['productid'].split('-')[1] }}"
# 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 is match("N9K")
# Set platform to N9K-F for fretta
- set_fact: platform="N9K-F"
when: ( platform is match("N9K")) and ( fretta is search("true"))
# Check if platform is titanium
- set_fact: titanium="false"
- 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 is match("N7K")
# Set platform to N35 for N3k-35xx
- set_fact: platform="N35"
when: ( chassis_type is 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 is search("C35")) and image_version is search("7.0\(3\)I7")
nxos bugfixes 2.5.4 cherry-pick (#40861) * Fix legacy Nexus 3k integration test and module issues. (#40322) * Add setup ignore_errors for nxos_config test * Fix parse_fan_info for n3k * Skip bidir tests for N3k * Omit vni config for n3k * Skip unsupported nxos_vrf_af test on N3K * Add legacy N3K platform tag (cherry picked from commit 63e16431b7e08d85bd9846a504f63e0d2442a1a8) * Skip N35 and N3L platforms for nxos_evpn_global test (#40333) (cherry picked from commit ad69ef88e7e67d54e42ce8e9ceae4ceaf8c09be5) * add normalize_interface in module_utils and fix nxos_l3_interface module (#40598) Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> (cherry picked from commit 0b7932db3000d58303462a6d1ff061adeff3c243) * nxos_interface: Disable switchport for loopback/svi (#40314) * nxos_interface: Disable switchport for loopback/svi * Replace interface_type with get_interface_type(name) (cherry picked from commit d04a989bd28b625747664064b8c8f58597b0f575) * fixes bug with matching nxos prompts (#40655) This change addresses an issue where the prompt matching regular expressions would not match a prompt if the hostname starts with a numeric value. Before this change, the connection would fail with a socket.timeout() error. This change updates the termnal_stdout_re values to now check for a number. See Github issue #38639 (cherry picked from commit d829ff6993aa3a7e8123d2188ab04f4bfd88c1d0) * fix nxos_vrf and migrate get_interface_type to module_utils (#40825) Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> (cherry picked from commit b4baa2d48455029cfe35b14195b2ca4616e540ac) * nxos_vlan fix Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * changelog nxos bugfixes 2.5.4 Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2018-05-30 05:51:53 +00:00
# Set platform to N3L(N3K Legacy) for C3048 platform.
- set_fact: platform="N3L"
when: ( chassis_type is search("C3048"))
# Create matrix of simple keys based on platform
# and image version for use within test playbooks.
- set_fact: imagetag=""
- set_fact: imagemr=""
# Examples
# 8.0(1)
# 7.3(0)D1(1)
# 7.0(3)IHD8(1)
- 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 }}"
- set_fact: ipv6_supported="true"
- set_fact: ipv6_supported="false"
when: platform is match("N35")