ansible/test/integration/targets/nxos_lacp_interfaces/tests/cli/replaced.yaml
nkshrishail 964da2f442 nxos_lacp_interfaces: Updating the tests to handle platforms that don't support - lacp mode delay (#64123)
* nxos_lacp_interfaces: Updating the tests to handle platforms that dont support - lacp mode delay

* nxos_lacp_interfaces: Updating search string to include all 9500 series switches

* nxos_lacp_interfaces: Adding a comment about chassis_type
2019-11-10 10:00:13 +05:30

79 lines
2 KiB
YAML

---
- debug:
msg: "Start nxos_lacp_interfaces replaced integration tests connection={{ ansible_connection }}"
#
# "lacp mode delay" is not supported on Nexus 9500 series switches.
# Three models of Nexus 9500 switches have chassis types C9504, C9508 and C9516.
#
- set_fact:
mode: delay
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')
- name: setup1
cli_config: &cleanup
config: |
no interface port-channel10
no feature lacp
- block:
- name: setup2
cli_config:
config: |
feature lacp
interface port-channel10
switchport
lacp min-links 5
- name: Gather lacp_interfaces facts
nxos_facts: &facts
gather_subset:
- '!all'
- '!min'
gather_network_resources: lacp_interfaces
- name: Replaced
nxos_lacp_interfaces: &replaced
config:
- name: port-channel10
links:
max: 10
mode: "{{ mode | default(omit) }}"
state: replaced
register: result
- assert:
that:
- "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.before)|length == 0"
- "result.changed == true"
- "'interface port-channel10' in result.commands"
- "'no lacp min-links' in result.commands"
- "'lacp max-bundle 10' in result.commands"
- 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
- assert:
that:
- "ansible_facts.network_resources.lacp_interfaces|symmetric_difference(result.after)|length == 0"
- name: Idempotence - Replaced
nxos_lacp_interfaces: *replaced
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config: *cleanup