
# 路由器添加接口
#### 功能介绍
添加路由器接口。
接口约束：
- 使用端口的时候，端口上有且只有一个IP地址。
- 使用子网的时候，子网上必须配置gatewayIP地址。
- "provider:network_type"为"geneve"的网络不可以添加路由器。
- 一个子网只能添加一个路由器。
 
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=VPC&version=v2&api=NeutronAddRouterInterface)中调试该接口。
#### URI
PUT /v2.0/routers/{router_id}/add_router_interface
#### 请求参数
表1请求参数 
| 参数名称      | 类型     | 必选 | 说明                                                                                               |
|:---|:---|:---|:---|
| subnet_id | String | 否  | 子网ID，和port_id二选一。 使用子网的gateway IP地址来创建路由器接口 |
| port_id   | String | 否  | 端口ID， 和subnet_id二选一，使用端口的IP地址创建路由器接口                                                             |
   
#### 请求示例
路由器添加接口，路由器id为5b8e885c-1347-4ac2-baf9-2249c8ed1270，子网id为ab78be2d-782f-42a5-aa72-35879f6890ff。
```
PUT https://{Endpoint}/v2.0/routers/5b8e885c-1347-4ac2-baf9-2249c8ed1270/add_router_interface
{"subnet_id": "ab78be2d-782f-42a5-aa72-35879f6890ff"}
```
#### 响应参数
表2响应参数 
| 参数名称       | 类型     | 说明    |
|:---|:---|:---|
| subnet_id  | String | 子网ID  |
| tenant_id  | String | 项目ID  |
| project_id | String | 项目ID  |
| port_id    | String | 端口ID  |
| id         | String | 路由器ID |
   
#### 响应示例
```
{
  "subnet_id": "ab78be2d-782f-42a5-aa72-35879f6890ff",
  "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
  "project_id": "6fbe9263116a4b68818cf1edce16bc4f",
  "port_id": "40e86635-b2a3-45de-a7c8-3cced5b7e755",
  "id": "5b8e885c-1347-4ac2-baf9-2249c8ed1270"
}
```
#### 状态码
请参见[状态码](https://support.huaweicloud.com/api-vpc/vpc_api_0002.html)。
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-vpc/vpc_api_0003.html)。
