mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
* nxos_vlan: fix broken purge behavior (issue #57101) Symptoms/Analysis: - `nxos_vlan` `purge: true` would fail when `purge` was trying to delete all unspecified vlans, including vlan 1. - `nxos` devices do not allow removing vlan 1 and raise a cli exception error - Previous fix #55144 caused a side effect when `purge` was used: vlan changes specified by `aggregate` were ignored; e.g. - vlan 4 is not present; playbook specifies `aggregate: { vlan: 4 }, purge: true` - results in proper purging but vlan 4 is not created Solutions: - ignore vlan 1 when purging - remove the `not purge` check from state present logic Added additional unit tests and integration tests. Tested against all regression platforms. * PEP fixes * Add agg_show_vlan_brief.txt fixture * Add warning for removing vlan 1 * change method name check
This commit is contained in:
committed by
Trishna Guha
parent
333f54ec3b
commit
6bb13bbb84
@@ -8,6 +8,7 @@
|
||||
lines:
|
||||
- no vlan 102
|
||||
- no vlan 103
|
||||
- no vlan 104
|
||||
provider: "{{ connection }}"
|
||||
ignore_errors: yes
|
||||
|
||||
@@ -84,8 +85,38 @@
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: "setup for purge test with aggregate add"
|
||||
nxos_vlan:
|
||||
vlan_id: 104
|
||||
purge: true
|
||||
provider: "{{ connection }}"
|
||||
|
||||
- name: purge 104 with aggregate add 102-103
|
||||
nxos_vlan: &purge_add
|
||||
aggregate:
|
||||
- { vlan_id: 102 }
|
||||
- { vlan_id: 103 }
|
||||
purge: true
|
||||
provider: "{{ connection }}"
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == true'
|
||||
- '"vlan 102" in result.commands'
|
||||
- '"vlan 103" in result.commands'
|
||||
- '"no vlan 104" in result.commands'
|
||||
|
||||
- name: purge_add - Idempotence
|
||||
nxos_vlan: *purge_add
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'result.changed == false'
|
||||
|
||||
- name: teardown
|
||||
nxos_config: *rm
|
||||
ignore_errors: yes
|
||||
|
||||
- debug: msg="END connection={{ ansible_connection }}/agg.yaml"
|
||||
- debug: msg="END connection={{ ansible_connection }}/agg.yaml"
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
- assert: *false
|
||||
when: platform is search('N3K|N7K')
|
||||
|
||||
# Uncomment this once the get_capabilities() work on nxapi as well
|
||||
- name: Change mode
|
||||
nxos_vlan: &mode1
|
||||
vlan_id: 50
|
||||
|
||||
Reference in New Issue
Block a user