ansible/test/integration/targets/nxos_ip_interface/tests/nxapi/sanity.yaml

100 lines
2.2 KiB
YAML
Raw Normal View History

---
- debug: msg="START TRANSPORT:NXAPI nxos_ip_interface sanity test"
- set_fact: testint1="{{ nxos_int1 }}"
- set_fact: testint2="{{ nxos_int2 }}"
- name: "Put interface {{testint1}} into default state"
nxos_config: &intdefault1
lines:
- "default interface {{ testint1 }}"
provider: "{{ nxapi }}"
ignore_errors: yes
- name: "Put interface {{testint2}} into default state"
nxos_config: &intdefault2
lines:
- "default interface {{ testint2 }}"
provider: "{{ nxapi }}"
ignore_errors: yes
- name: "Make {{testint1}} a layer3 interface"
nxos_interface: &l3int1
interface: "{{ testint1 }}"
mode: layer3
description: 'Configured by Ansible - Layer3'
admin_state: 'up'
state: present
provider: "{{ nxapi }}"
- name: "Make {{testint2}} a layer3 interface"
nxos_interface: &l3int2
interface: "{{ testint2 }}"
mode: layer3
description: 'Configured by Ansible - Layer3'
admin_state: 'up'
state: present
provider: "{{ nxapi }}"
# For titanium
- name: Clear interface v4
nxos_ip_interface:
interface: "{{ testint1 }}"
version: v4
state: absent
addr: 20.20.20.20
mask: 24
provider: "{{ nxapi }}"
# For titanium
- name: Clear interface v6
nxos_ip_interface:
interface: "{{ testint2 }}"
version: v6
state: absent
addr: 'fd56:31f7:e4ad:5585::1'
mask: 64
provider: "{{ nxapi }}"
- name: Ensure ipv4 address is configured
nxos_ip_interface: &ipv4
interface: "{{ testint1 }}"
version: v4
state: present
addr: 20.20.20.20
mask: 24
provider: "{{ nxapi }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Check Idempotence"
nxos_ip_interface: *ipv4
register: result
- assert: &false
that:
- "result.changed == false"
- name: Ensure ipv6 address is configured
nxos_ip_interface: &ipv6
interface: "{{ testint2 }}"
version: v6
state: present
addr: 'fd56:31f7:e4ad:5585::1'
mask: 64
provider: "{{ nxapi }}"
register: result
- assert: *true
- name: "Check Idempotence"
nxos_ip_interface: *ipv6
register: result
- assert: *false
- debug: msg="END TRANSPORT:NXAPI nxos_ip_interface sanity test"