• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Neutron
  5. Router
  6. Adding an Interface to a Router

Adding an Interface to a Router

Function

This interface is used to add an interface to a router.

Restrictions

  • When a port is used, the port can have only one IP address.
  • When a subnet is used, the gateway IP address must be configured for the subnet.
  • A router cannot be added to networks whose provider:network_type is geneve.
  • Only one router can be added to a subnet.

URI

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

Request Message

Table 1 Request parameter

Parameter

Type

Mandatory

Description

subnet_id

uuid-str

No

Specifies the subnet ID. Either subnet_id or port_id is used.

Use the gateway IP address of the subnet to create a router interface.

port_id

uuid-str

No

Specifies the port ID. Either subnet_id or port_id is used. Use the port IP address to create a router interface.

Response Message

Table 2 Response parameter

Parameter

Type

Description

subnet_id

uuid-str

Specifies the subnet ID.

tenant_id

uuid-str

Specifies the project ID.

port_id

uuid-str

Specifies the port ID.

id

uuid-str

Specifies the router ID.

Example:

Example request

PUT /v2.0/routers/5b8e885c-1347-4ac2-baf9-2249c8ed1270/add_router_interface
{"subnet_id": "ab78be2d-782f-42a5-aa72-35879f6890ff"}

Example response

{
  "subnet_id": "ab78be2d-782f-42a5-aa72-35879f6890ff",
  "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
  "port_id": "40e86635-b2a3-45de-a7c8-3cced5b7e755",
  "id": "5b8e885c-1347-4ac2-baf9-2249c8ed1270"
}

Status Codes

For details, see section Status Codes.