diff --git a/gso/workflows/router/create_router.py b/gso/workflows/router/create_router.py index 4cb222615ec525c3a66dc2b9b310c621cd580d92..72f9dd9b82147d9fb555f146d50117c166be013d 100644 --- a/gso/workflows/router/create_router.py +++ b/gso/workflows/router/create_router.py @@ -20,11 +20,12 @@ from gso.products.product_blocks.router import ( ) from gso.products.product_types.router import RouterInactive, RouterProvisioning from gso.products.product_types.site import Site -from gso.services import infoblox, provisioning_proxy, subscriptions +from gso.services import infoblox, subscriptions from gso.services.crm import customer_selector from gso.services.netbox_client import NetboxClient from gso.services.provisioning_proxy import pp_interaction from gso.utils.helpers import iso_from_ipv4 +from gso.utils.workflow_steps import deploy_base_config_dry, deploy_base_config_real def _site_selector() -> Choice: @@ -123,32 +124,6 @@ def ipam_allocate_loopback(subscription: RouterProvisioning) -> State: return {"subscription": subscription} -@step("Provision router [DRY RUN]") -def provision_router_dry( - subscription: RouterProvisioning, - process_id: UUIDstr, - callback_route: str, - tt_number: str, -) -> State: - """Perform a dry run of deploying configuration on the router.""" - provisioning_proxy.provision_router(subscription, process_id, callback_route, tt_number) - - return {"subscription": subscription} - - -@step("Provision router [FOR REAL]") -def provision_router_real( - subscription: RouterProvisioning, - process_id: UUIDstr, - callback_route: str, - tt_number: str, -) -> State: - """Deploy configuration on the router.""" - provisioning_proxy.provision_router(subscription, process_id, callback_route, tt_number, dry_run=False) - - return {"subscription": subscription} - - @step("Create NetBox Device") def create_netbox_device(subscription: RouterProvisioning) -> State: """Create a new device in Netbox. @@ -194,8 +169,8 @@ def create_router() -> StepList: >> store_process_subscription(Target.CREATE) >> initialize_subscription >> ipam_allocate_loopback - >> pp_interaction(provision_router_dry) - >> pp_interaction(provision_router_real) + >> pp_interaction(deploy_base_config_dry) + >> pp_interaction(deploy_base_config_real) >> verify_ipam_loopback >> create_netbox_device >> set_status(SubscriptionLifecycle.ACTIVE) diff --git a/test/workflows/router/test_create_router.py b/test/workflows/router/test_create_router.py index 71929a917090d6e6655e6927f227a625dd2c4fbf..8f9129ac0a5423266a36950eb52285c267344306 100644 --- a/test/workflows/router/test_create_router.py +++ b/test/workflows/router/test_create_router.py @@ -33,7 +33,7 @@ def router_creation_input_form_data(site_subscription_factory, faker): @pytest.mark.workflow() -@patch("gso.workflows.router.create_router.provisioning_proxy.provision_router") +@patch("gso.utils.workflow_steps.execute_playbook") @patch("gso.workflows.router.create_router.NetboxClient.create_device") @patch("gso.workflows.router.create_router.infoblox.hostname_available") @patch("gso.workflows.router.create_router.infoblox.find_host_by_fqdn") @@ -100,7 +100,7 @@ def test_create_nokia_router_success( @pytest.mark.workflow() -@patch("gso.workflows.router.create_router.provisioning_proxy.provision_router") +@patch("gso.utils.workflow_steps.execute_playbook") @patch("gso.workflows.router.create_router.NetboxClient.create_device") @patch("gso.workflows.router.create_router.infoblox.hostname_available") @patch("gso.workflows.router.create_router.infoblox.find_network_by_cidr")