Detaching a virtual router from a subnet

This section explains how to detach a virtual router from a subnet.

Detachment of a subnet is basically the procedure for creating a subnet done in reverse.

  1. Set the environment variables below as follows:
    $ TMP_ROUTER_ID=<virtualRouterIdToBeDetached>
    $ TMP_SUBNET_ID=<subnetIdAttachedTo>
  2. Execute the following API:
    $ curl -Ss $NETWORK/v2.0/routers/$TMP_ROUTER_ID/remove_router_interface \
    -X PUT -H "X-Auth-Token: $OS_AUTH_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"subnet_id": "'$TMP_SUBNET_ID'"  }' | jq .
    {
      "subnet_id": "<subnetIdTargetedForDetachment>",
      "tenant_id": "<projId>",
      "port_id": "<connectedPortId>",
      "id": "<virtualRouterIdTargetedForDetachment>",
      "availability_zone": "<availabilityZone>"
    }