From 060888b1c6d5b02bc630e79955ed20c398dc9ca3 Mon Sep 17 00:00:00 2001 From: Mike Wiebe Date: Thu, 17 May 2018 10:59:00 -0400 Subject: [PATCH] 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) --- .../modules/network/nxos/nxos_facts.py | 8 +++++- .../tests/common/sublevel_block.yaml | 1 + .../tests/common/configure.yaml | 28 ++++++++++++++++--- .../targets/nxos_vrf/tests/common/sanity.yaml | 4 +-- .../nxos_vrf_af/tests/common/sanity.yaml | 2 +- .../targets/prepare_nxos_tests/tasks/main.yml | 4 +++ 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index e27ada941bef05..b08a204d7520ce 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -499,7 +499,13 @@ def parse_module(self, data): return objects def parse_fan_info(self, data): - data = data['fandetails']['TABLE_faninfo']['ROW_faninfo'] + objects = list() + if data.get('fandetails'): + data = data['fandetails']['TABLE_faninfo']['ROW_faninfo'] + elif data.get('fandetails_3k'): + data = data['fandetails_3k']['TABLE_faninfo']['ROW_faninfo'] + else: + return objects objects = list(self.transform_iterable(data, self.FAN_MAP)) return objects diff --git a/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml b/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml index 7a4864664d5966..a536458bada637 100644 --- a/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml +++ b/test/integration/targets/nxos_config/tests/common/sublevel_block.yaml @@ -8,6 +8,7 @@ lines: no ip access-list test provider: "{{ connection }}" match: none + ignore_errors: yes - name: configure sub level command using block replace nxos_config: diff --git a/test/integration/targets/nxos_pim_rp_address/tests/common/configure.yaml b/test/integration/targets/nxos_pim_rp_address/tests/common/configure.yaml index c39e1f71deee88..da4cf024cf43cf 100644 --- a/test/integration/targets/nxos_pim_rp_address/tests/common/configure.yaml +++ b/test/integration/targets/nxos_pim_rp_address/tests/common/configure.yaml @@ -3,6 +3,10 @@ - debug: msg="Using provider={{ connection.transport }}" when: ansible_connection == "local" +- set_fact: bidir="true" +- set_fact: bidir="false" + when: platform is match("N3L") + - block: - name: "Disable feature PIM" nxos_feature: &disable_feature @@ -20,7 +24,7 @@ nxos_pim_rp_address: &configgl rp_address: "10.1.1.20" group_list: "224.0.0.0/8" - bidir: True + bidir: "{{ bidir }}" state: present provider: "{{ connection }}" register: result @@ -45,19 +49,23 @@ state: present provider: "{{ connection }}" register: result + when: platform is not match("N3L") - assert: *true + when: platform is not match("N3L") - name: Check idempotence rp_address + group_list remove bidir nxos_pim_rp_address: *configglnb register: result + when: platform is not match("N3L") - assert: *false + when: platform is not match("N3L") - name: Configure rp_address + bidir nxos_pim_rp_address: &configbi rp_address: "10.1.1.20" - bidir: True + bidir: "{{ bidir }}" state: present provider: "{{ connection }}" register: result @@ -77,14 +85,18 @@ state: present provider: "{{ connection }}" register: result + when: platform is not match("N3L") - assert: *true + when: platform is not match("N3L") - name: Check idempotence rp_address remove bidir nxos_pim_rp_address: *confignbi register: result + when: platform is not match("N3L") - assert: *false + when: platform is not match("N3L") - name: Remove rp_address + group_list nxos_pim_rp_address: &configglr @@ -121,7 +133,7 @@ nxos_pim_rp_address: &configpl rp_address: "10.1.1.20" prefix_list: "pim_prefix_list" - bidir: True + bidir: "{{ bidir }}" state: present provider: "{{ connection }}" register: result @@ -142,14 +154,18 @@ state: present provider: "{{ connection }}" register: result + when: platform is not match("N3L") - assert: *true + when: platform is not match("N3L") - name: Check idempotence rp_address + prefix_list nxos_pim_rp_address: *configplnbi register: result + when: platform is not match("N3L") - assert: *false + when: platform is not match("N3L") - name: Remove rp_address + prefix_list nxos_pim_rp_address: &configplr @@ -172,7 +188,7 @@ nxos_pim_rp_address: &configrm rp_address: "10.1.1.20" route_map: "pim_routemap" - bidir: True + bidir: "{{ bidir }}" state: present provider: "{{ connection }}" register: result @@ -193,14 +209,18 @@ state: present provider: "{{ connection }}" register: result + when: platform is not match("N3L") - assert: *true + when: platform is not match("N3L") - name: Check idempotence rp_address + route_map nxos_pim_rp_address: *configrmnbi register: result + when: platform is not match("N3L") - assert: *false + when: platform is not match("N3L") - name: Remove rp_address + route_map nxos_pim_rp_address: &configrmr diff --git a/test/integration/targets/nxos_vrf/tests/common/sanity.yaml b/test/integration/targets/nxos_vrf/tests/common/sanity.yaml index 36a4224d66481d..43327d1d8b98d1 100644 --- a/test/integration/targets/nxos_vrf/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vrf/tests/common/sanity.yaml @@ -13,10 +13,10 @@ when: (platform is not match("N35|N7K")) and ((imagetag != 'I2')) - set_fact: vnind="5000" - when: platform is not match("N35|N7K") + when: platform is not match("N35|N7K|N3L") - set_fact: vnid="default" - when: platform is not match("N35|N7K") + when: platform is not match("N35|N7K|N3L") - name: "Enable feature BGP" nxos_feature: diff --git a/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml b/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml index 76e2e7a078bb3c..e6ac462513854f 100644 --- a/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml +++ b/test/integration/targets/nxos_vrf_af/tests/common/sanity.yaml @@ -130,7 +130,7 @@ - assert: *false - when: not platform is search("N35") + when: not platform is search("N35|N3L") always: - name: Remove vrf diff --git a/test/integration/targets/prepare_nxos_tests/tasks/main.yml b/test/integration/targets/prepare_nxos_tests/tasks/main.yml index c27ae749008b5d..958b533a77e594 100644 --- a/test/integration/targets/prepare_nxos_tests/tasks/main.yml +++ b/test/integration/targets/prepare_nxos_tests/tasks/main.yml @@ -80,6 +80,10 @@ - set_fact: platform="N35NG" when: ( chassis_type is search("C35")) and image_version is search("7.0\(3\)I7") +# 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=""