1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fix vxlan idempotent issue (#34750)

This commit is contained in:
saichint 2018-01-14 22:57:37 -08:00 committed by Trishna Guha
parent ade02bcce5
commit c04cd8642d
2 changed files with 44 additions and 6 deletions

View file

@ -58,7 +58,7 @@ options:
- Administratively shutdown the NVE interface. - Administratively shutdown the NVE interface.
required: false required: false
choices: ['true','false'] choices: ['true','false']
default: false default: true
source_interface: source_interface:
description: description:
- Specify the loopback interface whose IP address should be - Specify the loopback interface whose IP address should be
@ -100,6 +100,7 @@ commands:
''' '''
import re import re
from ansible.module_utils.network.nxos.nxos import get_config, load_config from ansible.module_utils.network.nxos.nxos import get_config, load_config
from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
@ -120,6 +121,7 @@ PARAM_TO_COMMAND_KEYMAP = {
PARAM_TO_DEFAULT_KEYMAP = { PARAM_TO_DEFAULT_KEYMAP = {
'description': False, 'description': False,
'shutdown': True, 'shutdown': True,
'source_interface_hold_down_time': '180',
} }
@ -270,7 +272,6 @@ def main():
shutdown=dict(required=False, type='bool'), shutdown=dict(required=False, type='bool'),
source_interface=dict(required=False, type='str'), source_interface=dict(required=False, type='str'),
source_interface_hold_down_time=dict(required=False, type='str'), source_interface_hold_down_time=dict(required=False, type='str'),
m_facts=dict(required=False, default=False, type='bool'),
state=dict(choices=['present', 'absent'], default='present', required=False), state=dict(choices=['present', 'absent'], default='present', required=False),
) )

View file

@ -1,5 +1,5 @@
--- ---
- - debug: msg="START connection={{ ansible_connection }} nxos_vxlan_vtep sanity test" - debug: msg="START connection={{ ansible_connection }} nxos_vxlan_vtep sanity test"
- debug: msg="Using provider={{ connection.transport }}" - debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local" when: ansible_connection == "local"
@ -19,11 +19,11 @@
- name: configure vxlan_vtep - name: configure vxlan_vtep
nxos_vxlan_vtep: &configure9 nxos_vxlan_vtep: &configure9
interface: nve1 interface: nve1
description: default description: "abcd"
host_reachability: true host_reachability: true
source_interface: Loopback0 source_interface: Loopback0
source_interface_hold_down_time: 30 source_interface_hold_down_time: 30
shutdown: true shutdown: false
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
@ -39,6 +39,25 @@
that: that:
- "result.changed == false" - "result.changed == false"
- name: reset vxlan_vtep
nxos_vxlan_vtep: &def9
interface: nve1
description: default
host_reachability: false
source_interface_hold_down_time: default
source_interface: default
shutdown: true
provider: "{{ connection }}"
register: result
- assert: *true
- name: "reset Idempotence"
nxos_vxlan_vtep: *def9
register: result
- assert: *false
when: (platform is search('N9K')) when: (platform is search('N9K'))
- block: - block:
@ -48,7 +67,7 @@
description: default description: default
host_reachability: true host_reachability: true
source_interface: Loopback0 source_interface: Loopback0
shutdown: true shutdown: false
provider: "{{ connection }}" provider: "{{ connection }}"
register: result register: result
@ -64,6 +83,24 @@
that: that:
- "result.changed == false" - "result.changed == false"
- name: reset vxlan_vtep
nxos_vxlan_vtep: &def7
interface: nve1
description: default
host_reachability: false
source_interface: default
shutdown: true
provider: "{{ connection }}"
register: result
- assert: *true
- name: "reset Idempotence"
nxos_vxlan_vtep: *def7
register: result
- assert: *false
when: (platform is search('N7K')) when: (platform is search('N7K'))
- name: remove vxlan_vtep - name: remove vxlan_vtep