2017-08-17 10:18:00 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_vrf sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-08-17 10:18:00 +02:00
|
|
|
|
2018-03-13 12:38:37 +01:00
|
|
|
- set_fact: intname1="{{ nxos_int1 }}"
|
|
|
|
- set_fact: intname2="{{ nxos_int2 }}"
|
|
|
|
|
|
|
|
- set_fact: rdnd="1:2"
|
|
|
|
when: (platform is not match("N35|N7K")) and ((imagetag != 'I2'))
|
|
|
|
|
|
|
|
- set_fact: rdd="default"
|
|
|
|
when: (platform is not match("N35|N7K")) and ((imagetag != 'I2'))
|
|
|
|
|
|
|
|
- set_fact: vnind="5000"
|
2018-05-17 16:59:00 +02:00
|
|
|
when: platform is not match("N35|N7K|N3L")
|
2018-03-13 12:38:37 +01:00
|
|
|
|
|
|
|
- set_fact: vnid="default"
|
2018-05-17 16:59:00 +02:00
|
|
|
when: platform is not match("N35|N7K|N3L")
|
2018-01-08 05:40:34 +01:00
|
|
|
|
2018-03-13 12:38:37 +01:00
|
|
|
- name: "Enable feature BGP"
|
|
|
|
nxos_feature:
|
|
|
|
feature: bgp
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-03-13 12:38:37 +01:00
|
|
|
state: enabled
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
2017-09-01 11:59:21 +02:00
|
|
|
- name: Ensure ntc VRF exists on switch
|
|
|
|
nxos_vrf: &configure
|
|
|
|
vrf: ntc
|
|
|
|
admin_state: down
|
|
|
|
description: testing
|
2018-03-13 12:38:37 +01:00
|
|
|
vni: "{{vnind|default(omit)}}"
|
|
|
|
rd: "{{rdnd|default(omit)}}"
|
|
|
|
interfaces:
|
|
|
|
- "{{ intname1 }}"
|
|
|
|
- "{{ intname2 }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-09-01 11:59:21 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vrf: *configure
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-03-13 12:38:37 +01:00
|
|
|
- pause:
|
|
|
|
seconds: 30
|
|
|
|
|
|
|
|
- name: Remove config
|
|
|
|
nxos_vrf: &remconf
|
|
|
|
vrf: ntc
|
|
|
|
admin_state: up
|
|
|
|
vni: "{{vnid|default(omit)}}"
|
|
|
|
rd: "{{rdd|default(omit)}}"
|
|
|
|
interfaces: default
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-03-13 12:38:37 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_vrf: *remconf
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-09-01 11:59:21 +02:00
|
|
|
- name: Ensure ntc VRF does not exist on switch
|
|
|
|
nxos_vrf: &remove
|
|
|
|
vrf: ntc
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-09-01 11:59:21 +02:00
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- pause:
|
|
|
|
seconds: 30
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_vrf: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
2017-08-17 10:18:00 +02:00
|
|
|
|
2018-03-13 12:38:37 +01:00
|
|
|
always:
|
|
|
|
- name: "Disable feature BGP"
|
|
|
|
nxos_feature:
|
|
|
|
feature: bgp
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-03-13 12:38:37 +01:00
|
|
|
state: disabled
|
2018-01-08 05:40:34 +01:00
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-03-13 12:38:37 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_vrf sanity test"
|