Skip to content

Commit

Permalink
[minor_change] Added ndo_l3out_interface_routing_policy to manage L3O…
Browse files Browse the repository at this point in the history
…ut Interface Routing Policy
  • Loading branch information
sajagana committed Nov 8, 2024
1 parent e19f206 commit 6e1cc12
Show file tree
Hide file tree
Showing 5 changed files with 1,966 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/module_utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,5 @@

ORIGINATE_DEFAULT_ROUTE = {"only": "only", "in_addition": "inAddition", "": ""}
L3OUT_ROUTING_PROTOCOLS = {"bgp": ["bgp"], "ospf": ["ospf"], "bgpOspf": ["bgp", "ospf"], None: [None], "": None, "bgpospf": "bgpOspf", "ospfbgp": "bgpOspf"}

ENABLED_DISABLED_BOOLEAN_MAP = {"enabled": True, "disabled": False, True: "enabled", False: "disabled"}
22 changes: 22 additions & 0 deletions plugins/module_utils/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,25 @@ def get_l3out_node_routing_policy_object(self, uuid=None, name=None, fail_module
"L3Out Node Routing Policy", existing_l3out_node_routing_policy, [KVPair("uuid", uuid) if uuid else KVPair("name", name)], fail_module
)
return existing_l3out_node_routing_policy # Query all objects

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
Loading

0 comments on commit 6e1cc12

Please sign in to comment.