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.
ansible/test/integration/targets/nxos_l3_interfaces/tests/cli/overridden.yaml

76 lines
2.0 KiB
YAML

---
- debug:
msg: "Start nxos_l3_interfaces overridden integration tests connection={{ ansible_connection }}"
- set_fact: test_int1="{{ nxos_int1 }}"
- set_fact: test_int2="{{ nxos_int2 }}"
- set_fact: test_int3="{{ nxos_int3 }}"
- name: setup1
cli_config: &cleanup
config: |
default interface {{ test_int1 }}
default interface {{ test_int2 }}
default interface {{ test_int3 }}
- block:
- name: setup2
cli_config:
config: |
interface {{ test_int1 }}
no switchport
ip address 192.168.10.2/24 tag 5
interface {{ test_int2 }}
no switchport
ip address 10.1.1.1/24
interface {{ test_int3 }}
no switchport
- name: Gather l3_interfaces facts
nxos_facts: &facts
gather_subset:
- '!all'
- '!min'
gather_network_resources: l3_interfaces
- name: Overridden
nxos_l3_interfaces: &overridden
config:
- name: "{{ test_int3 }}"
ipv4:
- address: 10.1.1.3/24
state: overridden
register: result
- assert:
that:
- "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.before)|length == 0"
- "result.changed == true"
- "'interface {{ test_int1 }}' in result.commands"
- "'no ip address' in result.commands"
- "'interface {{ test_int2 }}' in result.commands"
- "'no ip address' in result.commands"
- "'interface {{ test_int3 }}' in result.commands"
- "'ip address 10.1.1.3/24' in result.commands"
- "result.commands|length == 6"
- name: Gather l3_interfaces post facts
nxos_facts: *facts
- assert:
that:
- "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.after)|length == 0"
- name: Idempotence - Overridden
nxos_l3_interfaces: *overridden
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config: *cleanup