ansible/test/integration/targets/nxos_l3_interfaces/tests/cli/merged.yaml

72 lines
1.7 KiB
YAML
Raw Normal View History

---
- debug:
msg: "Start nxos_l3_interfaces merged integration tests connection={{ ansible_connection }}"
- set_fact:
test_int3: "{{ nxos_int3 }}"
subint3: "{{ nxos_int3 }}.42"
- name: setup1
cli_config: &cleanup
config: |
no system default switchport
default interface {{ test_int3 }}
interface {{ test_int3 }}
no switchport
ignore_errors: yes
- name: setup2 cleanup all L3 states on all interfaces
nxos_l3_interfaces:
state: deleted
- block:
- name: Merged
nxos_l3_interfaces: &merged
config:
- name: "{{ subint3 }}"
dot1q: 42
redirects: false
unreachables: true
ipv4:
- address: 192.168.10.2/24
state: merged
register: result
- assert:
that:
- "result.changed == true"
- "result.before|length == 0"
- "'interface {{ subint3 }}' in result.commands"
- "'encapsulation dot1q 42' in result.commands"
- "'no ip redirects' in result.commands"
- "'ip unreachables' in result.commands"
- "'ip address 192.168.10.2/24' in result.commands"
- "result.commands|length == 5"
- name: Gather l3_interfaces facts
nxos_facts:
gather_subset:
- '!all'
- '!min'
gather_network_resources: l3_interfaces
- assert:
that:
- "result.after|length == (ansible_facts.network_resources.l3_interfaces|length|int - rsvd_intf_len|int)"
- name: Idempotence - Merged
nxos_l3_interfaces: *merged
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config:
config: |
no interface {{ subint3 }}
ignore_errors: yes