fix nxos_vrf_af issues (#37211)

This commit is contained in:
saichint 2018-03-08 22:50:27 -08:00 committed by Trishna Guha
parent c25a42bef6
commit 74e79d9f5e
2 changed files with 101 additions and 23 deletions

View file

@ -124,8 +124,8 @@ def main():
if current:
have = 'route-target both auto evpn' in current
if module.params['route_target_both_auto_evpn'] is not None:
want = bool(module.params['route_target_both_auto_evpn'])
if want and not have:
commands.append('address-family %s unicast' % module.params['afi'])
commands.append('route-target both auto evpn')

View file

@ -13,18 +13,20 @@
nxos_config:
commands: "feature nv overlay"
provider: "{{ connection }}"
ignore_errors: yes
- name: Configure nv overlay evpn
nxos_config:
commands: "nv overlay evpn"
provider: "{{ connection }}"
ignore_errors: yes
- block:
- name: Configure vrf af
nxos_vrf_af: &configure
- name: Configure vrf af ipv4
nxos_vrf_af: &configure4
vrf: ansible
afi: ipv4
route_target_both_auto_evpn: true
route_target_both_auto_evpn: True
provider: "{{ connection }}"
register: result
@ -33,18 +35,66 @@
- "result.changed == true"
- name: "Conf Idempotence"
nxos_vrf_af: *configure
nxos_vrf_af: *configure4
register: result
- assert: &false
that:
- "result.changed == false"
- name: Remove vrf af
nxos_vrf_af: &remove
- name: Configure vrf af ipv6
nxos_vrf_af: &configure6
vrf: ansible
afi: ipv6
route_target_both_auto_evpn: True
provider: "{{ connection }}"
register: result
- assert: *true
- name: "Conf Idempotence"
nxos_vrf_af: *configure6
register: result
- assert: *false
- name: Remove router target4
nxos_vrf_af: &rrt4
vrf: ansible
afi: ipv4
route_target_both_auto_evpn: true
route_target_both_auto_evpn: False
provider: "{{ connection }}"
register: result
- assert: *true
- name: "Conf Idempotence"
nxos_vrf_af: *rrt4
register: result
- assert: *false
- name: Remove router target6
nxos_vrf_af: &rrt6
vrf: ansible
afi: ipv6
route_target_both_auto_evpn: False
provider: "{{ connection }}"
register: result
- assert: *true
- name: "Conf Idempotence"
nxos_vrf_af: *rrt6
register: result
- assert: *false
- name: Remove vrf af v6
nxos_vrf_af: &remove6
vrf: ansible
afi: ipv6
route_target_both_auto_evpn: True
state: absent
provider: "{{ connection }}"
register: result
@ -55,21 +105,37 @@
seconds: 30
- name: "Remove Idempotence"
nxos_vrf_af: *remove
nxos_vrf_af: *remove6
register: result
- assert: *false
always:
- name: Remove feature bgp
nxos_feature:
feature: bgp
state: disabled
- name: Remove vrf af v4
nxos_vrf_af: &remove4
vrf: ansible
afi: ipv4
route_target_both_auto_evpn: True
state: absent
provider: "{{ connection }}"
register: result
- name: Remove feature nv overlay
- assert: *true
- pause:
seconds: 30
- name: "Remove Idempotence"
nxos_vrf_af: *remove4
register: result
- assert: *false
when: not platform is search("N35")
always:
- name: Remove vrf
nxos_config:
commands: "no feature nv overlay"
commands: "no vrf context ansible"
provider: "{{ connection }}"
ignore_errors: yes
@ -79,4 +145,16 @@
provider: "{{ connection }}"
ignore_errors: yes
- name: Remove feature nv overlay
nxos_config:
commands: "no feature nv overlay"
provider: "{{ connection }}"
ignore_errors: yes
- name: Remove feature bgp
nxos_feature:
feature: bgp
state: disabled
provider: "{{ connection }}"
- debug: msg="END connection={{ ansible_connection }} nxos_vrf_af sanity test"