nxos_lacp_interfaces: fix integration test dependencies (#61947)

* nxos_lacp_interfaces: fix integration test dependencies

* Add conditional mode test to m/d/r tests

(cherry picked from commit 6e72893d78)
This commit is contained in:
Chris Van Heuveln 2019-09-12 12:15:04 -04:00 committed by Toshio Kuratomi
parent 0b771869ea
commit 6377e6c9e8
6 changed files with 79 additions and 13 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- nxos_lacp_interfaces fix integration test dependencies (https://github.com/ansible/ansible/pull/61947).

View file

@ -1 +1,2 @@
dependencies: []
dependencies:
- prepare_nxos_tests

View file

@ -2,6 +2,10 @@
- debug:
msg: "Start nxos_lacp_interfaces deleted integration tests connection={{ ansible_connection }}"
- set_fact:
mode: delay
when: platform is not search('N5K|N6K|N7K') and ((imagetag != 'I2'))
- name: setup1
cli_config: &cleanup
config: |
@ -17,7 +21,15 @@
interface port-channel5
lacp min-links 5
interface port-channel10
lacp max-bundle 10
- name: setup3 - L2 for mode command
cli_config:
config: |
interface port-channel10
switchport
lacp mode delay
when: mode is defined
- name: Gather lacp_interfaces facts
nxos_facts: &facts
@ -39,8 +51,13 @@
- "'interface port-channel5' in result.commands"
- "'no lacp min-links' in result.commands"
- "'interface port-channel10' in result.commands"
- "'no lacp max-bundle' in result.commands"
- assert:
that:
- "'no lacp mode delay' in result.commands"
- "result.commands|length == 4"
- "result.commands|length == 5"
when: mode is defined
- name: Idempotence - deleted
nxos_lacp_interfaces: *deleted

View file

@ -2,6 +2,10 @@
- debug:
msg: "Start nxos_lacp_interfaces merged integration tests connection={{ ansible_connection }}"
- set_fact:
mode: delay
when: platform is not search('N5K|N6K|N7K') and ((imagetag != 'I2'))
- name: setup1
cli_config: &cleanup
config: |
@ -15,6 +19,13 @@
config: |
feature lacp
- name: setup3 - L2 for mode command
cli_config:
config: |
interface port-channel5
switchport
when: mode is defined
- name: Merged
nxos_lacp_interfaces: &merged
config:
@ -22,7 +33,9 @@
links:
min: 5
- name: port-channel5
mode: delay
mode: "{{ mode | default(omit) }}"
links:
max: 10
state: merged
register: result
@ -33,8 +46,13 @@
- "'interface port-channel10' in result.commands"
- "'lacp min-links 5' in result.commands"
- "'interface port-channel5' in result.commands"
- "'lacp max-bundle 10' in result.commands"
- assert:
that:
- "'lacp mode delay' in result.commands"
- "result.commands|length == 4"
- "result.commands|length == 5"
when: mode is defined
- name: Gather lacp_interfaces facts
nxos_facts:

View file

@ -2,6 +2,10 @@
- debug:
msg: "Start nxos_lacp_interfaces overridden integration tests connection={{ ansible_connection }}"
- set_fact:
mode: delay
when: platform is not search('N5K|N6K|N7K') and ((imagetag != 'I2'))
- name: setup1
cli_config: &cleanup
config: |
@ -20,6 +24,13 @@
interface port-channel5
lacp max-bundle 10
- name: setup3 - L2 for mode command
cli_config:
config: |
interface port-channel11
switchport
when: mode is defined
- name: Gather lacp_interfaces facts
nxos_facts: &facts
gather_subset:
@ -31,7 +42,9 @@
nxos_lacp_interfaces: &overridden
config:
- name: port-channel11
mode: delay
links:
min: 4
mode: "{{ mode | default(omit) }}"
state: overridden
register: result
@ -44,8 +57,12 @@
- "'interface port-channel5' in result.commands"
- "'no lacp max-bundle' in result.commands"
- "'interface port-channel11' in result.commands"
- assert:
that:
- "'lacp mode delay' in result.commands"
- "result.commands|length == 6"
- "result.commands|length == 7"
when: mode is defined
- name: Gather lacp_interfaces post facts
nxos_facts: *facts

View file

@ -2,6 +2,10 @@
- debug:
msg: "Start nxos_lacp_interfaces replaced integration tests connection={{ ansible_connection }}"
- set_fact:
mode: delay
when: platform is not search('N5K|N6K|N7K') and ((imagetag != 'I2'))
- name: setup1
cli_config: &cleanup
config: |
@ -14,6 +18,7 @@
config: |
feature lacp
interface port-channel10
switchport
lacp min-links 5
- name: Gather lacp_interfaces facts
@ -29,6 +34,7 @@
- name: port-channel10
links:
max: 10
mode: "{{ mode | default(omit) }}"
state: replaced
register: result
@ -39,7 +45,12 @@
- "'interface port-channel10' in result.commands"
- "'no lacp min-links' in result.commands"
- "'lacp max-bundle 10' in result.commands"
- "result.commands|length == 3"
- assert:
that:
- "'lacp mode delay' in result.commands"
- "result.commands|length == 4"
when: mode is defined
- name: Gather lacp_interfaces post facts
nxos_facts: *facts