Reviewed-by: Sarda, Priya <prsarda@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com> Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
29 KiB
Updating a Router
Function
This API is used to update a router.
URI
PUT /v2.0/routers/{router_id}
Request Parameters
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
router |
Yes |
router object |
Specifies the router. For details, see Table 2. You must specify at least one attribute when updating a router. |
Attribute |
Mandatory |
Type |
Description |
|---|---|---|---|
name |
No |
String |
Specifies the router name. Instructions: The name can contain only letters, digits, underscores (_), hyphens (-), and periods (.). |
admin_state_up |
No |
Boolean |
Specifies the administrative status. The value can only be true. |
external_gateway_info |
No |
external_gateway_info object |
Specifies the external gateway. This is an extended attribute. For details, see the external_gateway_info objects. |
routes |
No |
Array of route objects |
Specifies a route list. This is an extended attribute. For details, see Table 4. |
Attribute |
Mandatory |
Type |
Description |
|---|---|---|---|
network_id |
No |
String |
Specifies the UUID of the external network. You can use GET /v2.0/networks?router:external=True or run the neutron net-external-list command to query information about the external network. |
enable_snat |
No |
Boolean |
Specifies whether the SNAT function is enabled. The default value is false. Before setting enable_snat to true, ensure that an interface is added to the router. For details, see Adding an Interface to a Router. Once enable_snat is set to true, a micro NAT gateway will be created. |
Attribute |
Mandatory |
Type |
Description |
|---|---|---|---|
destination |
No |
String |
Specifies the IP address range. Instructions: The prefix cannot be the same as that of a direct route. |
nexthop |
No |
String |
Specifies the next hop IP address. The IP address can only be one in the subnet associated with the router. |
Example Request
Change the name of the router whose ID is f5dbdfe0-86f9-4b0a-9a32-6be143f0a076 to router-220.
PUT https://{Endpoint}/v2.0/routers/f5dbdfe0-86f9-4b0a-9a32-6be143f0a076
{
"router": {
"name": "router-220"
}
}
Response Parameters
Parameter |
Type |
Description |
|---|---|---|
router |
router object |
Specifies the router. For details, see Table 6. |
Attribute |
Type |
Description |
|---|---|---|
id |
String |
Specifies the router ID. This parameter is not mandatory when you query routers. |
name |
String |
Specifies the router name. The name can contain only letters, digits, underscores (_), hyphens (-), and periods (.). |
admin_state_up |
Boolean |
Specifies the administrative status. The value can only be true. |
status |
String |
Specifies the router status. The value can be ACTIVE, DOWN, or ERROR. |
tenant_id |
String |
Specifies the project ID. |
external_gateway_info |
external_gateway_info object |
Specifies the external gateway. This is an extended attribute. For details, see the external_gateway_info objects. |
routes |
Array of route objects |
Specifies a route list. This is an extended attribute. For details, see Table 8. |
project_id |
String |
Specifies the project ID. |
created_at |
String |
Specifies the time (UTC) when the router is created. Format: yyyy-MM-ddTHH:mm:ss |
updated_at |
String |
Specifies the time (UTC) when the router is updated. Format: yyyy-MM-ddTHH:mm:ss |
Attribute |
Type |
Description |
|---|---|---|
network_id |
String |
Specifies the UUID of the external network. You can use GET /v2.0/networks?router:external=True or run the neutron net-external-list command to query information about the external network. |
enable_snat |
Boolean |
Specifies whether the SNAT function is enabled. The default value is false. |
Example Response
{
"router": {
"id": "f5dbdfe0-86f9-4b0a-9a32-6be143f0a076",
"name": "router-220",
"status": "ACTIVE",
"tenant_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
"project_id": "bbfe8c41dd034a07bebd592bf03b4b0c",
"admin_state_up": true,
"external_gateway_info": {
"network_id": "0a2228f2-7f8a-45f1-8e09-9039e1d09975",
"enable_snat": false
},
"routes": [],
"created_at": "2018-09-20T02:06:07",
"updated_at": "2018-09-20T02:06:09"
}
}
Status Code
See Status Codes.
Error Code
See Error Codes.