Skip to content

Terminate lan switch interconnect

Workflow for terminating a LAN Switch interconnect.

clean_up_ipam(subscription)

Clear up :term:IPAM resources in :term:DNS.

First, remove :term:DNS records for both the router and switch side of the interconnect. Second, remove the registered network for this interconnect.

Source code in gso/workflows/lan_switch_interconnect/terminate_lan_switch_interconnect.py
@step("Release IPAM resources")
def clean_up_ipam(subscription: LanSwitchInterconnect) -> None:
    """Clear up :term:`IPAM` resources in :term:`DNS`.

    First, remove :term:`DNS` records for both the router and switch side of the interconnect.
    Second, remove the registered network for this interconnect.
    """
    delete_host_by_fqdn(subscription.lan_switch_interconnect.switch_side.switch.fqdn)
    delete_host_by_fqdn(
        f"{subscription.lan_switch_interconnect.router_side.ae_iface}."
        f"{subscription.lan_switch_interconnect.router_side.node.router_fqdn}"
    )
    delete_network(
        generate_lan_switch_interconnect_subnet_v4(
            subscription.lan_switch_interconnect.router_side.node.router_site.site_internal_id
        )
    )

terminate_lan_switch_interconnect()

Terminate a LAN Switch Interconnect.

Source code in gso/workflows/lan_switch_interconnect/terminate_lan_switch_interconnect.py
@workflow(
    "Terminate LAN Switch Interconnect",
    initial_input_form=wrap_modify_initial_input_form(_input_form_generator),
    target=Target.TERMINATE,
)
def terminate_lan_switch_interconnect() -> StepList:
    """Terminate a LAN Switch Interconnect."""
    return (
        begin
        >> store_process_subscription(Target.TERMINATE)
        >> unsync
        >> clean_up_ipam
        >> set_status(SubscriptionLifecycle.TERMINATED)
        >> resync
        >> done
    )