Fixes nxos_l2_interface tests (#34514)

* Update nxos tests that got missed in the first pass

* Add setup for setting interfaces to layer2
This commit is contained in:
Nathaniel Case 2018-01-05 17:01:45 -05:00 committed by GitHub
parent e9bb5da37e
commit c5d0b15160
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 103 additions and 45 deletions

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/negative.yaml"
- debug: msg="START connection={{ ansible_connection }}/negative.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: run 11 commands
nxos_command:
@ -24,4 +26,4 @@
- result.failed
- debug: msg="END {{ connection.transport }}/negative.yaml"
- debug: msg="END connection={{ ansible_connection }}/negative.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/backup.yaml"
- debug: msg="START connection={{ ansible_connection }}/backup.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
@ -54,4 +56,4 @@
that:
- "backup_files.files is defined"
- debug: msg="END {{ connection.transport }}/backup.yaml"
- debug: msg="END connection={{ ansible_connection }}/backup.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/defaults.yaml"
- debug: msg="START connection={{ ansible_connection }}/defaults.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
@ -50,4 +52,4 @@
- "result.changed == false"
- "result.updates is not defined"
- debug: msg="END {{ connection.transport }}/defaults.yaml"
- debug: msg="END connection={{ ansible_connection }}/defaults.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/save.yaml"
- debug: msg="START connection={{ ansible_connection }}/save.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
@ -36,4 +38,4 @@
that:
- "result.changed == true"
- debug: msg="END {{ connection.transport }}/save.yaml"
- debug: msg="END connection={{ ansible_connection }}/save.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/src_basic.yaml"
- debug: msg="START connection={{ ansible_connection }}/src_basic.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
@ -48,4 +50,4 @@
# https://github.com/ansible/ansible-modules-core/issues/4807
- "result.updates is not defined"
- debug: msg="END {{ connection.transport }}/src_basic.yaml"
- debug: msg="END connection={{ ansible_connection }}/src_basic.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/src_invalid.yaml"
- debug: msg="START connection={{ ansible_connection }}/src_invalid.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Defend https://github.com/ansible/ansible-modules-core/issues/4797
@ -16,4 +18,4 @@
- "result.failed == true"
- "result.msg == 'path specified in src not found'"
- debug: msg="END {{ connection.transport }}/src_invalid.yaml"
- debug: msg="END connection={{ ansible_connection }}/src_invalid.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/src_match_none.yaml"
- debug: msg="START connection={{ ansible_connection }}/src_match_none.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
@ -50,4 +52,4 @@
- "result.changed == false"
- "result.updates is not defined"
- debug: msg="END {{ connection.transport }}/src_match_none.yaml"
- debug: msg="END connection={{ ansible_connection }}/src_match_none.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg='START {{ connection.transport }}/sublevel_block.yaml'
- debug: msg='START connection={{ ansible_connection }}/sublevel_block.yaml'
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -54,4 +56,4 @@
provider: "{{ connection }}"
match: none
- debug: msg='END {{ connection.transport }}/sublevel_block.yaml'
- debug: msg='END connection={{ ansible_connection }}/sublevel_block.yaml'

View file

@ -1,5 +1,7 @@
---
- debug: msg='START {{ connection.transport }}/toplevel.yaml'
- debug: msg='START connection={{ ansible_connection }}/toplevel.yaml'
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -34,4 +36,4 @@
provider: "{{ connection }}"
match: none
- debug: msg='END {{ connection.transport }}/toplevel.yaml'
- debug: msg='END connection={{ ansible_connection }}/toplevel.yaml'

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/nonidempotent.yaml"
- debug: msg="START connection={{ ansible_connection }}/nonidempotent.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -36,4 +38,4 @@
provider: "{{ connection }}"
match: none
- debug: msg="END {{ connection.transport }}/nonidempotent.yaml"
- debug: msg="END connection={{ ansible_connection }}/nonidempotent.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/all_facts.yaml"
- debug: msg="START connection={{ ansible_connection }}/all_facts.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: test getting all facts
@ -33,4 +35,4 @@
- "result.ansible_facts.ansible_net_memfree_mb > 1"
- "result.ansible_facts.ansible_net_memtotal_mb > 1"
- debug: msg="END {{ connection.transport }}/all_facts.yaml"
- debug: msg="END connection={{ ansible_connection }}/all_facts.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/default_facts.yaml"
- debug: msg="START connection={{ ansible_connection }}/default_facts.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: test getting default facts

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/invalid_subset.yaml"
- debug: msg="START connection={{ ansible_connection }}/invalid_subset.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: test invalid subset (foobar)
@ -45,4 +47,4 @@
- debug: msg="END {{ connection.transport }}/invalid_subset.yaml"
- debug: msg="END connection={{ ansible_connection }}/invalid_subset.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/not_hardware_facts.yaml"
- debug: msg="START connection={{ ansible_connection }}/not_hardware_facts.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: test not hardware
@ -29,4 +31,4 @@
# ... and not present
- "result.ansible_facts.ansible_net_filesystems is not defined"
- debug: msg="END {{ connection.transport }}/not_hardware_facts.yaml"
- debug: msg="END connection={{ ansible_connection }}/not_hardware_facts.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/configure.yaml"
- debug: msg="START connection={{ ansible_connection }}/configure.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -57,4 +59,4 @@
match: none
provider: "{{ connection }}"
- debug: msg="END {{ connection.transport }}/configure.yaml"
- debug: msg="END connection={{ ansible_connection }}/configure.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/invalid.yaml"
- debug: msg="START connection={{ ansible_connection }}/invalid.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: configure invalid feature name
nxos_feature:
@ -12,4 +14,4 @@
that:
- result.failed == true
- debug: msg="END {{ connection.transport }}/invalid.yaml"
- debug: msg="END connection={{ ansible_connection }}/invalid.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/set_state_absent.yaml"
- debug: msg="START connection={{ ansible_connection }}/set_state_absent.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -29,4 +31,4 @@
that:
- "result.changed == false"
- debug: msg="END {{ connection.transport }}/set_state_absent.yaml"
- debug: msg="END connection={{ ansible_connection }}/set_state_absent.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/set_state_present.yaml"
- debug: msg="START connection={{ ansible_connection }}/set_state_present.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -32,4 +34,4 @@
that:
- "result.changed == false"
- debug: msg="END {{ connection.transport }}/set_state_present.yaml"
- debug: msg="END connection={{ ansible_connection }}/set_state_present.yaml"

View file

@ -3,12 +3,14 @@
find:
paths: "{{ role_path }}/tests/common"
patterns: "{{ testcase }}.yaml"
connection: local
register: test_cases
- name: collect nxapi test cases
find:
paths: "{{ role_path }}/tests/nxapi"
patterns: "{{ testcase }}.yaml"
connection: local
register: nxapi_cases
- set_fact:
@ -18,8 +20,8 @@
- name: set test_items
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
- name: run test case
include: "{{ test_case_to_run }} connection={{ nxapi }}"
- name: run test cases (connection=local)
include: "{{ test_case_to_run }} ansible_connection=local connection={{ nxapi }}"
with_items: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run

View file

@ -12,6 +12,13 @@
vlan_range: "6,15"
provider: "{{ connection }}"
- name: Setup - Ensure interfaces are layer2
nxos_interface:
aggregate:
- { name: "{{ intname1 }}" }
- { name: "{{ intname2 }}" }
mode: layer2
- name: Setup - Remove interface aggregate before testing
nxos_l2_interface:
aggregate:

View file

@ -16,6 +16,11 @@
provider: "{{ connection }}"
ignore_errors: yes
- name: Setup - Ensure interface is layer2
nxos_interface:
interface: "{{ intname }}"
mode: layer2
- name: "Setup vlans"
nxos_vlan:
vlan_range: "5-10,20"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/set_mtu.yaml"
- debug: msg="START connection={{ ansible_connection }}/set_mtu.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- set_fact: testint="{{ nxos_int1 }}"
@ -65,4 +67,4 @@
match: none
provider: "{{ connection }}"
- debug: msg="END {{ connection.transport }}/set_mtu.yaml"
- debug: msg="END connection={{ ansible_connection }}/set_mtu.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/sysmtu.yaml"
- debug: msg="START connection={{ ansible_connection }}/sysmtu.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -55,4 +57,4 @@
match: none
provider: "{{ connection }}"
- debug: msg="END {{ connection.transport }}/sysmtu.yaml"
- debug: msg="END connection={{ ansible_connection }}/sysmtu.yaml"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }} nxos_pim_rp_address sanity"
- debug: msg="START connection={{ ansible_connection }} nxos_pim_rp_address sanity"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- set_fact: bidir="false"
when: platform is search('N3K')
@ -127,4 +129,4 @@
- name: "Disable feature PIM"
nxos_feature: *disable_feature
- debug: msg="END {{ connection.transport }} nxos_pim_rp_address sanity"
- debug: msg="END connection={{ ansible_connection }} nxos_pim_rp_address sanity"

View file

@ -1,5 +1,7 @@
---
- debug: msg="START {{ connection.transport }}/set_hostname.yaml"
- debug: msg="START connection={{ ansible_connection }}/set_hostname.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
- name: setup
nxos_config:
@ -33,4 +35,4 @@
match: none
provider: "{{ connection }}"
- debug: msg="END {{ connection.transport }}/set_hostname.yaml"
- debug: msg="END connection={{ ansible_connection }}/set_hostname.yaml"