Skip to content

Commit

Permalink
[ignore_changes] Rebased to latest master.
Browse files Browse the repository at this point in the history
  • Loading branch information
anvitha-jain committed Jan 24, 2025
1 parent 6f430f9 commit b6b2ae6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 35 deletions.
43 changes: 12 additions & 31 deletions plugins/modules/ndo_tenant_igmp_interface_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@
- The name of the Route Map Policy for Multicast.
type: str
required: true
template:
description:
- The name of the template in which the Route Map Policy for Multicast has been created.
type: str
required: true
aliases: [ state_limit_route_map_policy, state_limit_route_map_policy_multicast ]
report_policy_route_map_uuid:
description:
Expand All @@ -161,11 +156,6 @@
- The name of the Route Map Policy for Multicast.
type: str
required: true
template:
description:
- The name of the template in which the Route Map Policy for Multicast has been created.
type: str
required: true
aliases: [ report_policy_route_map_policy, report_policy_route_map_policy_multicast ]
static_report_route_map_uuid:
description:
Expand All @@ -184,11 +174,6 @@
- The name of the Route Map Policy for Multicast.
type: str
required: true
template:
description:
- The name of the template in which the Route Map Policy for Multicast has been created.
type: str
required: true
aliases: [ static_report_route_map_policy, static_report_route_map_policy_multicast ]
maximum_multicast_entries:
description:
Expand Down Expand Up @@ -225,7 +210,7 @@
EXAMPLES = r"""
- name: Create an IGMP Interface Policy
cisco.mso.ndo_tenant_igmp_interface_policy:
template: TestTenantTemplate
template: ansible_tenant_template
name: test_igmp_interface_policy
description: Test Description
version3_asm: enabled
Expand All @@ -245,7 +230,6 @@
report_policy_route_map_uuid: route_map_policy_for_multicast_uuid
static_report_route_map:
name: TestStaticReportRouteMap
template: TestTenantTemplate
maximum_multicast_entries: 4294967295
reserved_multicast_entries: 4294967
state: present
Expand All @@ -256,7 +240,7 @@
host: mso_host
username: admin
password: SomeSecretPassword
template: tenant_template
template: ansible_tenant_template
name: test_igmp_interface_policy_updated
uuid: "{{ igmp_interface_policy.current.uuid }}"
state: present
Expand All @@ -267,7 +251,7 @@
host: mso_host
username: admin
password: SomeSecretPassword
template: TestTenantTemplate
template: ansible_tenant_template
name: test_igmp_interface_policy
state: query
register: query
Expand All @@ -277,7 +261,7 @@
host: mso_host
username: admin
password: SomeSecretPassword
template: TestTenantTemplate
template: ansible_tenant_template
uuid: "{{ igmp_interface_policy.current.uuid }}"
state: query
register: query_uuid
Expand All @@ -287,7 +271,7 @@
host: mso_host
username: admin
password: SomeSecretPassword
template: TestTenantTemplate
template: ansible_tenant_template
state: query
register: query_all
Expand All @@ -296,7 +280,7 @@
host: mso_host
username: admin
password: SomeSecretPassword
template: TestTenantTemplate
template: ansible_tenant_template
name: test_igmp_interface_policy
state: absent
Expand All @@ -305,7 +289,7 @@
host: mso_host
username: admin
password: SomeSecretPassword
template: TestTenantTemplate
template: ansible_tenant_template
uuid: "{{ igmp_interface_policy.current.uuid }}"
state: absent
"""
Expand Down Expand Up @@ -346,7 +330,6 @@ def main():
type="dict",
options=dict(
name=dict(type="str", required=True),
template=dict(type="str", required=True),
),
aliases=["state_limit_route_map_policy", "state_limit_route_map_policy_multicast"],
),
Expand All @@ -355,7 +338,6 @@ def main():
type="dict",
options=dict(
name=dict(type="str", required=True),
template=dict(type="str", required=True),
),
aliases=["report_policy_route_map_policy", "report_policy_route_map_policy_multicast"],
),
Expand All @@ -364,7 +346,6 @@ def main():
type="dict",
options=dict(
name=dict(type="str", required=True),
template=dict(type="str", required=True),
),
aliases=["static_report_route_map_policy", "static_report_route_map_policy_multicast"],
),
Expand Down Expand Up @@ -420,20 +401,20 @@ def main():
mso_template.validate_template("tenantPolicy")
ops = []

existing_mld_interface_policies = mso_template.template.get("tenantPolicyTemplate", {}).get("template", {}).get("igmpInterfacePolicies", [])
existing_igmp_interface_policies = mso_template.template.get("tenantPolicyTemplate", {}).get("template", {}).get("igmpInterfacePolicies", [])
object_description = "IGMP Interface Policy"

if name or uuid:
match = mso_template.get_object_by_key_value_pairs(
object_description,
existing_mld_interface_policies,
existing_igmp_interface_policies,
[KVPair("uuid", uuid) if uuid else KVPair("name", name)],
)
if match:
igmp_interface_policy_attrs_path = "/tenantPolicyTemplate/template/igmpInterfacePolicies/{0}".format(match.index)
mso.existing = mso.previous = copy.deepcopy(match.details)
else:
mso.existing = mso.previous = existing_mld_interface_policies
mso.existing = mso.previous = existing_igmp_interface_policies

if state == "present":
if uuid and not mso.existing:
Expand Down Expand Up @@ -484,9 +465,9 @@ def main():

if not module.check_mode and ops:
response_object = mso.request(mso_template.template_path, method="PATCH", data=ops)
existing_mld_interface_policies = response_object.get("tenantPolicyTemplate", {}).get("template", {}).get("igmpInterfacePolicies", [])
existing_igmp_interface_policies = response_object.get("tenantPolicyTemplate", {}).get("template", {}).get("igmpInterfacePolicies", [])
match = mso_template.get_object_by_key_value_pairs(
object_description, existing_mld_interface_policies, [KVPair("uuid", uuid) if uuid else KVPair("name", name)]
object_description, existing_igmp_interface_policies, [KVPair("uuid", uuid) if uuid else KVPair("name", name)]
)
if match:
mso.existing = match.details # When the state is present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,10 @@
robustness_variable: 6
state_limit_route_map:
name: ansible_test_route_map_policy_1
template: ansible_tenant_template
report_policy_route_map:
name: ansible_test_route_map_policy_2
template: ansible_tenant_template
static_report_route_map:
name: ansible_test_route_map_policy_3
template: ansible_tenant_template
maximum_multicast_entries: 3244545
reserved_multicast_entries: 8635434
state: present
Expand Down Expand Up @@ -263,7 +260,6 @@
report_policy_route_map_uuid: "{{ create_route_map_policy_multicast_3.current.uuid }}"
static_report_route_map:
name: ansible_test_route_map_policy_1
template: ansible_tenant_template
maximum_multicast_entries: 3244546
reserved_multicast_entries: 86354345
state: present
Expand Down

0 comments on commit b6b2ae6

Please sign in to comment.