Skip to content
Snippets Groups Projects
Verified Commit 9e588369 authored by Neda Moeini's avatar Neda Moeini Committed by Karel van Klink
Browse files

Improved promote P to PE workflow.

parent f6caeb05
No related branches found
Tags 2.12
No related merge requests found
...@@ -306,6 +306,7 @@ def generate_fqdn(hostname: str, site_name: str, country_code: str) -> str: ...@@ -306,6 +306,7 @@ def generate_fqdn(hostname: str, site_name: str, country_code: str) -> str:
def generate_inventory_for_active_routers( def generate_inventory_for_active_routers(
router_role: RouterRole, router_role: RouterRole,
exclude_routers: list[str] | None = None, exclude_routers: list[str] | None = None,
router_vendor: Vendor | None = None,
) -> dict: ) -> dict:
"""Generate an Ansible-compatible inventory for executing playbooks. """Generate an Ansible-compatible inventory for executing playbooks.
...@@ -313,6 +314,7 @@ def generate_inventory_for_active_routers( ...@@ -313,6 +314,7 @@ def generate_inventory_for_active_routers(
:param RouterRole router_role: The role of the routers to include in the inventory. :param RouterRole router_role: The role of the routers to include in the inventory.
:param list exclude_routers: List of routers to exclude from the inventory. :param list exclude_routers: List of routers to exclude from the inventory.
:param Vendor router_vendor: The vendor of the routers to include in the inventory.
:return: A dictionary representing the inventory of active routers. :return: A dictionary representing the inventory of active routers.
:rtype: dict[str, Any] :rtype: dict[str, Any]
""" """
...@@ -328,7 +330,9 @@ def generate_inventory_for_active_routers( ...@@ -328,7 +330,9 @@ def generate_inventory_for_active_routers(
"vendor": str(router.router.vendor), "vendor": str(router.router.vendor),
} }
for router in all_routers for router in all_routers
if router.router.router_role == router_role and router.router.router_fqdn not in exclude_routers if router.router.router_role == router_role
and router.router.router_fqdn not in exclude_routers
and (router_vendor is None or router.router.vendor == router_vendor)
} }
} }
} }
......
...@@ -20,6 +20,7 @@ WF_USABLE_MAP.update({ ...@@ -20,6 +20,7 @@ WF_USABLE_MAP.update({
"terminate_site": ALL_ALIVE_STATES, "terminate_site": ALL_ALIVE_STATES,
"terminate_router": ALL_ALIVE_STATES, "terminate_router": ALL_ALIVE_STATES,
"terminate_iptrunk": ALL_ALIVE_STATES, "terminate_iptrunk": ALL_ALIVE_STATES,
"promote_p_to_pe": [SubscriptionLifecycle.ACTIVE],
}) })
# IP trunk workflows # IP trunk workflows
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment