Difference between revisions of "Neutron/LBaaS/Architecture/Scheduler"
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | + | = Overview = | |
Scheduler is a separate Quantum plugin. It is responsible for: | Scheduler is a separate Quantum plugin. It is responsible for: | ||
Line 7: | Line 7: | ||
* Deployment of configs to devices with help of agents/drivers | * Deployment of configs to devices with help of agents/drivers | ||
− | + | = Workflow = | |
'''Example 1'''. The typical workflow for vip creation: | '''Example 1'''. The typical workflow for vip creation: | ||
− | {{http://goo.gl/ | + | {{http://goo.gl/08YPF}} |
Details: | Details: | ||
− | * The request to create vip is | + | * The request to create vip is is received by LBaaS Plugin |
* LBaaS Plugin calls DB plugin to create model and store it to DB, vip_id is returned | * LBaaS Plugin calls DB plugin to create model and store it to DB, vip_id is returned | ||
− | * LBaaS Plugin responds to API | + | * LBaaS Plugin responds to API with "HTTP 202 Accepted". The rest of process is done asynchronously |
− | * LBaaS Plugin calls | + | * LBaaS Plugin calls Scheduler and passes it service_type, vip_id, and other parameters. |
− | * Scheduler | + | * Scheduler finds device that satisfies service_type and other filter parameters. |
− | * Scheduler stores mapping between device_id and vip_id in its DB. This mapping will be used | + | * Scheduler stores mapping between device_id and vip_id in its DB. This mapping will be used in latter requests |
− | * | + | * Scheduler sends message to Agent |
− | * | + | * Agent reads message and forwards it to driver |
− | * | + | * Agent returns result to Scheduler, then it is forwarded to LBaaS Plugin. |
− | + | Agent is common for all services. It delegates processing to drivers[service_type][device_type][version]. | |
− | |||
− | |||
− | |||
− | [[ | ||
− | LBaaS | + | = Scheduler API = |
+ | |||
+ | Scheduler operates devices, where device is an entity of specified service type with management interface parameters. | ||
+ | |||
+ | Note: this section is based on [[Quantum/LBaaS/RESTAPI/ProviderAPI]] | ||
+ | |||
+ | == Verbs == | ||
+ | |||
+ | {| border="1" cellpadding="2" cellspacing="0" | ||
+ | | ''Verb'' | ||
+ | | ''URI'' | ||
+ | |- | ||
+ | | GET | ||
+ | | /scheduler/devices.json | ||
+ | |- | ||
+ | | POST | ||
+ | | /scheduler/devices.json | ||
+ | |- | ||
+ | | GET | ||
+ | | /scheduler/devices/{device_id}.json | ||
+ | |- | ||
+ | | UPDATE | ||
+ | | /scheduler/devices/{device_id}.json | ||
+ | |- | ||
+ | | DELETE | ||
+ | | /scheduler/devices/{device_id}.json | ||
+ | |} | ||
+ | |||
+ | == Model == | ||
+ | |||
+ | {| border="1" cellpadding="2" cellspacing="0" | ||
+ | | ''Attribute'' | ||
+ | | ''Type'' | ||
+ | | ''CRUD'' | ||
+ | | ''Required'' | ||
+ | | ''Default Value'' | ||
+ | |- | ||
+ | | id | ||
+ | | uuid | ||
+ | | CR | ||
+ | | y | ||
+ | | generated | ||
+ | |- | ||
+ | | name | ||
+ | | string | ||
+ | | CRU | ||
+ | | n | ||
+ | | none | ||
+ | |- | ||
+ | | service_type | ||
+ | | string | ||
+ | | CR | ||
+ | | y | ||
+ | | none | ||
+ | |- | ||
+ | | version | ||
+ | | string | ||
+ | | CR | ||
+ | | y | ||
+ | | none | ||
+ | |- | ||
+ | | management | ||
+ | | object | ||
+ | | CRU | ||
+ | | n | ||
+ | | none | ||
+ | |- | ||
+ | | shared | ||
+ | | boolean | ||
+ | | CR | ||
+ | | n | ||
+ | | false | ||
+ | |- | ||
+ | | tenant_id | ||
+ | | uuid | ||
+ | | CR | ||
+ | | n | ||
+ | | none | ||
+ | |- | ||
+ | | capabilities | ||
+ | | object | ||
+ | | R | ||
+ | | n | ||
+ | | none | ||
+ | |} | ||
+ | |||
+ | '''Example''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "id": "f2bf34e028b64ce593aa8bab56259cad", | ||
+ | "name": "HAP-001", | ||
+ | "type": "lb-virtual", | ||
+ | "version": "1.0", | ||
+ | "shared": "true", | ||
+ | "management": { | ||
+ | "address": "10.0.0.6", | ||
+ | "port": 22, | ||
+ | "user": "user", | ||
+ | "password": "swordfish" | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | == List devices == | ||
+ | |||
+ | {| border="1" cellpadding="2" cellspacing="0" | ||
+ | | 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:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | GET /scheduler/devices.json | ||
+ | Accept: application/json | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''JSON Response:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "devices": [ | ||
+ | { | ||
+ | "id": "f2bf34e028b64ce593aa8bab56259cad", | ||
+ | "name": "HAP-001", | ||
+ | "type": "lb-virtual", | ||
+ | "version": "1.0", | ||
+ | "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" | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | == Show device == | ||
+ | |||
+ | {| border="1" cellpadding="2" cellspacing="0" | ||
+ | | 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:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | GET /scheduler/devices/{afc75773-640e-403c-9fff-62ba98db1f19}.json | ||
+ | Accept: application/json | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''JSON Response:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "device": { | ||
+ | "id": "f2bf34e028b64ce593aa8bab56259cad", | ||
+ | "name": "HAP-001", | ||
+ | "type": "HAPROXY", | ||
+ | "version": "1.0", | ||
+ | "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" | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | == Create Device == | ||
+ | |||
+ | {| border="1" cellpadding="2" cellspacing="0" | ||
+ | | 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:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | POST /scheduler/devices.json | ||
+ | Content-Type: application/json | ||
+ | Accept: application/json | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "device": { | ||
+ | "name": "HAP-001", | ||
+ | "type": "lb-virtual", | ||
+ | "version": "1.0", | ||
+ | "shared": "false", | ||
+ | "tenant_id": "f2bf34e028b64ce593aa8bab56259cad", | ||
+ | "management": { | ||
+ | "address": "10.0.0.6", | ||
+ | "port": 22, | ||
+ | "user": "user", | ||
+ | "password": "swordfish" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''JSON Response:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | { | ||
+ | "device": { | ||
+ | "id": "f2bf34e028b64ce593aa8bab56259cad", | ||
+ | "name": "HAP-001", | ||
+ | "type": "lb-virtual", | ||
+ | "version": "1.0", | ||
+ | "is_public": "true", | ||
+ | "management": { | ||
+ | "address": "10.0.0.6", | ||
+ | "port": 22, | ||
+ | "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 /scheduler/devices/fc68ea2c-b60b-4b4f-bd82-94ec81110766.json | ||
+ | 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": "lb-virtual", | ||
+ | "version": "1.0", | ||
+ | "is_public": "true", | ||
+ | "management": { | ||
+ | "address": "10.0.0.6", | ||
+ | "port": 22, | ||
+ | "user": "user", | ||
+ | "password": "swordfish" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | == Delete Device == | ||
+ | |||
+ | {| border="1" cellpadding="2" cellspacing="0" | ||
+ | | 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:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | DELETE /scheduler/devices/{afc75773-640e-403c-9fff-62ba98db1f19}.json | ||
+ | Accept: application/json | ||
+ | </nowiki></pre> | ||
+ | |||
+ | |||
+ | '''JSON Response:''' | ||
+ | |||
+ | <pre><nowiki> | ||
+ | status: 204 | ||
+ | </nowiki></pre> |
Revision as of 13:43, 29 November 2012
Overview
Scheduler is a separate Quantum plugin. It is responsible for:
- Management of devices that implement advanced services (load balancers, firewalls, vpn gateways, etc)
- Binding of service's logical models to devices (ex: schedule vip to load balancer)
- Deployment of configs to devices with help of agents/drivers
Workflow
Example 1. The typical workflow for vip creation:
Details:
- The request to create vip is is received by LBaaS Plugin
- LBaaS Plugin calls DB plugin to create model and store it to DB, vip_id is returned
- LBaaS Plugin responds to API with "HTTP 202 Accepted". The rest of process is done asynchronously
- LBaaS Plugin calls Scheduler and passes it service_type, vip_id, and other parameters.
- Scheduler finds device that satisfies service_type and other filter parameters.
- Scheduler stores mapping between device_id and vip_id in its DB. This mapping will be used in latter requests
- Scheduler sends message to Agent
- Agent reads message and forwards it to driver
- Agent returns result to Scheduler, then it is forwarded to LBaaS Plugin.
Agent is common for all services. It delegates processing to drivers[service_type][device_type][version].
Scheduler API
Scheduler operates devices, where device is an entity of specified service type with management interface parameters.
Note: this section is based on Quantum/LBaaS/RESTAPI/ProviderAPI
Verbs
Verb | URI |
GET | /scheduler/devices.json |
POST | /scheduler/devices.json |
GET | /scheduler/devices/{device_id}.json |
UPDATE | /scheduler/devices/{device_id}.json |
DELETE | /scheduler/devices/{device_id}.json |
Model
Attribute | Type | CRUD | Required | Default Value |
id | uuid | CR | y | generated |
name | string | CRU | n | none |
service_type | string | CR | y | none |
version | string | CR | y | none |
management | object | CRU | n | none |
shared | boolean | CR | n | false |
tenant_id | uuid | CR | n | none |
capabilities | object | R | n | none |
Example
{ "id": "f2bf34e028b64ce593aa8bab56259cad", "name": "HAP-001", "type": "lb-virtual", "version": "1.0", "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 /scheduler/devices.json Accept: application/json
JSON Response:
{ "devices": [ { "id": "f2bf34e028b64ce593aa8bab56259cad", "name": "HAP-001", "type": "lb-virtual", "version": "1.0", "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 /scheduler/devices/{afc75773-640e-403c-9fff-62ba98db1f19}.json Accept: application/json
JSON Response:
{ "device": { "id": "f2bf34e028b64ce593aa8bab56259cad", "name": "HAP-001", "type": "HAPROXY", "version": "1.0", "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 /scheduler/devices.json Content-Type: application/json Accept: application/json
{ "device": { "name": "HAP-001", "type": "lb-virtual", "version": "1.0", "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": "lb-virtual", "version": "1.0", "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 /scheduler/devices/fc68ea2c-b60b-4b4f-bd82-94ec81110766.json 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": "lb-virtual", "version": "1.0", "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 /scheduler/devices/{afc75773-640e-403c-9fff-62ba98db1f19}.json Accept: application/json
JSON Response:
status: 204