Network ResourcesDistributed Port Group Related Interfaces

Add Host Route to L3 Network

POST/zstack/v1/l3-networks/{l3NetworkUuid}/hostroute

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "prefix": "169.254.169.254/32",
    "nexthop": "192.168.1.254"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"prefix":"169.254.169.254/32","nexthop":"192.168.1.254"}}' \
http://localhost:8080/zstack/v1/l3-networks/45d86c07f10437c6bf3161bae9974bb7/hostroute

Request Parameters

NameTypeLocationDescriptionAllowed ValuesStarting Version
l3NetworkUuidStringurlThe Distributed Port Group UUID. 2.3
prefixStringbody(contained in the params structure)  2.3
nexthopStringbody(contained in the params structure)  2.3
systemTags (Optional)Listbody  2.3
userTags (Optional)Listbody  2.3

API Response

Sample Response

{
  "inventory": {
    "name": "Test-L3Network",
    "l2NetworkUuid": "7dfdf976ef1334fba5c3b475104011b2",
    "dns": [
      "8.8.8.8"
    ],
    "hostRoute": [
      {
        "prefix": "169.254.169.254/32",
        "nexthop": "192.168.1.254"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation fails, or vice versa. For more information, see error2.3
inventoryL3NetworkInventorySee inventory2.3

error

NameTypeDescriptionStarting Version
codeStringThe error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.10010.6
descriptionStringThe brief description of the error.0.6
detailsStringThe details about the error.0.6
elaborationStringThe reserved field. Default value: null0.6
opaqueLinkedHashMapThe reserved field. Default value: null0.6
causeErrorCodeThe root error, which is the associated root cause of the current error. If no root error exists, this parameter is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringThe resource UUID, which uniquely identifies the resource.0.6
nameStringThe resource name.0.6
descriptionStringThe detailed description of the resource.0.6
typeString 0.6
zoneUuidStringThe Data Center UUID.0.6
l2NetworkUuidStringThe port group Distributed Switch UUID.0.6
stateString 0.6
dnsDomainString 0.6
systemBoolean 0.6
categoryString 0.6
ipVersionIntegerThe IP protocol number.3.1.0
enableIPAMBooleanEnables IP address management.4.10.16
createDateTimestampThe creation date.0.6
lastOpDateTimestampThe last operation date.0.6
dnsList 0.6
ipRangesListSee ipRanges0.6
networkServicesListSee networkServices0.6
hostRouteListSee hostRoute2.3
reservedIpRangesListSee reservedIpRanges4.10.16

ipRanges

NameTypeDescriptionStarting Version
uuidStringThe resource UUID, which uniquely identifies the resource.0.6
l3NetworkUuidStringThe Distributed Port Group UUID.0.6
nameStringThe resource name.0.6
descriptionStringThe detailed description of the resource.0.6
startIpString 0.6
endIpString 0.6
netmaskString 0.6
prefixLenStringThe prefix length.3.1.0
gatewayString 0.6
networkCidrString 0.6
ipVersionIntegerThe IP protocol number.3.1.0
addressModeStringThe IPv6 address allocation mode.3.1.0
createDateTimestampThe creation date.0.6
lastOpDateTimestampThe last operation date.0.6

networkServices

NameTypeDescriptionStarting Version
l3NetworkUuidStringThe Distributed Port Group UUID.0.6
networkServiceProviderUuidStringThe network service provider UUID.0.6
networkServiceTypeString 0.6

hostRoute

NameTypeDescriptionStarting Version
idLong 2.3
l3NetworkUuidStringThe Distributed Port Group UUID.2.3
prefixString 2.3
nexthopString 2.3
createDateTimestampThe creation date.2.3
lastOpDateTimestampThe last operation date.2.3

reservedIpRanges

NameTypeDescriptionStarting Version
uuidStringThe resource UUID, which uniquely identifies the resource.4.10.16
l3NetworkUuidStringThe Distributed Port Group UUID.4.10.16
nameStringThe resource name.4.10.16
descriptionStringThe detailed description of the resource.4.10.16
startIpStringThe start IP address (included in the reserved address range).4.10.16
endIpStringThe end IP address (included in the reserved address range).4.10.16
ipVersionIntegerThe IP protocol number.4.10.16
createDateTimestampThe creation date.4.10.16
lastOpDateTimestampThe last operation date.4.10.16

SDK Sample

Java SDK

AddHostRouteToL3NetworkAction action = new AddHostRouteToL3NetworkAction();
action.l3NetworkUuid = "45d86c07f10437c6bf3161bae9974bb7";
action.prefix = "169.254.169.254/32";
action.nexthop = "192.168.1.254";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddHostRouteToL3NetworkAction.Result res = action.call();

Python SDK

action = AddHostRouteToL3NetworkAction()
action.l3NetworkUuid = "45d86c07f10437c6bf3161bae9974bb7"
action.prefix = "169.254.169.254/32"
action.nexthop = "192.168.1.254"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()