2017-08-08 16:40:22 +00:00
|
|
|
---
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_vrf_interface sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-08-08 16:40:22 +00:00
|
|
|
|
|
|
|
# Select interface for test
|
|
|
|
- set_fact: intname="{{ nxos_int1 }}"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: put interface in L3
|
|
|
|
nxos_config:
|
|
|
|
commands:
|
|
|
|
- no switchport
|
|
|
|
parents:
|
|
|
|
- "interface {{ intname }}"
|
|
|
|
match: none
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-08 16:40:22 +00:00
|
|
|
|
|
|
|
- name: Ensure vrf ntc exists on interface
|
|
|
|
nxos_vrf_interface: &configure
|
|
|
|
vrf: ntc
|
|
|
|
interface: "{{ intname }}"
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-08 16:40:22 +00:00
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vrf_interface: *configure
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Ensure ntc VRF does not exist on interface
|
|
|
|
nxos_vrf_interface: &remove
|
|
|
|
vrf: ntc
|
|
|
|
interface: "{{ intname }}"
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-08 16:40:22 +00:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_vrf_interface: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: put interface in default mode
|
|
|
|
nxos_config:
|
|
|
|
lines: "default interface {{ intname }}"
|
|
|
|
match: none
|
2018-07-02 13:43:51 +00:00
|
|
|
provider: "{{ connection }}"
|
2017-08-08 16:40:22 +00:00
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_vrf_interface sanity test"
|