mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
YAML
58 lines
1.3 KiB
YAML
---
|
|
- debug:
|
|
msg: "Start nxos_interfaces merged integration tests connection={{ ansible_connection }}"
|
|
|
|
- set_fact: test_int1="{{ nxos_int1 }}"
|
|
- set_fact: enabled=true
|
|
when: platform is not search('N3[5KL]|N[56]K|titanium')
|
|
|
|
- name: setup
|
|
cli_config: &cleanup
|
|
config: |
|
|
default interface {{ test_int1 }}
|
|
|
|
- block:
|
|
- name: Merged
|
|
nxos_interfaces: &merged
|
|
config:
|
|
- name: "{{ test_int1 }}"
|
|
description: Configured by Ansible
|
|
enabled: "{{ enabled|default(omit)}}"
|
|
state: merged
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'interface {{ test_int1 }}' in result.commands"
|
|
- "'description Configured by Ansible' in result.commands"
|
|
|
|
- assert:
|
|
that:
|
|
- "'no shutdown' in result.commands"
|
|
when: enabled is defined
|
|
|
|
- name: Gather interfaces facts
|
|
nxos_facts:
|
|
gather_subset:
|
|
- '!all'
|
|
- '!min'
|
|
gather_network_resources: interfaces
|
|
|
|
- assert:
|
|
that:
|
|
- "ansible_facts.network_resources.interfaces|symmetric_difference(result.after)|length == 0"
|
|
|
|
- name: Idempotence - Merged
|
|
nxos_interfaces: *merged
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands|length == 0"
|
|
|
|
always:
|
|
- name: teardown
|
|
cli_config: *cleanup
|