ansible/test/integration/targets/nxos_interfaces/tests/cli/replaced.yaml

61 lines
1.4 KiB
YAML
Raw Normal View History

---
- debug:
msg: "Start nxos_interfaces replaced integration tests connection={{ ansible_connection }}"
- set_fact: test_int1="{{ nxos_int1 }}"
- name: setup1
cli_config: &cleanup
config: |
default interface {{ test_int1 }}
- block:
- name: setup2
cli_config:
config: |
interface {{ test_int1 }}
description Configured by Ansible
- name: Gather interfaces facts
nxos_facts: &facts
gather_subset:
- '!all'
- '!min'
gather_network_resources: interfaces
- name: Replaced
nxos_interfaces: &replaced
config:
- name: "{{ test_int1 }}"
mode: layer3
state: replaced
register: result
- assert:
that:
- "ansible_facts.network_resources.interfaces|symmetric_difference(result.before)|length == 0"
- "result.changed == true"
- "'interface {{ test_int1 }}' in result.commands"
- "'no description' in result.commands"
- "'no switchport' in result.commands"
- name: Gather interfaces post facts
nxos_facts: *facts
- assert:
that:
- "ansible_facts.network_resources.interfaces|symmetric_difference(result.after)|length == 0"
- name: Idempotence - Replaced
nxos_interfaces: *replaced
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config: *cleanup