Skip to content

Commit bb63852

Browse files
committed
[ignore] Added new attributes to aci_l4l7_policy_based_redirect_destination
1 parent 41b311a commit bb63852

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

plugins/modules/aci_l4l7_policy_based_redirect_destination.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
- The name of an existing Policy Based Redirect Policy.
2929
type: str
3030
aliases: [ policy_name ]
31+
description:
32+
description:
33+
- The description for redirection.
34+
type: str
3135
ip:
3236
description:
3337
- The destination IP for redirection.
@@ -77,13 +81,19 @@
7781
pod_id:
7882
description:
7983
- The Pod ID to deploy Policy Based Redirect destination on.
80-
- The APIC defaults to C(1) when unset during creation.
84+
- The APIC defaults to 1 when unset during creation.
8185
type: int
8286
health_group:
8387
description:
8488
- The Health Group to bind the Policy Based Redirection Destination to.
8589
- To remove an existing binding from a Health Group, submit a request with I(state=present) and I(health_group="") value.
8690
type: str
91+
weight:
92+
description:
93+
- The weight of the fault in calculating the health score of an object.
94+
- The APIC defaults to 1 when unset during creation.
95+
- Permitted values are in the range of [1, 10].
96+
type: int
8797
state:
8898
description:
8999
- Use C(present) or C(absent) for adding or removing.
@@ -286,6 +296,8 @@ def main():
286296
health_group=dict(type="str"),
287297
state=dict(type="str", default="present", choices=["absent", "present", "query"]),
288298
pod_id=dict(type="int"),
299+
weight=dict(type="int"),
300+
description=dict(type="str"),
289301
)
290302

291303
module = AnsibleModule(
@@ -313,6 +325,8 @@ def main():
313325
health_group = module.params.get("health_group")
314326
state = module.params.get("state")
315327
pod_id = module.params.get("pod_id")
328+
weight = module.params.get("weight")
329+
description = module.params.get("description")
316330

317331
if destination_type == "l1/l2":
318332
aci_class = "vnsL1L2RedirectDest"
@@ -396,6 +410,8 @@ def main():
396410
destName=destination_name,
397411
podId=pod_id,
398412
ip2=additional_ip,
413+
weight=weight,
414+
descr=description,
399415
),
400416
child_configs=child_configs,
401417
)

plugins/modules/aci_l4l7_redirect_health_group.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
description:
2828
- The name of the Health Group.
2929
type: str
30+
aliases: [ name ]
31+
description:
32+
description:
33+
- The description of the Health Group.
34+
type: str
3035
state:
3136
description:
3237
- Use C(present) or C(absent) for adding or removing.
@@ -210,7 +215,8 @@ def main():
210215
argument_spec.update(
211216
tenant=dict(type="str", aliases=["tenant_name"]),
212217
state=dict(type="str", default="present", choices=["absent", "present", "query"]),
213-
health_group=dict(type="str"),
218+
health_group=dict(type="str", aliases=["name"]),
219+
description=dict(type="str"),
214220
)
215221

216222
module = AnsibleModule(
@@ -225,6 +231,7 @@ def main():
225231
tenant = module.params.get("tenant")
226232
state = module.params.get("state")
227233
health_group = module.params.get("health_group")
234+
description = module.params.get("description")
228235

229236
aci = ACIModule(module)
230237

@@ -247,7 +254,10 @@ def main():
247254
if state == "present":
248255
aci.payload(
249256
aci_class="vnsRedirectHealthGroup",
250-
class_config=dict(name=health_group),
257+
class_config=dict(
258+
name=health_group,
259+
descr=description,
260+
),
251261
)
252262
aci.get_diff(aci_class="vnsRedirectHealthGroup")
253263

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
use_proxy: '{{ aci_use_proxy | default(true) }}'
2222
output_level: '{{ aci_output_level | default("info") }}'
2323

24+
- name: Query system information
25+
cisco.aci.aci_system:
26+
<<: *aci_info
27+
id: 1
28+
state: query
29+
register: version
30+
2431
# CLEAN ENVIRONMENT
2532
- name: Remove ansible_tenant if it already exists
2633
cisco.aci.aci_tenant:
@@ -424,6 +431,31 @@
424431
- update_pbr_l1l2_dest.current.0.vnsL1L2RedirectDest.children.0.vnsRsToCIf.attributes.tDn == "uni/tn-ansible_tenant/lDevVip-ansible_device/cDev-ansible_concrete_device/cIf-[ansible_concrete_interface]"
425432
- update_pbr_l1l2_dest.current.0.vnsL1L2RedirectDest.children | length == 1
426433

434+
- name: Execute tasks only for ACI v6+
435+
when:
436+
- version.current.0.topSystem.attributes.version is version('6', '>=')
437+
block:
438+
- name: Create another L4-L7 Policy Based Redirect Destination to check weight
439+
cisco.aci.aci_l4l7_policy_based_redirect_destination:
440+
<<: *aci_info
441+
tenant: ansible_tenant
442+
policy: ansible_pbr_policy
443+
redirect_ip: 192.168.10.5
444+
additional_ip: 192.168.50.5
445+
redirect_mac: AB:CD:EF:12:34:61
446+
dest_name: redirect_dest
447+
health_group: ansible_health_group
448+
pod_id: 1
449+
weight: 5
450+
state: present
451+
register: add_weight
452+
453+
- name: Verify another L4-L7 Policy Based Redirect Destination to check weight
454+
ansible.builtin.assert:
455+
that:
456+
- add_weight is changed
457+
- add_weight.current.0.vnsRedirectDest.attributes.weight == "5"
458+
427459
# QUERY L4-L7 PBR DESTINATION
428460
- name: Query L4-L7 Policy Based Redirect Destination
429461
cisco.aci.aci_l4l7_policy_based_redirect_destination:

0 commit comments

Comments
 (0)