Deleting virtual router interfaces

PUT /v2.0/routers/{router_id}/remove_router_interface

Delete an internal interface with the specified ID from a virtual router.

This operation deletes an internal router interface, which detaches a subnet from the router. If this subnet ID is the last subnet on the port, this operation deletes the port itself. You must specify either a subnet ID or port ID in the request body; the operation uses this value to identify which router interface to deletes.

You can also specify both a subnet ID and port ID. If you specify both IDs, the subnet ID must correspond to the subnet ID of the first IP address on the port. Otherwise, this operation returns the Conflict (409) response code with information about the affected router and interface.

If you try to delete the router interface for subnets that are used by one or more routes, this operation returns the Conflict (409) response. In this case, you first need to delete such routes from the router.

If the router or the subnet and port do not exist or are not visible to you, this operation returns the Not Found (404) response code. As a consequence of this operation, the operation removes the port connecting the router with the subnet from the subnet for the network.

Source: https://docs.openstack.org/api-ref/network/v2/index.html?expanded=remove-interface-from-router-detail#remove-interface-from-router

Request

Parameters

Name In Type Description
router_id path string The ID of the router.
subnet_id (Optional) body string The ID of the subnet. One of subnet_id or port_id must be specified.
port_id (Optional) body string The ID of the port. One of subnet_id or port_id must be specified.

Example

# curl -ks -X PUT -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '
{                                                        
    "subnet_id": "112f9b9c-7be2-41c9-8c31-903b263353e7"
}' https://<node_IP_addr>:9696/v2.0/routers/ce996632-45a2-4c6b-a951-a624eba74621/remove_router_interface

Response

Parameters

Name In Type Description
id body string The ID of the resource.
subnet_id body string The ID of the subnet which the router interface belongs to.
subnet_ids body array A list of the ID of the subnet which the router interface belongs to. The list contains only one member.
network_id body string The ID of the attached network.
port_id body string The ID of the port which represents the router interface.
project_id body string The ID of the project.
tenant_id body string The ID of the project.
tags body array The list of tags on the resource.

Status codes

Success

Code Reason
200 - OK Request was successful.

Error

Code Reason
400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

404 - Not Found

The requested resource could not be found.

409 - Conflict

This operation conflicted with another operation on this resource.

Example

{
  "network_id": "c4e2f31b-fe3b-402b-ac1b-b182693f72f7",
  "tenant_id": "f5d834d636c642c7bfe8af86139c6f26",
  "subnet_id": "112f9b9c-7be2-41c9-8c31-903b263353e7",
  "subnet_ids": [
    "112f9b9c-7be2-41c9-8c31-903b263353e7"
  ],
  "port_id": "5374d25d-edfe-40dd-ae1e-bef883d8e72d",
  "id": "ce996632-45a2-4c6b-a951-a624eba74621"
}