Skip to content

Commit c2efb10

Browse files
authored
[minor_change] Add pod_id attribute to aci_switch_policy_vpc_protection_group module
1 parent 3d3dca2 commit c2efb10

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

plugins/modules/aci_switch_policy_vpc_protection_group.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
5+
# Copyright: (c) 2025, Eric Girard @netgirard
56
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
67

78
from __future__ import absolute_import, division, print_function
@@ -40,6 +41,12 @@
4041
description:
4142
- The ID of the Second Leaf Switch for the Explicit vPC Protection Group.
4243
type: int
44+
pod_id:
45+
description:
46+
- The pod id of the VPC member nodes.
47+
- Accepted values range between C(1) and C(255).
48+
- The APIC defaults to C(1) when unset during creation.
49+
type: int
4350
state:
4451
description:
4552
- Use C(present) or C(absent) for adding or removing.
@@ -62,6 +69,7 @@
6269
link: https://developer.cisco.com/docs/apic-mim-ref/
6370
author:
6471
- Bruno Calogero (@brunocalogero)
72+
- Eric Girard (@netgirard)
6573
"""
6674

6775
EXAMPLES = r"""
@@ -224,6 +232,7 @@ def main():
224232
vpc_domain_policy=dict(type="str", aliases=["vpc_domain_policy_name"]),
225233
switch_1_id=dict(type="int"),
226234
switch_2_id=dict(type="int"),
235+
pod_id=dict(type="int"),
227236
state=dict(type="str", default="present", choices=["absent", "present", "query"]),
228237
name_alias=dict(type="str"),
229238
)
@@ -242,6 +251,7 @@ def main():
242251
vpc_domain_policy = module.params.get("vpc_domain_policy")
243252
switch_1_id = module.params.get("switch_1_id")
244253
switch_2_id = module.params.get("switch_2_id")
254+
pod_id = module.params.get("pod_id")
245255
state = module.params.get("state")
246256
name_alias = module.params.get("name_alias")
247257

@@ -271,13 +281,15 @@ def main():
271281
fabricNodePEp=dict(
272282
attributes=dict(
273283
id="{0}".format(switch_1_id),
284+
podId=pod_id,
274285
),
275286
),
276287
),
277288
dict(
278289
fabricNodePEp=dict(
279290
attributes=dict(
280291
id="{0}".format(switch_2_id),
292+
podId=pod_id,
281293
),
282294
),
283295
),

tests/integration/targets/aci_switch_policy_vpc_protection_group/tasks/main.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Test code for the ACI modules
22
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
3+
# Copyright: (c) 2025, Eric Girard <@netgirard>
34

45
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
56

@@ -212,3 +213,44 @@
212213
- cm_query_non_vpc_prot_grp is not changed
213214
- nm_query_non_vpc_prot_grp is not changed
214215
- cm_query_non_vpc_prot_grp == nm_query_non_vpc_prot_grp
216+
217+
# ADD VPC PROTECTION GROUP WITH POD
218+
- name: Add vpc protection group with pod ID (check_mode)
219+
cisco.aci.aci_switch_policy_vpc_protection_group:
220+
<<: *aci_switch_policy_vpc_protection_group_present
221+
pod_id: 2
222+
check_mode: true
223+
register: cm_add_vpc_prot_grp_pod
224+
225+
- name: Add vpc protection group with pod ID (normal mode)
226+
cisco.aci.aci_switch_policy_vpc_protection_group:
227+
<<: *aci_switch_policy_vpc_protection_group_present
228+
pod_id: 2
229+
register: nm_add_vpc_prot_grp_pod
230+
231+
- name: Add vpc protection group with pod ID again (check_mode)
232+
cisco.aci.aci_switch_policy_vpc_protection_group:
233+
<<: *aci_switch_policy_vpc_protection_group_present
234+
pod_id: 2
235+
check_mode: true
236+
register: cm_add_vpc_prot_grp_pod_again
237+
238+
- name: Add vpc protection group with pod ID again (normal mode)
239+
cisco.aci.aci_switch_policy_vpc_protection_group:
240+
<<: *aci_switch_policy_vpc_protection_group_present
241+
pod_id: 2
242+
register: nm_add_vpc_prot_grp_pod_again
243+
244+
- name: Verify addvpc protection group with pod ID tasks
245+
ansible.builtin.assert:
246+
that:
247+
- cm_add_vpc_prot_grp_pod is changed
248+
- cm_add_vpc_prot_grp_pod.previous == []
249+
- cm_add_vpc_prot_grp_pod.proposed.0.fabricExplicitGEp.children.0.fabricNodePEp.attributes.podId == '2'
250+
- cm_add_vpc_prot_grp_pod.proposed.0.fabricExplicitGEp.children.1.fabricNodePEp.attributes.podId == '2'
251+
- nm_add_vpc_prot_grp_pod is changed
252+
- nm_add_vpc_prot_grp_pod.current.0.fabricExplicitGEp.children.0.fabricNodePEp.attributes.podId == '2'
253+
- nm_add_vpc_prot_grp_pod.current.0.fabricExplicitGEp.children.1.fabricNodePEp.attributes.podId == '2'
254+
- nm_add_vpc_prot_grp_pod.current.0.fabricExplicitGEp.attributes.annotation == 'orchestrator:ansible'
255+
- cm_add_vpc_prot_grp_pod_again is not changed
256+
- nm_add_vpc_prot_grp_pod_again is not changed

0 commit comments

Comments
 (0)