Documentation for Instance's interfaces REST api

Change-Id: I36c1b311e3feb5a9eb3176592e308865f55d0e2b
This commit is contained in:
rajarammallya 2012-01-24 20:12:13 +05:30
parent 4d790361ea
commit 39bca997f1
1 changed files with 158 additions and 0 deletions

View File

@ -1063,6 +1063,164 @@ Normal Response code: 200
Error - 404 Not Found [When interface is not found]
Instance Interfaces
===========================
Create all interfaces for an instance and allocate ips for the interfaces
-------------------------------------------------------------------------
====== ========================================================================================= =================================================================
Verb URI Description
====== ========================================================================================= =================================================================
PUT /ipam/tenants/{tenant_id}/instances/{instance_id}/interfaces/ Create interfaces, allocate macs and ips on all networks provided
====== ========================================================================================= =================================================================
**Params:**
'tenant_id' : The 'lessee' tenant for whom the interface is being created.
'instance_id' : Can be a uuid, any string accepted. Is an id pointing to the instance(or any other device) on which the ip will be used.
'mac_address' : Optional, can be provided if Melange is not in charge of generating mac addresses
'network' : all network and ip related details Eg: 'network': { 'id': "net1", 'addresses': ['10.0.0.2'], 'tenant': 'the_network_tenant'}
**Response Codes:**
Normal Response code: 200
Error - 422 Unprocessable Entity [If ip address cannot be allocated from Network]
Error - 404 Not Found [When network for a given network_id and tenant_id is not found]
Error - 409 Conflict [If the given address is already allocated]
Error - 400 Bad Request [When required parameters are not present or field validation fails]
**JSON Response Example:**
::
{
"instance":
{
"interfaces" : [
{
"created_at": "2011-12-01T13:18:37",
"device_id": "instance",
"id": "virt_iface",
"ip_addresses": [
{
"address": "10.0.0.2",
"id": "7615ca4a-787d-46b0-8a8c-3a90e3e6cf2c",
"interface_id": "virt_iface",
"ip_block": {
"broadcast": "10.0.0.255",
"cidr": "10.0.0.0/24",
"dns1": "8.8.8.8",
"dns2": "8.8.4.4",
"gateway": "10.0.0.1",
"id": "9c4c3dfd-c707-45bd-8626-9c369b1b9460",
"ip_routes": [],
"netmask": "255.255.255.0"
},
"version": 4
}
],
"mac_address": null,
"tenant_id": "tnt_id",
"updated_at": "2011-12-01T13:18:37"
},
{
"created_at": "2011-12-01T13:18:37",
...
}
]
}
}
Get details of all interfaces on the instance
---------------------------------------------
====== ======================================================================================== ===========================================================================
Verb URI Description
====== ======================================================================================== ===========================================================================
GET /ipam/tenants/{tenant_id}/instances/{instance_id}/interfaces/ Get all interface details of an instance along with all ips allocated on it
====== ======================================================================================== ===========================================================================
**Params:**
None
**Response Codes:**
Normal Response code: 200
Error - 404 Not Found [When interface is not found]
**JSON Response Example:**
::
{
"instance":
{
"interfaces" : [
{
"created_at": "2011-12-01T13:18:37",
"device_id": "instance",
"id": "virt_iface",
"ip_addresses": [
{
"address": "10.0.0.2",
"id": "7615ca4a-787d-46b0-8a8c-3a90e3e6cf2c",
"interface_id": "virt_iface",
"ip_block": {
"broadcast": "10.0.0.255",
"cidr": "10.0.0.0/24",
"dns1": "8.8.8.8",
"dns2": "8.8.4.4",
"gateway": "10.0.0.1",
"id": "9c4c3dfd-c707-45bd-8626-9c369b1b9460",
"ip_routes": [],
"netmask": "255.255.255.0"
},
"version": 4
}
],
"mac_address": null,
"tenant_id": "tnt_id",
"updated_at": "2011-12-01T13:18:37"
},
{
"created_at": "2011-12-01T13:18:37",
...
}
]
}
}
Delete all interfaces of the instance
-------------------------------------
====== ======================================================================================== =================================================================
Verb URI Description
====== ======================================================================================== =================================================================
DELETE /ipam/tenants/{tenant_id}/networks/{network_id}/interfaces/{vif_id} delete all instance interfaces along with all ips allocated on it
====== ======================================================================================== =================================================================
**Params:**
None
**Response Codes:**
Normal Response code: 200
Error - 404 Not Found [When interface is not found]
IP allocations in a Network
===========================