2019-08-13 08:43:35 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "Start nxos_lacp_interfaces merged integration tests connection={{ ansible_connection }}"
|
|
|
|
|
2019-11-10 05:30:13 +01:00
|
|
|
#
|
|
|
|
# "lacp mode delay" is not supported on Nexus 9500 series switches.
|
|
|
|
# Three models of Nexus 9500 switches have chassis types C9504, C9508 and C9516.
|
|
|
|
#
|
|
|
|
|
2019-09-12 18:15:04 +02:00
|
|
|
- set_fact:
|
|
|
|
mode: delay
|
2019-11-10 05:30:13 +01:00
|
|
|
when: platform is not search('N3K|N5K|N6K|N7K') and imagetag is not search('A8|I2') and
|
|
|
|
image_version is not search ('9.2') and chassis_type is not search('C95')
|
2019-09-12 18:15:04 +02:00
|
|
|
|
2019-08-13 08:43:35 +02:00
|
|
|
- name: setup1
|
|
|
|
cli_config: &cleanup
|
|
|
|
config: |
|
|
|
|
no interface port-channel5
|
|
|
|
no interface port-channel10
|
|
|
|
no feature lacp
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: setup2
|
|
|
|
cli_config:
|
|
|
|
config: |
|
|
|
|
feature lacp
|
|
|
|
|
2019-09-12 18:15:04 +02:00
|
|
|
- name: setup3 - L2 for mode command
|
|
|
|
cli_config:
|
|
|
|
config: |
|
|
|
|
interface port-channel5
|
|
|
|
switchport
|
|
|
|
when: mode is defined
|
|
|
|
|
2019-08-13 08:43:35 +02:00
|
|
|
- name: Merged
|
|
|
|
nxos_lacp_interfaces: &merged
|
|
|
|
config:
|
|
|
|
- name: port-channel10
|
|
|
|
links:
|
|
|
|
min: 5
|
|
|
|
- name: port-channel5
|
2019-09-12 18:15:04 +02:00
|
|
|
mode: "{{ mode | default(omit) }}"
|
|
|
|
links:
|
|
|
|
max: 10
|
2019-08-13 08:43:35 +02:00
|
|
|
state: merged
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.before|length == 0"
|
|
|
|
- "'interface port-channel10' in result.commands"
|
|
|
|
- "'lacp min-links 5' in result.commands"
|
|
|
|
- "'interface port-channel5' in result.commands"
|
2019-09-12 18:15:04 +02:00
|
|
|
- "'lacp max-bundle 10' in result.commands"
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-08-13 08:43:35 +02:00
|
|
|
- "'lacp mode delay' in result.commands"
|
2019-09-12 18:15:04 +02:00
|
|
|
- "result.commands|length == 5"
|
|
|
|
when: mode is defined
|
2019-08-13 08:43:35 +02:00
|
|
|
|
|
|
|
- name: Gather lacp_interfaces facts
|
|
|
|
nxos_facts:
|
|
|
|
gather_subset:
|
|
|
|
- '!all'
|
|
|
|
- '!min'
|
|
|
|
gather_network_resources: lacp_interfaces
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.after)|length == 0"
|
|
|
|
|
|
|
|
- name: Idempotence - Merged
|
|
|
|
nxos_lacp_interfaces: *merged
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands|length == 0"
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: teardown
|
|
|
|
cli_config: *cleanup
|