meraki_switchport - Improve reliability (#54275)

* Rewrite much of the execution of meraki_switchport
- Previous versions had problems with idempotency and allowed_vlans

* Modified payload creation
- Parameter map is used
- propsed is created using .copy()
- Much cleaner this way

* Add whitespace for lint

* Add bugfix snippet for changelog
This commit is contained in:
Kevin Breit 2019-05-16 11:10:32 -05:00 committed by Nathaniel Case
parent 4b0014166b
commit d59eb9edab
3 changed files with 98 additions and 70 deletions

View file

@ -24,7 +24,7 @@
auth_key: '{{ auth_key }}'
use_https: false
state: query
serial: Q2HP-2C6E-
serial: Q2HP-2C6E-GTLD
output_level: debug
delegate_to: localhost
register: http
@ -132,6 +132,48 @@
that:
- update_access_port.data.vlan == 10
- name: Configure port as trunk
meraki_switchport:
auth_key: '{{auth_key}}'
state: present
serial: Q2HP-2C6E-GTLD
number: 8
enabled: true
name: Test Port
type: trunk
vlan: 10
allowed_vlans: 10, 100, 200
delegate_to: localhost
- name: Convert trunk port to access
meraki_switchport:
auth_key: '{{auth_key}}'
state: present
serial: Q2HP-2C6E-GTLD
number: 8
enabled: true
name: Test Port
type: access
vlan: 10
delegate_to: localhost
- name: Test converted port for idempotency
meraki_switchport:
auth_key: '{{auth_key}}'
state: present
serial: Q2HP-2C6E-GTLD
number: 8
enabled: true
name: Test Port
type: access
vlan: 10
delegate_to: localhost
register: convert_idempotent
- assert:
that:
- convert_idempotent.changed == False
- name: Configure access port with voice VLAN
meraki_switchport:
auth_key: '{{auth_key}}'
@ -188,6 +230,7 @@
tags: server
type: trunk
allowed_vlans: all
vlan: 8
delegate_to: localhost
register: update_trunk
@ -210,6 +253,7 @@
name: Server port
tags: server
type: trunk
vlan: 8
allowed_vlans:
- 10
- 15
@ -224,7 +268,7 @@
that:
- update_trunk.data.tags == 'server'
- update_trunk.data.type == 'trunk'
- update_trunk.data.allowedVlans == '10,15,20'
- update_trunk.data.allowedVlans == '8,10,15,20'
- name: Configure trunk port with specific VLANs and native VLAN
meraki_switchport: