Skip to content

Commit eb09f77

Browse files
committed
Update test playbook to use new network ID and add blocked URL categories. Refactor content filtering logic in related plugins for improved handling of blocked URL categories.
1 parent 71acc2e commit eb09f77

File tree

4 files changed

+25
-35
lines changed

4 files changed

+25
-35
lines changed

playbooks/test.yml

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,16 @@
11
- name: Play Name
22
hosts: localhost
33
vars:
4-
network_id: L_828099381482771185
4+
network_id: L_828099381482778041
55
org_id: "828099381482762270"
6+
blocked_url_category_ids:
7+
- meraki:contentFiltering/category/C1
8+
- meraki:contentFiltering/category/C3
69
gather_facts: false
710
tasks:
8-
# - name: Get all networks _clients
9-
# cisco.meraki.networks_clients_info:
10-
# meraki_suppress_logging: false
11-
# timespan: 1
12-
# perPage: 3
13-
# networkId: L_828099381482771185
14-
# total_pages: -1
15-
# direction: next
16-
# register: result
1711
- name: Update all
18-
cisco.meraki.devices_cellular_sims:
19-
meraki_base_url: "http://localhost:3002"
20-
state: present
21-
serial: string
22-
simFailover:
23-
enabled: true
24-
timeout: 300
25-
simOrdering:
26-
- sim1
27-
- sim2
28-
- sim3
29-
sims:
30-
- apns:
31-
- allowedIpTypes:
32-
- ipv4
33-
- ipv6
34-
authentication:
35-
password: secret
36-
type: pap
37-
username: milesmeraki
38-
name: internet
39-
isPrimary: false
40-
simOrder: 3
41-
slot: sim2
12+
cisco.meraki.networks_appliance_content_filtering:
13+
meraki_suppress_logging: false
14+
networkId: "{{ network_id }}"
15+
blockedUrlCategories: "{{ blocked_url_category_ids }}"
16+
state: present

plugins/action/administered_licensing_subscription_subscriptions_bind.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _check_argspec(self):
6767
def get_object(self, params):
6868
new_object = dict(
6969
networkIds=params.get("networkIds"),
70-
subscription_id=params.get("subscriptionId"),
70+
subscriptionId=params.get("subscriptionId"),
7171
validate=params.get("validate"),
7272
)
7373
return new_object

plugins/action/networks_appliance_content_filtering.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ def requires_update(self, current_obj):
144144
]
145145
# Method 1. Params present in request (Ansible) obj are the same as the current (ISE) params
146146
# If any does not have eq params, it requires update
147+
148+
new_blocked_url_categories =[]
149+
for category in current_obj.get("blockedUrlCategories"):
150+
new_blocked_url_categories.append(category.get("id"))
151+
152+
current_obj["blockedUrlCategories"] = new_blocked_url_categories
147153
return any(not meraki_compare_equality2(current_obj.get(meraki_param),
148154
requested_obj.get(ansible_param))
149155
for (meraki_param, ansible_param) in obj_params)

plugins/plugin_utils/meraki.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ def has_diff_elem2(ls1, ls2):
6868
"""Compares two lists, with dictionaries inside them, to detect differences."""
6969
if len(ls1) != len(ls2):
7070
return True
71+
72+
# Check if first elements are dictionaries before accessing keys
73+
if not (isinstance(ls1[0], dict) and isinstance(ls2[0], dict)):
74+
# If not both dicts, fall back to simple comparison
75+
for i, elem in enumerate(ls2):
76+
if str(ls1[i]) != str(elem):
77+
return True
78+
return False
79+
7180
# Only compare common keys between ls1 and ls2
7281
common_keys = set(ls1[0].keys()) & set(ls2[0].keys())
7382
for i, elem in enumerate(ls2):

0 commit comments

Comments
 (0)