Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ndo_l3out_interface_routing_policy to manage L3Out Interface Routing Policy (DCNE-132) #563

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
13 changes: 13 additions & 0 deletions plugins/module_utils/mso.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ def ndo_remote_user_spec():
)


def ndo_bfd_multi_hop_settings_spec():
return dict(
type="dict",
options=dict(
state=dict(type="str", choices=["enabled", "disabled"]),
admin_state=dict(type="str", choices=["enabled", "disabled"]),
detection_multiplier=dict(type="int"),
min_receive_interval=dict(type="int"), # msec
min_transmit_interval=dict(type="int"), # msec
),
)


# Copied from ansible's module uri.py (url): https://github.com/ansible/ansible/blob/cdf62edc65f564fff6b7e575e084026fa7faa409/lib/ansible/modules/uri.py
def write_file(module, url, dest, content, resp, tmpsrc=None):
# create a tempfile with some test content
Expand Down
22 changes: 22 additions & 0 deletions plugins/module_utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,25 @@ def get_interface_policy_group_uuid(self, interface_policy_group):
kv_list = [KVPair("name", interface_policy_group)]
match = self.get_object_by_key_value_pairs("Interface Policy Groups", existing_policy_groups, kv_list, fail_module=True)
return match.details.get("uuid")

def get_l3out_interface_routing_policy_object(self, uuid=None, name=None, fail_module=False):
"""
Get the L3Out Interface Routing Policy by UUID or Name.
:param uuid: UUID of the L3Out Interface Routing Policy to search for -> Str
:param name: Name of the L3Out Interface Routing Policy to search for -> Str
:param fail_module: When match is not found fail the ansible module -> Bool
:return: Dict | None | List[Dict] | List[]: The processed result which could be:
When the UUID | Name is existing in the search list -> Dict
When the UUID | Name is not existing in the search list -> None
When both UUID and Name are None, and the search list is not empty -> List[Dict]
When both UUID and Name are None, and the search list is empty -> List[]
"""
existing_l3out_interface_routing_policy = self.template.get("tenantPolicyTemplate", {}).get("template", {}).get("l3OutIntfPolGroups", [])
if uuid or name: # Query a specific object
return self.get_object_by_key_value_pairs(
"L3Out Interface Routing Policy",
existing_l3out_interface_routing_policy,
[KVPair("uuid", uuid) if uuid else KVPair("name", name)],
fail_module,
)
return existing_l3out_interface_routing_policy # Query all objects
sajagana marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading