Skip to content

Commit

Permalink
Fix legacy Nexus 3k integration test and module issues. (ansible#40322)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mikewiebe authored and trishnaguha committed May 17, 2018
1 parent e493891 commit 63e1643
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
8 changes: 7 additions & 1 deletion lib/ansible/modules/network/nxos/nxos_facts.py
Expand Up @@ -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

Expand Down
Expand Up @@ -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:
Expand Down
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/integration/targets/nxos_vrf/tests/common/sanity.yaml
Expand Up @@ -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:
Expand Down
Expand Up @@ -130,7 +130,7 @@

- assert: *false

when: not platform is search("N35")
when: not platform is search("N35|N3L")

always:
- name: Remove vrf
Expand Down
4 changes: 4 additions & 0 deletions test/integration/targets/prepare_nxos_tests/tasks/main.yml
Expand Up @@ -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=""
Expand Down

0 comments on commit 63e1643

Please sign in to comment.