51 lines
1.1 KiB
YAML
51 lines
1.1 KiB
YAML
|
---
|
||
|
- debug:
|
||
|
msg: "Start nxos_interfaces merged integration tests connection={{ ansible_connection }}"
|
||
|
|
||
|
- set_fact: test_int1="{{ nxos_int1 }}"
|
||
|
|
||
|
- name: setup
|
||
|
cli_config: &cleanup
|
||
|
config: |
|
||
|
default interface {{ test_int1 }}
|
||
|
|
||
|
- block:
|
||
|
- name: Merged
|
||
|
nxos_interfaces: &merged
|
||
|
config:
|
||
|
- name: "{{ test_int1 }}"
|
||
|
description: Configured by Ansible
|
||
|
state: merged
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == true"
|
||
|
- "result.before|length == 0"
|
||
|
- "'interface {{ test_int1 }}' in result.commands"
|
||
|
- "'description Configured by Ansible' in result.commands"
|
||
|
|
||
|
- 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
|