Jump to: navigation, search

Difference between revisions of "Neutron/DeviceInventory"

(talk)
 
(The page describes more general model that goes beyond LBaaS)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
= Provider API =
+
<!-- ## page was renamed from Quantum/LBaaS/RESTAPI/ProviderAPI -->
 +
<!-- ## page was renamed from Quantum/LBaaS/RESTAPI/ProviderAPI/proposal -->
 +
= Device Management =
 +
 
 +
Device Management Plugin is the central control point for appliances that offer [[Quantum/ServiceInsertion|advanced services]] in Quantum.
 +
 
 +
Plugin commands:
  
 
{| border="1" cellpadding="2" cellspacing="0"
 
{| border="1" cellpadding="2" cellspacing="0"
/v2.0/services/lbaas/devices.json
+
''Verb''
GET
+
''URI''
 
|-
 
|-
|  /v2.0/services/lbaas/devices.json
+
|  GET   
|  POST
+
|  /v2.0/devices  
 
|-
 
|-
|  /v2.0/services/lbaas/devices/{device_id}.json
+
|  POST 
GET
+
|  /v2.0/devices
 +
|-
 +
|  GET   
 +
/v2.0/devices/{device_id}  
 +
|-
 +
|  UPDATE
 +
/v2.0/devices/{device_id}
 
|-
 
|-
|  /v2.0/services/lbaas/devices/{device_id}.json
 
 
|  DELETE  
 
|  DELETE  
 +
|  /v2.0/devices/{device_id}
 
|}
 
|}
 +
 +
== Device Model ==
  
 
{| border="1" cellpadding="2" cellspacing="0"
 
{| border="1" cellpadding="2" cellspacing="0"
/v2.0/services/lbaas/algorithms.json
+
''Attribute''
GET
+
''Type''
 +
|  ''CRUD''
 +
|  ''Required''
 +
|  ''Default Value''
 +
|-
 +
|  id
 +
|  uuid
 +
|  CR
 +
|  y
 +
|  generated
 +
|-
 +
|  name
 +
|  string
 +
|  CRU
 +
|  n
 +
|  none
 +
|-
 +
|  service_type
 +
|  string
 +
|  CR
 +
|  y
 +
|  none
 +
|-
 +
|  management
 +
|  object
 +
|  CRU
 +
|  n
 +
|  none
 +
|-
 +
|  shared
 +
|  boolean
 +
|  CR
 +
|  n
 +
|  true
 
|-
 
|-
/v2.0/services/lbaas/protocols.json
+
tenant_id
GET
+
uuid
 +
|  CR
 +
|  n
 +
|  none
 +
|-
 +
|  capabilities
 +
|  object
 +
|  R
 +
|  n
 +
|  none
 
|}
 
|}
 +
 +
'''Example'''
 +
 +
<pre><nowiki>
 +
{
 +
    "id": "f2bf34e028b64ce593aa8bab56259cad",
 +
    "name": "HAP-001",
 +
    "service_type": "virtual_load_balancing",
 +
    "shared": "true",
 +
    "management": {
 +
        "address": "10.0.0.6",
 +
        "port": 22,
 +
        "user": "user",
 +
        "password": "swordfish"
 +
    }
 +
}
 +
</nowiki></pre>
 +
  
 
== List devices ==
 
== List devices ==
Line 45: Line 119:
  
 
<pre><nowiki>
 
<pre><nowiki>
GET /v2.0/services/lbaas/devices.json
+
GET /v2.0/devices
 
Accept: application/json
 
Accept: application/json
 
</nowiki></pre>
 
</nowiki></pre>
Line 58: Line 132:
 
             "id": "f2bf34e028b64ce593aa8bab56259cad",
 
             "id": "f2bf34e028b64ce593aa8bab56259cad",
 
             "name": "HAP-001",
 
             "name": "HAP-001",
             "type": "HAPROXY",
+
             "type": "virtual_load_balancing",
             "version": "1.0",
+
             "shared": "true",
             "is_public": "true",
+
             "management": {
            "mgmt_ip": "10.0.0.6",
+
                "address": "10.0.0.6",
            "mgmt_port": 22,
+
                "port": 22,
            "mgmt_user": "user",
+
                "user": "user",
             "mgmt_password": "swordfish"
+
                "password": "swordfish"
 +
            },
 +
             "capabilities": {
 +
                "lb_methods": [
 +
                    "STATIC_RR",
 +
                    "ROUND_ROBIN",
 +
                ],
 +
                "protocols": [
 +
                    "TCP",
 +
                    "HTTP"
 +
                ],
 +
                "healthMonitors": [
 +
                    "ICMP",
 +
                    "HTTP_GET",
 +
                ],
 +
                "sessionPersistences": [
 +
                    "COOKIE",
 +
                    "SRC_ADDR"
 +
                ]
 +
            }
 
         }
 
         }
 
     ]
 
     ]
Line 78: Line 171:
 
|-
 
|-
 
|  GET   
 
|  GET   
|  /vip/{vip_id}  
+
|  /devices/{device_id}  
 
|}
 
|}
  
Line 92: Line 185:
  
 
<pre><nowiki>
 
<pre><nowiki>
GET /v2.0/services/lbaas/devices/{afc75773-640e-403c-9fff-62ba98db1f19}.json
+
GET /v2.0/devices/{afc75773-640e-403c-9fff-62ba98db1f19}
 
Accept: application/json
 
Accept: application/json
 
</nowiki></pre>
 
</nowiki></pre>
Line 104: Line 197:
 
         "id": "f2bf34e028b64ce593aa8bab56259cad",
 
         "id": "f2bf34e028b64ce593aa8bab56259cad",
 
         "name": "HAP-001",
 
         "name": "HAP-001",
         "type": "HAPROXY",
+
         "type": "virtual_load_balancing",
         "version": "1.0",
+
         "shared": "true",
         "is_public": "true",
+
         "management": {
        "mgmt_ip": "10.0.0.6",
+
            "address": "10.0.0.6",
        "mgmt_port": 22,
+
            "port": 22,
        "mgmt_user": "user",
+
            "user": "user",
        "mgmt_password": "swordfish",
+
            "password": "swordfish"
 +
        },
 
         "capabilities": {
 
         "capabilities": {
             "algorithms": [
+
             "lb_methods": [
 
                 "STATIC_RR",
 
                 "STATIC_RR",
 
                 "ROUND_ROBIN",
 
                 "ROUND_ROBIN",
Line 134: Line 228:
 
         }
 
         }
 
     }
 
     }
 +
}
 
</nowiki></pre>
 
</nowiki></pre>
}
+
 
  
 
== Create Device ==
 
== Create Device ==
Line 158: Line 253:
  
 
<pre><nowiki>
 
<pre><nowiki>
POST /v2.0/services/lbaas/devices.json
+
POST /v2.0/devices
 
Content-Type: application/json
 
Content-Type: application/json
 
Accept: application/json
 
Accept: application/json
Line 169: Line 264:
 
     "device": {
 
     "device": {
 
         "name": "HAP-001",
 
         "name": "HAP-001",
         "type": "HAPROXY",
+
         "type": "virtual_load_balancing",
         "version": "1.0",
+
         "shared": "false",  
         "is_public": "false",  
+
         "tenant_id": "f2bf34e028b64ce593aa8bab56259cad",
         "mgmt_ip": "10.0.0.6",
+
         "management": {
        "mgmt_port": 22,
+
            "address": "10.0.0.6",
        "mgmt_user": "user",
+
            "port": 22,
        "mgmt_password": "swordfish"
+
            "user": "user",
 +
            "password": "swordfish"
 +
        }
 
     }
 
     }
 
}
 
}
Line 188: Line 285:
 
         "id": "f2bf34e028b64ce593aa8bab56259cad",
 
         "id": "f2bf34e028b64ce593aa8bab56259cad",
 
         "name": "HAP-001",
 
         "name": "HAP-001",
         "type": "HAPROXY",
+
         "type": "virtual_load_balancing",
        "version": "1.0",
 
 
         "is_public": "true",  
 
         "is_public": "true",  
         "mgmt_ip": "10.0.0.6",
+
         "management": {
        "mgmt_port": 22,
+
            "address": "10.0.0.6",
         "mgmt_user": "user",
+
            "port": 22,
         "mgmt_password": "swordfish"
+
            "user": "user",
 +
            "password": "swordfish"
 +
         }
 +
    }
 +
}
 +
</nowiki></pre>
 +
 
 +
 
 +
== Update Device ==
 +
 
 +
{| border="1" cellpadding="2" cellspacing="0"
 +
|  Verb
 +
|  URI
 +
|-
 +
|  PUT 
 +
|  /devices/{device_id}
 +
|}
 +
 
 +
Normal Response Code: 200
 +
 
 +
Error Response Codes: Bad Request (400) Unauthorized (401), Forbidden (403) Not Found (404)
 +
 
 +
This operation requires a request body. You can set the following attributes in the request body:
 +
{| border="1" cellpadding="2" cellspacing="0"
 +
|  Attribute
 +
|-
 +
|  name
 +
|-
 +
|  management
 +
|}
 +
If update of any other attributes is asked, a 400 Bad Request error is returned.
 +
Note: like in Quantum, update operations adopt patch semantics. This implies that user is not required to send the whole resource to be updated, but just the attributes that the user wishes to update, as shown in the following example.
 +
 
 +
This operation returns a response body.
 +
 
 +
'''JSON Request:'''
 +
 
 +
<pre><nowiki>
 +
PUT /v2.0/devices/fc68ea2c-b60b-4b4f-bd82-94ec81110766
 +
Content-Type: application/json
 +
Accept: application/json
 +
</nowiki></pre>
 +
 
 +
 
 +
 
 +
<pre><nowiki>
 +
{
 +
    "device": {
 +
        "name": "HAP-001-new",
 +
    }
 +
}
 +
</nowiki></pre>
 +
 
 +
 
 +
'''JSON Response:'''
 +
 
 +
<pre><nowiki>
 +
status: 200
 +
content-length: 192
 +
content-type: application/json
 +
 
 +
{
 +
    "device": {
 +
        "id": "f2bf34e028b64ce593aa8bab56259cad",
 +
        "name": "HAP-001-new",
 +
        "type": "virtual_load_balancing",
 +
        "is_public": "true",  
 +
         "management": {
 +
            "address": "10.0.0.6",
 +
            "port": 22,
 +
            "user": "user",
 +
            "password": "swordfish"
 +
        }
 
     }
 
     }
 
}
 
}
Line 207: Line 375:
 
|-
 
|-
 
|  DELETE   
 
|  DELETE   
|  /device/{device_id}  
+
|  /devices/{device_id}  
 
|}
 
|}
  
Line 221: Line 389:
  
 
<pre><nowiki>
 
<pre><nowiki>
DELETE /v2.0/services/lbaas/devices/{afc75773-640e-403c-9fff-62ba98db1f19}.json
+
DELETE /v2.0/devices/{afc75773-640e-403c-9fff-62ba98db1f19}
 
Accept: application/json
 
Accept: application/json
 
</nowiki></pre>
 
</nowiki></pre>

Revision as of 13:44, 11 December 2012

Device Management

Device Management Plugin is the central control point for appliances that offer advanced services in Quantum.

Plugin commands:

Verb URI
GET /v2.0/devices
POST /v2.0/devices
GET /v2.0/devices/{device_id}
UPDATE /v2.0/devices/{device_id}
DELETE /v2.0/devices/{device_id}

Device Model

Attribute Type CRUD Required Default Value
id uuid CR y generated
name string CRU n none
service_type string CR y none
management object CRU n none
shared boolean CR n true
tenant_id uuid CR n none
capabilities object R n none

Example

{
    "id": "f2bf34e028b64ce593aa8bab56259cad",
    "name": "HAP-001",
    "service_type": "virtual_load_balancing",
    "shared": "true",
    "management": {
        "address": "10.0.0.6",
        "port": 22,
        "user": "user",
        "password": "swordfish"
    }
}


List devices

Verb URI
GET /devices

Normal Response Code: 200

Error Response Codes: Unauthorized (401)

This operation does not require a request body, unless the Quantum server is running without Keystone integration.

This operation returns a response body.

JSON Request:

GET /v2.0/devices
Accept: application/json


JSON Response:

{
    "devices": [
        {
            "id": "f2bf34e028b64ce593aa8bab56259cad",
            "name": "HAP-001",
            "type": "virtual_load_balancing",
            "shared": "true",
            "management": {
                "address": "10.0.0.6",
                "port": 22,
                "user": "user",
                "password": "swordfish"
            },
            "capabilities": {
                "lb_methods": [
                    "STATIC_RR",
                    "ROUND_ROBIN",
                ],
                "protocols": [
                    "TCP",
                    "HTTP"
                ],
                "healthMonitors": [
                    "ICMP",
                    "HTTP_GET",
                ],
                "sessionPersistences": [
                    "COOKIE",
                    "SRC_ADDR"
                ]
            }
        }
    ]
}


Show device

Verb URI
GET /devices/{device_id}

Normal Response Code: 200

Error Response Codes: Unauthorized (401), Not Found (404)

This operation does not require a request body, unless the Quantum server is running without Keystone integration.

This operation returns a response body.

JSON Request:

GET /v2.0/devices/{afc75773-640e-403c-9fff-62ba98db1f19}
Accept: application/json


JSON Response:

{
    "device": {
        "id": "f2bf34e028b64ce593aa8bab56259cad",
        "name": "HAP-001",
        "type": "virtual_load_balancing",
        "shared": "true",
        "management": {
            "address": "10.0.0.6",
            "port": 22,
            "user": "user",
            "password": "swordfish"
        },
        "capabilities": {
            "lb_methods": [
                "STATIC_RR",
                "ROUND_ROBIN",
                "HASH_SOURCE",
                "LEAST_CONNECTION",
                "HASH_URI"
            ],
            "protocols": [
                "TCP",
                "HTTP"
            ],
            "healthMonitors": [
                "ICMP",
                "HTTP_GET",
                "HTTP_HEAD"
            ],
            "sessionPersistences": [
                "COOKIE",
                "SRC_ADDR"
            ]
        }
    }
}


Create Device

Verb URI
POST /devices

Normal Response Code: 201

Error Response Codes: Bad Request (400) Unauthorized (401)

This operation requires a request body. The request body must contain a network object that specifies a symbolic name for the network.

This operation returns a response body.

JSON Request:

POST /v2.0/devices
Content-Type: application/json
Accept: application/json


{
    "device": {
        "name": "HAP-001",
        "type": "virtual_load_balancing",
        "shared": "false", 
        "tenant_id": "f2bf34e028b64ce593aa8bab56259cad",
        "management": {
            "address": "10.0.0.6",
            "port": 22,
            "user": "user",
            "password": "swordfish"
        }
    }
}


JSON Response:

{
    "device": {
        "id": "f2bf34e028b64ce593aa8bab56259cad",
        "name": "HAP-001",
        "type": "virtual_load_balancing",
        "is_public": "true", 
        "management": {
            "address": "10.0.0.6",
            "port": 22,
            "user": "user",
            "password": "swordfish"
        }
    }
}


Update Device

Verb URI
PUT /devices/{device_id}

Normal Response Code: 200

Error Response Codes: Bad Request (400) Unauthorized (401), Forbidden (403) Not Found (404)

This operation requires a request body. You can set the following attributes in the request body:

Attribute
name
management

If update of any other attributes is asked, a 400 Bad Request error is returned. Note: like in Quantum, update operations adopt patch semantics. This implies that user is not required to send the whole resource to be updated, but just the attributes that the user wishes to update, as shown in the following example.

This operation returns a response body.

JSON Request:

PUT /v2.0/devices/fc68ea2c-b60b-4b4f-bd82-94ec81110766
Content-Type: application/json
Accept: application/json


{
    "device": {
        "name": "HAP-001-new",
    }
}


JSON Response:

status: 200
content-length: 192
content-type: application/json

{
    "device": {
        "id": "f2bf34e028b64ce593aa8bab56259cad",
        "name": "HAP-001-new",
        "type": "virtual_load_balancing",
        "is_public": "true", 
        "management": {
            "address": "10.0.0.6",
            "port": 22,
            "user": "user",
            "password": "swordfish"
        }
    }
}


Delete Device

Verb URI
DELETE /devices/{device_id}

Normal Response Code: 204

Error Response Codes: Unauthorized (401), Not Found (404)

This operation does not require a request body.

This operation does not return a response body.

JSON Request:

DELETE /v2.0/devices/{afc75773-640e-403c-9fff-62ba98db1f19}
Accept: application/json


JSON Response:

status: 204