Skip to content
Snippets Groups Projects
Verified Commit 83a56040 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

move create router workflow to new provisioning proxy endpoint

parent 03843a6b
No related branches found
No related tags found
1 merge request!131Move provisioning proxy steps to the new LSO endpoint
...@@ -20,11 +20,12 @@ from gso.products.product_blocks.router import ( ...@@ -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.router import RouterInactive, RouterProvisioning
from gso.products.product_types.site import Site 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.crm import customer_selector
from gso.services.netbox_client import NetboxClient from gso.services.netbox_client import NetboxClient
from gso.services.provisioning_proxy import pp_interaction from gso.services.provisioning_proxy import pp_interaction
from gso.utils.helpers import iso_from_ipv4 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: def _site_selector() -> Choice:
...@@ -123,32 +124,6 @@ def ipam_allocate_loopback(subscription: RouterProvisioning) -> State: ...@@ -123,32 +124,6 @@ def ipam_allocate_loopback(subscription: RouterProvisioning) -> State:
return {"subscription": subscription} 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") @step("Create NetBox Device")
def create_netbox_device(subscription: RouterProvisioning) -> State: def create_netbox_device(subscription: RouterProvisioning) -> State:
"""Create a new device in Netbox. """Create a new device in Netbox.
...@@ -194,8 +169,8 @@ def create_router() -> StepList: ...@@ -194,8 +169,8 @@ def create_router() -> StepList:
>> store_process_subscription(Target.CREATE) >> store_process_subscription(Target.CREATE)
>> initialize_subscription >> initialize_subscription
>> ipam_allocate_loopback >> ipam_allocate_loopback
>> pp_interaction(provision_router_dry) >> pp_interaction(deploy_base_config_dry)
>> pp_interaction(provision_router_real) >> pp_interaction(deploy_base_config_real)
>> verify_ipam_loopback >> verify_ipam_loopback
>> create_netbox_device >> create_netbox_device
>> set_status(SubscriptionLifecycle.ACTIVE) >> set_status(SubscriptionLifecycle.ACTIVE)
......
...@@ -33,7 +33,7 @@ def router_creation_input_form_data(site_subscription_factory, faker): ...@@ -33,7 +33,7 @@ def router_creation_input_form_data(site_subscription_factory, faker):
@pytest.mark.workflow() @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.NetboxClient.create_device")
@patch("gso.workflows.router.create_router.infoblox.hostname_available") @patch("gso.workflows.router.create_router.infoblox.hostname_available")
@patch("gso.workflows.router.create_router.infoblox.find_host_by_fqdn") @patch("gso.workflows.router.create_router.infoblox.find_host_by_fqdn")
...@@ -100,7 +100,7 @@ def test_create_nokia_router_success( ...@@ -100,7 +100,7 @@ def test_create_nokia_router_success(
@pytest.mark.workflow() @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.NetboxClient.create_device")
@patch("gso.workflows.router.create_router.infoblox.hostname_available") @patch("gso.workflows.router.create_router.infoblox.hostname_available")
@patch("gso.workflows.router.create_router.infoblox.find_network_by_cidr") @patch("gso.workflows.router.create_router.infoblox.find_network_by_cidr")
......
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