Skip to content

Commit

Permalink
Merge pull request #37 from meraki/develop
Browse files Browse the repository at this point in the history
2.16.16:
  • Loading branch information
fmunozmiranda authored Nov 30, 2023
2 parents 8100b34 + ef4c44e commit 6302dcf
Show file tree
Hide file tree
Showing 23 changed files with 143 additions and 193 deletions.
24 changes: 23 additions & 1 deletion changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -959,4 +959,26 @@ releases:
bugfixes:
- Adding `network_clients_info` and `network_client_info`.
- Adding `platform_meraki.rst` to docs.
release_date: '2023-11-14'
release_date: '2023-11-14'
2.16.16:
changes:
bugfixes:
- Idempotency bugs fixed in devices_switch_ports.
- Adding `product_types` for update request on networks.
- networks_syslog_servers is now just an Update action to API.
- Parameter`organization_id` change to `organizationId` organizations_claim.
- Parameter`organization_id` change to `organizationId` organizations_clone.
- Parameter`organization_id` change to `organizationId` organizations_inventory_claim.
- Parameter`organization_id` change to `organizationId` organizations_inventory_onboarding_cloud_monitoring_export_events.
- Parameter`organization_id` change to `organizationId` organizations_inventory_onboarding_cloud_monitoring_prepare.
- Parameter`organization_id` change to `organizationId` organizations_inventory_release.
- Parameter`organization_id` change to `organizationId` organizations_licenses_assign_seats.
- Parameter`organization_id` change to `organizationId` organizations_licenses_move.
- Parameter`organization_id` change to `organizationId` organizations_licenses_move_seats.
- Parameter`organization_id` change to `organizationId` organizations_licenses_renew_seats.
- Parameter`organization_id` change to `organizationId` organizations_licensing_coterm_licenses_move.
- Parameter`organization_id` change to `organizationId` organizations_networks_combine.
- Parameter`organization_id` change to `organizationId` organizations_switch_devices_clone.
- Parameter`organization_id` change to `organizationId` organizations_users.
- Removing logs in meraki.py.
release_date: '2023-11-30'
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: cisco
name: meraki
version: 2.16.15
version: 2.16.16
readme: README.md
authors:
- Francisco Muñoz <[email protected]>
Expand Down
1 change: 0 additions & 1 deletion playbooks/Get_AP_Serials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@
- name: Show All Devices
ansible.builtin.debug:
msg: "{{ aps }}"

80 changes: 49 additions & 31 deletions playbooks/networks.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
---
- hosts: localhost
gather_facts: false
tasks:
- name: Get all networks
cisco.meraki.networks_info:
# configTemplateId: string
# isBoundToConfigTemplate: True
# tags: []
# tagsFilterType: string
# perPage: 0
# startingAfter: string
# endingBefore: string
organizationId: "828099381482762270"
register: result
- name: Get all networks2
cisco.meraki.networks_clients_info:
# configTemplateId: string
# isBoundToConfigTemplate: True
# tags: []
# tagsFilterType: string
# perPage: 0
# startingAfter: string
# endingBefore: string
# organizationId: "828099381482762270"
networkId: "{{item.id}}"
loop: "{{result.meraki_response}}"
register: result2
# - hosts: localhost
# gather_facts: false
# tasks:
# - name: Get all networks
# cisco.meraki.networks_info:
# # configTemplateId: string
# # isBoundToConfigTemplate: True
# # tags: []
# # tagsFilterType: string
# # perPage: 0
# # startingAfter: string
# # endingBefore: string
# organizationId: "828099381482762270"
# register: result
# - name: Get all networks2
# cisco.meraki.networks_clients_info:
# # configTemplateId: string
# # isBoundToConfigTemplate: True
# # tags: []
# # tagsFilterType: string
# # perPage: 0
# # startingAfter: string
# # endingBefore: string
# # organizationId: "828099381482762270"
# networkId: "{{item.id}}"
# loop: "{{result.meraki_response}}"
# register: result2

- name: Show result
ansible.builtin.debug:
msg: "{{ result2 }}"
# - name: Show result
# ansible.builtin.debug:
# msg: "{{ result2 }}"


# - name: Create
Expand All @@ -47,4 +47,22 @@
# tags:
# - tag1
# - tag3
# timeZone: America/Los_Angeles
# timeZone: America/Los_Angeles

- hosts: localhost
vars:
org_id: 828099381482762270
gather_facts: false
tasks:

- name: Createa a new network
cisco.meraki.networks:
meraki_suppress_logging: false
state: present
name: New network by Ansible
notes: Additional description of the network
organizationId: "{{ org_id }}"
productTypes:
- appliance
- switch
timeZone: America/Los_Angeles
27 changes: 20 additions & 7 deletions playbooks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@
gather_facts: false
tasks:

# - name: Get all networks _appliance _ports
# cisco.meraki.networks_appliance_ports_info:
# networkId: L_828099381482771185
# register: result
- name: update port
cisco.meraki.devices_switch_ports:
meraki_suppress_logging: false
serial: QBSB-BNH2-KDXJ
portId: 3
vlan: 50
# type: access
state: present
poeEnabled: false
# - name: Update appliance Vlans
# cisco.meraki.networks_appliance_vlans:
# state: present
Expand Down Expand Up @@ -106,10 +119,10 @@
# networkId: "{{network_id}}"


- name: change name of device
cisco.meraki.devices:
name: new name 4
serial: QBSB-D5ZD-9CXT
# organizationId: "{{org_id}}"
state: present
meraki_suppress_logging: false
# - name: change name of device
# cisco.meraki.devices:
# name: new name 4
# serial: QBSB-D5ZD-9CXT
# # organizationId: "{{org_id}}"
# state: present
# meraki_suppress_logging: false
24 changes: 15 additions & 9 deletions plugins/action/devices_switch_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ansible_collections.cisco.meraki.plugins.plugin_utils.meraki import (
MERAKI,
meraki_argument_spec,
meraki_compare_equality,
meraki_compare_equality2,
get_dict_result,
)
from ansible_collections.cisco.meraki.plugins.plugin_utils.exceptions import (
Expand Down Expand Up @@ -142,9 +142,11 @@ def update_by_id_params(self):
new_object_params['allowedVlans'] = self.new_object.get('allowedVlans') or \
self.new_object.get('allowed_vlans')
if self.new_object.get('isolationEnabled') is not None or self.new_object.get('isolation_enabled') is not None:
new_object_params['isolationEnabled'] = self.new_object.get('isolationEnabled')
new_object_params['isolationEnabled'] = self.new_object.get(
'isolationEnabled')
if self.new_object.get('rstpEnabled') is not None or self.new_object.get('rstp_enabled') is not None:
new_object_params['rstpEnabled'] = self.new_object.get('rstpEnabled')
new_object_params['rstpEnabled'] = self.new_object.get(
'rstpEnabled')
if self.new_object.get('stpGuard') is not None or self.new_object.get('stp_guard') is not None:
new_object_params['stpGuard'] = self.new_object.get('stpGuard') or \
self.new_object.get('stp_guard')
Expand Down Expand Up @@ -173,14 +175,17 @@ def update_by_id_params(self):
new_object_params['stickyMacAllowListLimit'] = self.new_object.get('stickyMacAllowListLimit') or \
self.new_object.get('sticky_mac_allow_list_limit')
if self.new_object.get('stormControlEnabled') is not None or self.new_object.get('storm_control_enabled') is not None:
new_object_params['stormControlEnabled'] = self.new_object.get('stormControlEnabled')
new_object_params['stormControlEnabled'] = self.new_object.get(
'stormControlEnabled')
if self.new_object.get('adaptivePolicyGroupId') is not None or self.new_object.get('adaptive_policy_group_id') is not None:
new_object_params['adaptivePolicyGroupId'] = self.new_object.get('adaptivePolicyGroupId') or \
self.new_object.get('adaptive_policy_group_id')
if self.new_object.get('peerSgtCapable') is not None or self.new_object.get('peer_sgt_capable') is not None:
new_object_params['peerSgtCapable'] = self.new_object.get('peerSgtCapable')
new_object_params['peerSgtCapable'] = self.new_object.get(
'peerSgtCapable')
if self.new_object.get('flexibleStackingEnabled') is not None or self.new_object.get('flexible_stacking_enabled') is not None:
new_object_params['flexibleStackingEnabled'] = self.new_object.get('flexibleStackingEnabled')
new_object_params['flexibleStackingEnabled'] = self.new_object.get(
'flexibleStackingEnabled')
if self.new_object.get('daiTrusted') is not None or self.new_object.get('dai_trusted') is not None:
new_object_params['daiTrusted'] = self.new_object.get('daiTrusted')
if self.new_object.get('profile') is not None or self.new_object.get('profile') is not None:
Expand All @@ -196,6 +201,7 @@ def update_by_id_params(self):

def get_object_by_name(self, name):
result = None
name = self.new_object.get('portId') or self.new_object.get('port_id')
# NOTE: Does not have a get by name method, using get all
try:
items = self.meraki.exec_meraki(
Expand All @@ -206,7 +212,7 @@ def get_object_by_name(self, name):
if isinstance(items, dict):
if 'response' in items:
items = items.get('response')
result = get_dict_result(items, 'name', name)
result = get_dict_result(items, 'portId', name)
if result is None:
result = items
except Exception as e:
Expand Down Expand Up @@ -293,8 +299,8 @@ def requires_update(self, current_obj):
]
# Method 1. Params present in request (Ansible) obj are the same as the current (ISE) params
# If any does not have eq params, it requires update
return any(not meraki_compare_equality(current_obj.get(meraki_param),
requested_obj.get(ansible_param))
return any(not meraki_compare_equality2(current_obj.get(meraki_param),
requested_obj.get(ansible_param))
for (meraki_param, ansible_param) in obj_params)

def update(self):
Expand Down
3 changes: 3 additions & 0 deletions plugins/action/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ def update_by_id_params(self):
if self.new_object.get('timeZone') is not None or self.new_object.get('time_zone') is not None:
new_object_params['timeZone'] = self.new_object.get('timeZone') or \
self.new_object.get('time_zone')
if self.new_object.get('productTypes') is not None or self.new_object.get('product_types') is not None:
new_object_params['productTypes'] = self.new_object.get('productTypes') or \
self.new_object.get('product_types')
if self.new_object.get('tags') is not None or self.new_object.get('tags') is not None:
new_object_params['tags'] = self.new_object.get('tags') or \
self.new_object.get('tags')
Expand Down
Loading

0 comments on commit 6302dcf

Please sign in to comment.