mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
nxos_vpc:Fix multiple idempotency issues, add missing commands (#55735)
* nxos_vpc:Fix idempotency issues with multiple attributes Several attributes were causing idempotency problems on various platforms: - `auto_recovery` - This command can be disabled on certain platforms and will nvgen as `no auto-recovery` - When enabled it has an additional optional-keyword for changing the `reload-delay` timer value - This was addressed by adding a new attribute `auto_recovery_reload_delay` to handle setting the timer value - This new attribute is mutually exclusive with `auto_recovery` - `/show run vpc/show run vpc all/` - Changed the command that gets state to `all` so that it could differentiate between `auto-recovery` and `auto-recovery reload-delay` - This change resulted in also changing some attribute handling withing `get_vpc`, since some attributes like `peer_gw` relied on presence of the config to determine state true or false. With `all` the config is always there so these attrs must specifically check for `'no '` in the string. - `delay_restore` - This command has two additional, optional keywords that exist on some platforms and not others. - New attrs: - `delay_restore_interface_vlan` - `delay_restore_orphan_port` - Modified the `sanity` test to include the new attributes and to fix the platform issues. - Bugfix Pull Request `modules/network/nxos/nxos_vpc.py` - Validated `nxos_vpc` `sanity` test on these platforms, all are now 100% Pass: N35, N3K, N3K-F, N6K, N7K, N9K, N9K-F - TBD: Future work is needed to add support for `peer_gw_exclude_gw` timers. This could be addressed in the same way as the `auto_recovery_reload_delay` changes included here. * lint fix * Add 'version_added' tags for new options
This commit is contained in:
committed by
Trishna Guha
parent
1097632039
commit
1554befd95
@@ -4,6 +4,17 @@
|
||||
when: ansible_connection == "local"
|
||||
|
||||
- block:
|
||||
- set_fact: delay_restore_orphan_port=25
|
||||
- set_fact: def_delay_restore_orphan_port=default
|
||||
when: platform is not search("N35|N5K|N6K")
|
||||
|
||||
- block:
|
||||
- name: disable vpc for initial vpc config cleanup
|
||||
nxos_feature:
|
||||
feature: vpc
|
||||
provider: "{{ connection }}"
|
||||
state: disabled
|
||||
|
||||
- name: enable feature vpc
|
||||
nxos_feature:
|
||||
feature: vpc
|
||||
@@ -46,6 +57,8 @@
|
||||
system_priority: 2000
|
||||
peer_gw: True
|
||||
delay_restore: 5
|
||||
delay_restore_interface_vlan: 15
|
||||
delay_restore_orphan_port: "{{ delay_restore_orphan_port|default(omit) }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
@@ -57,74 +70,58 @@
|
||||
- assert: *false
|
||||
|
||||
- block:
|
||||
- name: Configure auto1
|
||||
nxos_vpc: &auto_false
|
||||
# This block is only useful on platforms that nvgen 'no auto-recovery'.
|
||||
# Note: auto_recovery is mutually_exclusive with auto_recovery_reload_delay.
|
||||
- set_fact: def_auto_recovery=False
|
||||
- set_fact: def_auto_recovery=True
|
||||
when: platform is search("N7K")
|
||||
|
||||
- name: auto-recovery from default to non-default
|
||||
nxos_vpc: &auto_recovery_1
|
||||
provider: "{{ connection }}"
|
||||
state: present
|
||||
domain: 100
|
||||
auto_recovery: False
|
||||
auto_recovery: "{{ not def_auto_recovery }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Conf Idempotence"
|
||||
nxos_vpc: *auto_false
|
||||
- name: "Conf Idempotence auto-recovery def-to-non-def"
|
||||
nxos_vpc: *auto_recovery_1
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: Configure auto2
|
||||
nxos_vpc: &auto_true
|
||||
- name: auto-recovery from non-default to default
|
||||
nxos_vpc: &auto_recovery_2
|
||||
provider: "{{ connection }}"
|
||||
state: present
|
||||
domain: 100
|
||||
auto_recovery: True
|
||||
auto_recovery: "{{ def_auto_recovery }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Conf Idempotence"
|
||||
nxos_vpc: *auto_true
|
||||
- name: "Conf Idempotence auto-recovery non-def-to-def"
|
||||
nxos_vpc: *auto_recovery_2
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
when: (platform is search("N7K|N9K-F"))
|
||||
when: platform is search("N35|N7K|N3K-F|N9K-F")
|
||||
|
||||
- block:
|
||||
- name: Configure auto1
|
||||
nxos_vpc: &auto_true1
|
||||
provider: "{{ connection }}"
|
||||
state: present
|
||||
domain: 100
|
||||
auto_recovery: True
|
||||
register: result
|
||||
- name: Configure auto-recovery reload-delay
|
||||
nxos_vpc: &auto_reload
|
||||
provider: "{{ connection }}"
|
||||
domain: 100
|
||||
auto_recovery_reload_delay: 242
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
- assert: *true
|
||||
|
||||
- name: "Conf Idempotence"
|
||||
nxos_vpc: *auto_true1
|
||||
register: result
|
||||
- name: "Conf Idempotence auto-recovery reload-delay"
|
||||
nxos_vpc: *auto_reload
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
- name: Configure auto2
|
||||
nxos_vpc: &auto_false1
|
||||
provider: "{{ connection }}"
|
||||
state: present
|
||||
domain: 100
|
||||
auto_recovery: False
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
- name: "Conf Idempotence"
|
||||
nxos_vpc: *auto_false1
|
||||
register: result
|
||||
|
||||
- assert: *false
|
||||
|
||||
when: not (platform is search("N7K|N9K-F"))
|
||||
- assert: *false
|
||||
|
||||
- name: Configure vpc2
|
||||
nxos_vpc: &conf_vpc2
|
||||
@@ -135,6 +132,8 @@
|
||||
system_priority: default
|
||||
peer_gw: True
|
||||
delay_restore: default
|
||||
delay_restore_interface_vlan: default
|
||||
delay_restore_orphan_port: "{{ def_delay_restore_orphan_port|default(omit) }}"
|
||||
register: result
|
||||
|
||||
- assert: *true
|
||||
|
||||
Reference in New Issue
Block a user