Skip to content

Create r and e peer

Create R&E Peer subscription workflow.

initial_input_form_generator(product_name)

Initial input form generator for creating a new R&E Peer subscription.

Source code in gso/workflows/l3_core_service/r_and_e_peer/create_r_and_e_peer.py
def initial_input_form_generator(product_name: str) -> FormGenerator:
    """Initial input form generator for creating a new R&E Peer subscription."""
    initial_generator = base_initial_input_form_generator(product_name)
    initial_user_input = yield from initial_generator

    # Additional R&E Peer step
    class RAndEPeerExtraForm(FormPage):
        v4_bgp_local_preference: NonNegativeInt = 100
        v4_bgp_med: MultiExitDiscriminator = "igp"
        v6_bgp_local_preference: NonNegativeInt = 100
        v6_bgp_med: MultiExitDiscriminator = "igp"

    r_and_e_peer_extra_form = yield RAndEPeerExtraForm
    return initial_user_input | r_and_e_peer_extra_form.model_dump()

create_subscription(product, partner)

Create a new subscription object in the database.

Source code in gso/workflows/l3_core_service/r_and_e_peer/create_r_and_e_peer.py
@step("Create subscription")
def create_subscription(product: UUIDstr, partner: str) -> State:
    """Create a new subscription object in the database."""
    subscription = RAndEPeerInactive.from_product_id(product, partner)

    return {_MONITORED_OBJECTS_KEY: subscription, "subscription_id": subscription.subscription_id}

create_r_and_e_peer()

Create a new R&E Peer subscription.

Source code in gso/workflows/l3_core_service/r_and_e_peer/create_r_and_e_peer.py
@create_workflow("Create R&E Peer", initial_input_form=initial_input_form_generator)
def create_r_and_e_peer() -> StepList:
    """Create a new R&E Peer subscription."""
    return (
        begin
        >> create_subscription
        >> store_process_subscription()
        >> initialize_subscription
        >> update_r_and_e_peer_subscription_model
        >> start_moodi(monitored_objects_key=_MONITORED_OBJECTS_KEY)
        >> lso_interaction(provision_sbp_dry)
        >> lso_interaction(provision_sbp_real)
        >> lso_interaction(check_sbp_functionality)
        >> lso_interaction(deploy_bgp_peers_dry)
        >> lso_interaction(deploy_bgp_peers_real)
        >> lso_interaction(check_bgp_peers)
        >> update_dns_records
        >> create_new_sharepoint_checklist
        >> prompt_sharepoint_checklist_url
        >> stop_moodi()
    )