Skip to content

Create imported geant ip

A creation workflow for adding an existing Imported GÉANT IP to the service database.

create_subscription(partner)

Create a new subscription object in the database.

Source code in gso/workflows/l3_core_service/geant_ip/create_imported_geant_ip.py
@step("Create subscription")
def create_subscription(partner: str) -> dict:
    """Create a new subscription object in the database."""
    partner_id = get_partner_by_name(partner).partner_id
    product_id = get_product_id_by_name(ProductName.IMPORTED_GEANT_IP)
    subscription = ImportedGeantIPInactive.from_product_id(product_id, partner_id)
    return {"subscription": subscription, "subscription_id": subscription.subscription_id}

create_imported_geant_ip()

Import a GÉANT IP without provisioning it.

Source code in gso/workflows/l3_core_service/geant_ip/create_imported_geant_ip.py
@workflow(
    "Create Imported GÉANT IP",
    initial_input_form=initial_input_form_generator,
    target=Target.CREATE,
)
def create_imported_geant_ip() -> StepList:
    """Import a GÉANT IP without provisioning it."""
    return (
        begin
        >> create_subscription
        >> store_process_subscription()
        >> initialize_subscription
        >> set_status(SubscriptionLifecycle.ACTIVE)
        >> resync
        >> done
    )