mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix nxos_vrf_af issues (#37211)
This commit is contained in:
parent
c25a42bef6
commit
74e79d9f5e
2 changed files with 101 additions and 23 deletions
|
@ -124,8 +124,8 @@ def main():
|
||||||
|
|
||||||
if current:
|
if current:
|
||||||
have = 'route-target both auto evpn' in 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'])
|
want = bool(module.params['route_target_both_auto_evpn'])
|
||||||
|
|
||||||
if want and not have:
|
if want and not have:
|
||||||
commands.append('address-family %s unicast' % module.params['afi'])
|
commands.append('address-family %s unicast' % module.params['afi'])
|
||||||
commands.append('route-target both auto evpn')
|
commands.append('route-target both auto evpn')
|
||||||
|
|
|
@ -13,18 +13,20 @@
|
||||||
nxos_config:
|
nxos_config:
|
||||||
commands: "feature nv overlay"
|
commands: "feature nv overlay"
|
||||||
provider: "{{ connection }}"
|
provider: "{{ connection }}"
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: Configure nv overlay evpn
|
- name: Configure nv overlay evpn
|
||||||
nxos_config:
|
nxos_config:
|
||||||
commands: "nv overlay evpn"
|
commands: "nv overlay evpn"
|
||||||
provider: "{{ connection }}"
|
provider: "{{ connection }}"
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Configure vrf af
|
- name: Configure vrf af ipv4
|
||||||
nxos_vrf_af: &configure
|
nxos_vrf_af: &configure4
|
||||||
vrf: ansible
|
vrf: ansible
|
||||||
afi: ipv4
|
afi: ipv4
|
||||||
route_target_both_auto_evpn: true
|
route_target_both_auto_evpn: True
|
||||||
provider: "{{ connection }}"
|
provider: "{{ connection }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
@ -33,18 +35,66 @@
|
||||||
- "result.changed == true"
|
- "result.changed == true"
|
||||||
|
|
||||||
- name: "Conf Idempotence"
|
- name: "Conf Idempotence"
|
||||||
nxos_vrf_af: *configure
|
nxos_vrf_af: *configure4
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert: &false
|
- assert: &false
|
||||||
that:
|
that:
|
||||||
- "result.changed == false"
|
- "result.changed == false"
|
||||||
|
|
||||||
- name: Remove vrf af
|
- name: Configure vrf af ipv6
|
||||||
nxos_vrf_af: &remove
|
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
|
vrf: ansible
|
||||||
afi: ipv4
|
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
|
state: absent
|
||||||
provider: "{{ connection }}"
|
provider: "{{ connection }}"
|
||||||
register: result
|
register: result
|
||||||
|
@ -55,21 +105,37 @@
|
||||||
seconds: 30
|
seconds: 30
|
||||||
|
|
||||||
- name: "Remove Idempotence"
|
- name: "Remove Idempotence"
|
||||||
nxos_vrf_af: *remove
|
nxos_vrf_af: *remove6
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert: *false
|
- assert: *false
|
||||||
|
|
||||||
always:
|
- name: Remove vrf af v4
|
||||||
- name: Remove feature bgp
|
nxos_vrf_af: &remove4
|
||||||
nxos_feature:
|
vrf: ansible
|
||||||
feature: bgp
|
afi: ipv4
|
||||||
state: disabled
|
route_target_both_auto_evpn: True
|
||||||
|
state: absent
|
||||||
provider: "{{ connection }}"
|
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:
|
nxos_config:
|
||||||
commands: "no feature nv overlay"
|
commands: "no vrf context ansible"
|
||||||
provider: "{{ connection }}"
|
provider: "{{ connection }}"
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
|
@ -79,4 +145,16 @@
|
||||||
provider: "{{ connection }}"
|
provider: "{{ connection }}"
|
||||||
ignore_errors: yes
|
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"
|
- debug: msg="END connection={{ ansible_connection }} nxos_vrf_af sanity test"
|
||||||
|
|
Loading…
Reference in a new issue