mirror of https://github.com/ansible/ansible.git
nxos_vlan, nxos_linkagg fix (#36711)
* fix nxos_vlan aggregate (#36710) * fix nxos_vlan aggregate Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> (cherry picked from commitpull/36724/head44332bda78
) * nxos_linkagg fix (#36706) Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> (cherry picked from commitd6912cf40e
)
parent
d60eac9bc4
commit
b1bdc5dae2
@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
- debug: msg="START connection={{ ansible_connection }}/agg.yaml"
|
||||||
|
- debug: msg="Using provider={{ connection.transport }}"
|
||||||
|
when: ansible_connection == "local"
|
||||||
|
|
||||||
|
- name: setup - remove vlan used in test
|
||||||
|
nxos_config: &rm
|
||||||
|
lines:
|
||||||
|
- no vlan 102
|
||||||
|
- no vlan 103
|
||||||
|
provider: "{{ connection }}"
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
|
||||||
|
- name: configure vlan with aggregate
|
||||||
|
nxos_vlan: &conf1
|
||||||
|
aggregate:
|
||||||
|
- { name: app02, vlan_id: 102 }
|
||||||
|
- { name: app03, vlan_id: 103 }
|
||||||
|
vlan_state: active
|
||||||
|
admin_state: up
|
||||||
|
provider: "{{ connection }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"vlan 102" in result.commands'
|
||||||
|
- '"vlan 103" in result.commands'
|
||||||
|
- '"no shutdown" in result.commands'
|
||||||
|
- '"state active" in result.commands'
|
||||||
|
|
||||||
|
- name: conf1 - Idempotence
|
||||||
|
nxos_vlan: *conf1
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == false'
|
||||||
|
|
||||||
|
- name: change property of existing vlan - admin_state down
|
||||||
|
nxos_vlan: &conf2
|
||||||
|
aggregate:
|
||||||
|
- { name: app02, vlan_id: 102 }
|
||||||
|
- { name: app03, vlan_id: 103 }
|
||||||
|
vlan_state: active
|
||||||
|
admin_state: down
|
||||||
|
provider: "{{ connection }}"
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == true'
|
||||||
|
- '"vlan 102" in result.commands'
|
||||||
|
- '"vlan 103" in result.commands'
|
||||||
|
- '"shutdown" in result.commands'
|
||||||
|
|
||||||
|
- name: conf2 - Idempotence
|
||||||
|
nxos_vlan: *conf2
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'result.changed == false'
|
||||||
|
|
||||||
|
- name: teardown
|
||||||
|
nxos_config: *rm
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- debug: msg="END connection={{ ansible_connection }}/agg.yaml"
|
Loading…
Reference in New Issue