Skip to content

Commit 1cd3a3d

Browse files
Merge pull request #268 from cisco-en-programmability/develop
Develop
2 parents 1dd6012 + 31de352 commit 1cd3a3d

File tree

6 files changed

+44
-21
lines changed

6 files changed

+44
-21
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The following table shows the supported versions.
2222
| 2.3.7.6 | 6.24.0 | 2.8.3 |
2323
| 2.3.7.6 | 6.25.0 | 2.8.3 |
2424
| 2.3.7.7 | 6.30.2 | 2.8.6 |
25-
| 2.3.7.9 | ^6.31.3 | ^2.8.6 |
25+
| 2.3.7.9 | ^6.33.1 | ^2.8.6 |
2626

2727
If your Ansible collection is older please consider updating it first.
2828

changelogs/changelog.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,3 +1608,10 @@ releases:
16081608
- Added attributes 'ipv4_total_addresses', 'ipv4_unassignable_addresses', 'ipv4_assigned_addresses', 'ipv4_default_assigned_addresses', 'ipv6_total_addresses', 'ipv6_unassignable_addresses', 'ipv6_assigned_addresses', 'ipv6_default_assigned_addresses' in 'network_settings_workflow_manager' module
16091609
- Added attribute 'sda_fabric_gateway_limit' in 'sda_fabric_virtual_networks_workflow_manager' module
16101610
- Added attribute 'sub_package_images' in 'swim_workflow_manager' module
1611+
1612+
6.33.1:
1613+
release_date: "2025-05-12"
1614+
changes:
1615+
release_summary: Changes in reserve_ip_subpool modules
1616+
minor_changes:
1617+
- Correction of issue 266 in the reserve_ip_subpool modules

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
namespace: cisco
33
name: dnac
4-
version: 6.33.0
4+
version: 6.33.1
55
readme: README.md
66
authors:
77
- Rafael Campos <rcampos@altus.cr>

playbooks/reserve_ip_subpool.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- credentials.yml
66
gather_facts: false
77
vars:
8-
site: bb25cdaf-3f5a-45b9-bdd6-0f63fdf6c83e
8+
site: 4b9ece30-ef82-4141-ab37-62b33286195b
99

1010
tasks:
1111
- name: Create reservation
@@ -18,19 +18,22 @@
1818
dnac_version: "{{ dnac_version }}"
1919
dnac_debug: "{{ dnac_debug }}"
2020
state: present
21+
ignoreInheritedGroups: true
22+
name: SubPool-Sucursal-01
23+
type: Generic
24+
ipv6AddressSpace: false
25+
ipv4GlobalPool: 10.10.0.0/16
26+
ipv4Prefix: true
27+
ipv4PrefixLength: 28
28+
ipv4Subnet: 10.10.1.0
29+
ipv4GateWay: 10.10.1.1
2130
ipv4DhcpServers:
22-
- 55.66.55.55
31+
- 10.10.1.2
2332
ipv4DnsServers:
24-
- 33.33.33.3
25-
ipv4GateWay: 10.0.10.1
26-
ipv4GlobalPool: 10.0.0.0/8
27-
ipv4Prefix: true
28-
ipv4PrefixLength: 24
29-
ipv4Subnet: 10.0.10.0/24
30-
name: IP Pool 1
33+
- 8.8.8.8
34+
- 8.8.4.4
35+
slaacSupport: false
3136
siteId: "{{ site }}"
32-
slaacSupport: true
33-
type: LAN
3437

3538
- name: Get Reservations
3639
cisco.dnac.reserve_ip_subpool_info:

plugins/action/reserve_ip_subpool_v1.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
slaacSupport=dict(type="bool"),
5454
siteId=dict(type="str"),
5555
id=dict(type="str"),
56+
ignoreInheritedGroups=dict(type="bool", default=False),
5657
))
5758

5859
required_if = [
@@ -90,6 +91,7 @@ def __init__(self, params, dnac):
9091
slaacSupport=params.get("slaacSupport"),
9192
site_id=params.get("siteId"),
9293
id=params.get("id"),
94+
ignoreInheritedGroups=params.get("ignoreInheritedGroups"),
9395
)
9496

9597
def get_all_params(self, name=None, id=None):
@@ -128,7 +130,7 @@ def create_params(self):
128130
new_object_params['ipv4TotalHost'] = self.new_object.get('ipv4TotalHost')
129131
new_object_params['ipv6TotalHost'] = self.new_object.get('ipv6TotalHost')
130132
new_object_params['slaacSupport'] = self.new_object.get('slaacSupport')
131-
new_object_params['siteId'] = self.new_object.get('siteId')
133+
new_object_params['site_id'] = self.new_object.get('site_id')
132134
return new_object_params
133135

134136
def delete_by_id_params(self):
@@ -152,7 +154,7 @@ def update_by_id_params(self):
152154
new_object_params['ipv6DnsServers'] = self.new_object.get('ipv6DnsServers')
153155
new_object_params['slaacSupport'] = self.new_object.get('slaacSupport')
154156
new_object_params['ipv4GateWay'] = self.new_object.get('ipv4GateWay')
155-
new_object_params['siteId'] = self.new_object.get('siteId')
157+
new_object_params['site_id'] = self.new_object.get('site_id')
156158
return new_object_params
157159

158160
def get_object_by_name(self, name):
@@ -172,18 +174,21 @@ def get_object_by_name(self, name):
172174
result = None
173175
return result
174176

175-
def get_object_by_id(self, id):
177+
def get_object_by_id(self, id, ignoreInheritedGroups):
176178
result = None
177179
# NOTE: Does not have a get by id method or it is in another action
178180
try:
179181
items = self.dnac.exec(
180182
family="network_settings",
181183
function="get_reserve_ip_subpool_v1",
182-
params=self.get_all_params(id=id),
184+
params=self.get_all_params(site_id=id, ignoreInheritedGroups=ignoreInheritedGroups),
183185
)
184186
if isinstance(items, dict):
185187
if 'response' in items:
186188
items = items.get('response')
189+
if items == []:
190+
result = None
191+
return result
187192
result = get_dict_result(items, 'id', id)
188193
except Exception:
189194
result = None
@@ -193,11 +198,11 @@ def exists(self):
193198
id_exists = False
194199
name_exists = False
195200
prev_obj = None
196-
o_id = self.new_object.get("id")
197-
o_id = o_id or self.new_object.get("site_id")
201+
o_id = self.new_object.get("site_id")
198202
name = self.new_object.get("name")
203+
ignoreInheritedGroups = self.new_object.get("ignoreInheritedGroups")
199204
if o_id:
200-
prev_obj = self.get_object_by_id(o_id)
205+
prev_obj = self.get_object_by_id(o_id, ignoreInheritedGroups)
201206
id_exists = prev_obj is not None and isinstance(prev_obj, dict)
202207
if not id_exists and name:
203208
prev_obj = self.get_object_by_name(name)
@@ -237,7 +242,7 @@ def requires_update(self, current_obj):
237242
("ipv4TotalHost", "ipv4TotalHost"),
238243
("ipv6TotalHost", "ipv6TotalHost"),
239244
("slaacSupport", "slaacSupport"),
240-
("siteId", "site_id"),
245+
("site_id", "site_id"),
241246
("id", "id"),
242247
]
243248
# Method 1. Params present in request (Ansible) obj are the same as the current (DNAC) params

plugins/modules/reserve_ip_subpool_v1.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@
8888
siteId:
8989
description: SiteId path parameter. Site id to reserve the ip sub pool.
9090
type: str
91+
ignoreInheritedGroups:
92+
description:
93+
- >
94+
IgnoreInheritedGroups query parameter. Ignores pools inherited from parent
95+
site. Either siteId or
96+
ignoreInheritedGroups must be passed. They can also be used together.
97+
type: bool
9198
slaacSupport:
9299
description: Slaac Support.
93100
type: bool
@@ -135,6 +142,7 @@
135142
dnac_version: "{{dnac_version}}"
136143
dnac_debug: "{{dnac_debug}}"
137144
state: present
145+
ignoreInheritedGroups: true
138146
ipv4DhcpServers:
139147
- string
140148
ipv4DnsServers:

0 commit comments

Comments
 (0)