Add Idempotent IT cases for vrrp, vrf, vtp (#28895)

This commit is contained in:
saichint 2017-09-01 02:59:21 -07:00 committed by Nathaniel Case
parent 50d148a7d6
commit 737c27121b
5 changed files with 121 additions and 96 deletions

View file

@ -1,15 +1,49 @@
---
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrf sanity test"
- name: Ensure ntc VRF exists on switch
nxos_vrf:
vrf: ntc
provider: "{{ connection }}"
- block:
- name: Ensure ntc VRF exists on switch
nxos_vrf: &configure
vrf: ntc
admin_state: down
description: testing
#vni: 5000
#rd: auto
provider: "{{ connection }}"
register: result
- name: Ensure ntc VRF does not exist on switch
nxos_vrf:
vrf: ntc
state: absent
provider: "{{ connection }}"
- assert: &true
that:
- "result.changed == true"
- name: "Conf Idempotence"
nxos_vrf: *configure
register: result
- assert: &false
that:
- "result.changed == false"
- name: Ensure ntc VRF does not exist on switch
nxos_vrf: &remove
vrf: ntc
admin_state: down
description: testing
#vni: 5000
#rd: auto
state: absent
provider: "{{ connection }}"
register: result
- assert: *true
- pause:
seconds: 30
- name: "Remove Idempotence"
nxos_vrf: *remove
register: result
- assert: *false
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrf sanity test"

View file

@ -1,31 +1,44 @@
---
- debug: msg="START TRANSPORT:CLI nxos_vrrp sanity test"
- debug: msg="START TRANSPORT:{{ connection.transport }} nxos_vrrp sanity test"
- block:
- name: "Enable interface-vlan"
nxos_feature:
feature: interface-vlan
state: enabled
provider: "{{ cli }}"
provider: "{{ connection }}"
- name: "Enable vrrp"
nxos_feature:
feature: vrrp
state: enabled
provider: "{{ cli }}"
provider: "{{ connection }}"
- name: "create int vlan 10"
nxos_interface:
interface: "vlan 10"
state: present
provider: "{{ cli }}"
nxos_config:
commands: "int vlan 10"
provider: "{{ connection }}"
- name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10
nxos_vrrp:
nxos_vrrp: &configure
interface: vlan10
group: 100
vip: 10.1.100.1
provider: "{{ cli }}"
admin_state: shutdown
provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Conf Idempotence"
nxos_vrrp: *configure
register: result
- assert: &false
that:
- "result.changed == false"
- name: Ensure removal of the vrrp group config
# vip is required to ensure the user knows what they are removing
@ -33,21 +46,43 @@
interface: vlan10
group: 100
vip: 10.1.100.1
admin_state: shutdown
state: absent
provider: "{{ cli }}"
provider: "{{ connection }}"
register: result
- assert: *true
- pause:
seconds: 30
- name: "Remove Idempotence"
nxos_vrrp: *remove
register: result
- assert: *false
- pause:
seconds: 30
- name: Re-config with more params
nxos_vrrp:
nxos_vrrp: &reconfig
interface: vlan10
group: 100
vip: 10.1.100.1
preempt: false
priority: 130
authentication: AUTHKEY
provider: "{{ cli }}"
provider: "{{ connection }}"
register: result
- assert: *true
- name: "Reconfig Idempotence"
nxos_vrrp: *reconfig
register: result
- assert: *false
always:
- name: remove vrrp
@ -58,7 +93,7 @@
nxos_config:
commands:
- no feature interface-vlan
provider: "{{ cli }}"
provider: "{{ connection }}"
match: none
ignore_errors: yes
@ -66,7 +101,7 @@
nxos_feature:
feature: vrrp
state: disabled
provider: "{{ cli }}"
provider: "{{ connection }}"
ignore_errors: yes
- debug: msg="END TRANSPORT:CLI nxos_vrrp sanity test"
- debug: msg="END TRANSPORT:{{ connection.transport }} nxos_vrrp sanity test"

View file

@ -1,70 +0,0 @@
---
- debug: msg="START TRANSPORT:NXAPI nxos_vrrp sanity test"
- block:
- name: "Enable interface-vlan"
nxos_feature:
feature: interface-vlan
state: enabled
provider: "{{ nxapi }}"
- name: "Enable vrrp"
nxos_feature:
feature: vrrp
state: enabled
provider: "{{ nxapi }}"
- name: "create int vlan 10"
nxos_config:
commands:
- interface vlan 10
match: none
provider: "{{ nxapi }}"
- name: Ensure vrrp group 100 and vip 10.1.100.1 is on vlan10
nxos_vrrp:
interface: vlan10
group: 100
vip: 10.1.100.1
provider: "{{ nxapi }}"
- name: Ensure removal of the vrrp group config
# vip is required to ensure the user knows what they are removing
nxos_vrrp: &remove
interface: vlan10
group: 100
vip: 10.1.100.1
state: absent
provider: "{{ nxapi }}"
- name: Re-config with more params
nxos_vrrp:
interface: vlan10
group: 100
vip: 10.1.100.1
preempt: false
priority: 130
authentication: AUTHKEY
provider: "{{ nxapi }}"
always:
- name: remove vrrp
nxos_vrrp: *remove
ignore_errors: yes
- name: "Disable interface-vlan"
nxos_config:
commands:
- no feature interface-vlan
provider: "{{ nxapi }}"
match: none
ignore_errors: yes
- name: "Disable vrrp"
nxos_feature:
feature: vrrp
state: disabled
provider: "{{ nxapi }}"
ignore_errors: yes
- debug: msg="END TRANSPORT:NXAPI nxos_vrrp sanity test"

View file

@ -9,9 +9,22 @@
provider: "{{ connection }}"
- name: configure vtp domain
nxos_vtp_domain:
nxos_vtp_domain: &configure
domain: ntc
provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Conf Idempotence"
nxos_vtp_domain: *configure
register: result
- assert: &false
that:
- "result.changed == false"
always:
- name: disable feature vtp

View file

@ -9,9 +9,22 @@
provider: "{{ connection }}"
- name: configure vtp version
nxos_vtp_version:
nxos_vtp_version: &configure
version: 2
provider: "{{ connection }}"
register: result
- assert: &true
that:
- "result.changed == true"
- name: "Conf Idempotence"
nxos_vtp_version: *configure
register: result
- assert: &false
that:
- "result.changed == false"
always:
- name: disable feature vtp