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

Add GEANT sites to extra_vars in in P to PE promotion deploy base config steps.

parent 2ea0f7b4
No related branches found
No related tags found
No related merge requests found
...@@ -253,3 +253,18 @@ def get_site_by_name(site_name: str) -> Site: ...@@ -253,3 +253,18 @@ def get_site_by_name(site_name: str) -> Site:
raise ValueError(msg) raise ValueError(msg)
return Site.from_subscription(subscription[0].subscription_id) return Site.from_subscription(subscription[0].subscription_id)
def get_all_active_sites() -> list[dict[str, Any]]:
"""Retrieve all active sites subscription together with instance values.
:return: A list of active sites with their subscription IDs and site instances.
:rtype: list[dict[str, Any]]
"""
return [
{
"subscription_id": subscription["subscription_id"],
"site": Site.from_subscription(subscription["subscription_id"]).site,
}
for subscription in get_active_site_subscriptions(includes=["subscription_id"])
]
"""Promote a P router to a PE router.""" """Promote a P router to a PE router."""
import json
from typing import Any from typing import Any
from orchestrator.config.assignee import Assignee from orchestrator.config.assignee import Assignee
...@@ -8,6 +9,7 @@ from orchestrator.forms.validators import Label ...@@ -8,6 +9,7 @@ from orchestrator.forms.validators import Label
from orchestrator.targets import Target from orchestrator.targets import Target
from orchestrator.types import FormGenerator, State, UUIDstr from orchestrator.types import FormGenerator, State, UUIDstr
from orchestrator.utils.errors import ProcessFailureError from orchestrator.utils.errors import ProcessFailureError
from orchestrator.utils.json import json_dumps
from orchestrator.workflow import StepList, begin, conditional, done, inputstep, step, workflow from orchestrator.workflow import StepList, begin, conditional, done, inputstep, step, workflow
from orchestrator.workflows.steps import resync, store_process_subscription, unsync from orchestrator.workflows.steps import resync, store_process_subscription, unsync
from orchestrator.workflows.utils import wrap_modify_initial_input_form from orchestrator.workflows.utils import wrap_modify_initial_input_form
...@@ -18,6 +20,7 @@ from gso.products.product_types.router import Router ...@@ -18,6 +20,7 @@ from gso.products.product_types.router import Router
from gso.services import lso_client from gso.services import lso_client
from gso.services.kentik_client import KentikClient, NewKentikDevice from gso.services.kentik_client import KentikClient, NewKentikDevice
from gso.services.lso_client import lso_interaction from gso.services.lso_client import lso_interaction
from gso.services.subscriptions import get_all_active_sites
from gso.utils.helpers import generate_inventory_for_active_routers from gso.utils.helpers import generate_inventory_for_active_routers
from gso.utils.shared_enums import Vendor from gso.utils.shared_enums import Vendor
from gso.utils.types import TTNumber from gso.utils.types import TTNumber
...@@ -66,6 +69,7 @@ def deploy_pe_base_config_dry( ...@@ -66,6 +69,7 @@ def deploy_pe_base_config_dry(
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - deploy PE base config", "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - deploy PE base config",
"verb": "deploy_pe_base_config", "verb": "deploy_pe_base_config",
"pe_router_list": generate_inventory_for_active_routers(RouterRole.PE)["all"]["hosts"], "pe_router_list": generate_inventory_for_active_routers(RouterRole.PE)["all"]["hosts"],
"geant_sites": json.loads(json_dumps(get_all_active_sites())),
} }
lso_client.execute_playbook( lso_client.execute_playbook(
...@@ -87,6 +91,7 @@ def deploy_pe_base_config_real( ...@@ -87,6 +91,7 @@ def deploy_pe_base_config_real(
"commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - deploy PE base config", "commit_comment": f"GSO_PROCESS_ID: {process_id} - TT_NUMBER: {tt_number} - deploy PE base config",
"verb": "deploy_pe_base_config", "verb": "deploy_pe_base_config",
"pe_router_list": generate_inventory_for_active_routers(RouterRole.PE)["all"]["hosts"], "pe_router_list": generate_inventory_for_active_routers(RouterRole.PE)["all"]["hosts"],
"geant_sites": json.loads(json_dumps(get_all_active_sites())),
} }
lso_client.execute_playbook( lso_client.execute_playbook(
......
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