-
Notifications
You must be signed in to change notification settings - Fork 12
Service instantiation or termination
This wiki page is part of the usage and explains how to use the [5GTANGO's Service Platform API](https://github.com/sonata-nfv/tng-api-gtw)
to instantiate a service or terminate an instance of a service.
A request is created by POST
ing a service (descriptor) UUID using the command:
$ curl -H 'content-type:application/json' :api_root/requests \
-d '{"service_uuid":":service_uuid"}'
In this POST
, the JSON
in the body can have a number of other parameters:
-
request_type
: defaults toCREATE_SERVICE
, can also beTERMINATE_SERVICE
; -
ingresses
: defaults to[]
(an empty array), that may hold the list of ingress points the customer wants the service instance to be connected to;t.string "status", default: "NEW" t.string "request_type", default: "CREATE_SERVICE" t.uuid "instance_uuid" t.string "ingresses", default: "[]" t.string "egresses", default: "[]" t.string "callback", default: "" t.string "blacklist", default: "[]" t.uuid "customer_uuid" t.uuid "sla_id"
We may query a specific function record by executing the command:
$ curl :api_root/records/functions/:record_uuid
Expected returned data is:
-
HTTP
code200
(Ok
) if the function record with the given UUID is found, with the function record in the body (JSON format); -
HTTP
code400
(Bad Request
), if the:record_uuid
is mal-formed; -
HTTP
code404
(Not Found
), if the function record is not found.
Querying many existing function records can be done using the following command (default values for DEFAULT_PAGE_SIZE
and DEFAULT_PAGE_NUMBER
are used):
$ curl :api_root/records/functions/
If different default values for the starting page number and the number of records per page are needed, these can be used as query parameters:
$ curl ":api_root/packages?page_size=20&page_number=2"
Note the ""
used around the command, in order for the shell
used to consider the &
as part of the command, instead of considering it a background process command.
Expected returned data is:
-
HTTP
code200
(Ok
) with an array of function records in the body (JSON
format), or an empty array ([]
) if none is found according to the parameters passed;
$ http POST pre-int-sp-ath.5gtango.eu:32002/api/v3/requests uuid=e543ca9b-c95c-41cd-8b0c-5cbf5511a60e egresses=[] ingresses=[] blacklist=[]
{
"began_at": "2018-06-19T12:29:14.820Z",
"blacklist": null,
"callback": null,
"created_at": "2018-06-19T12:29:14.866Z",
"customer_uuid": null,
"egresses": null,
"id": "b235b429-052d-483d-9da6-d01f6bf0d09e",
"ingresses": null,
"instance_uuid": null,
"request_type": "CREATE_SERVICE",
"sla_uuid": null,
"status": "INSTANTIATING",
"updated_at": "2018-06-19T12:29:15.252Z",
"uuid": "d795b494-d1b7-402d-b92f-c6f56614b290"
}```
{ "began_at": "2018-06-19T12:29:14.820Z", "blacklist": null, "callback": null, "created_at": "2018-06-19T12:29:14.866Z", "customer_uuid": null, "egresses": null, "id": "b235b429-052d-483d-9da6-d01f6bf0d09e", "ingresses": null, "instance_uuid": "3767f191-6c77-482b-8688-67d3fdcf80d0", "request_type": "CREATE_SERVICE", "sla_uuid": null, "status": "READY", "updated_at": "2018-06-19T12:30:04.054Z", "service_uuid": "d795b494-d1b7-402d-b92f-c6f56614b290" }
---
## Examples
$ http POST pre-int-sp-ath.5gtango.eu:32002/api/v3/requests service_uuid=34b6a8a6-1398-4ba4-a43d-69e8647fc496 HTTP/1.1 201 Created Content-Length: 467 X-Timing: 0.594148066 connection: close content-type: application/json server: thin x-content-type-options: nosniff
{ "blacklist": "[]", "callback": "", "created_at": "2019-03-15T15:36:07.797Z", "customer_email": null, "customer_name": null, "description": "", "egresses": "[]", "error": "", "id": "862ed3af-85b8-43a0-b340-90220f6af01a", "ingresses": "[]", "instance_uuid": null, "name": "", "request_type": "CREATE_SERVICE", "service": { "name": "tango-nsd", "uuid": "34b6a8a6-1398-4ba4-a43d-69e8647fc496", "vendor": "eu.5gtango", "version": "0.9" }, "sla_id": null, "status": "NEW", "updated_at": "2019-03-15T15:36:07.797Z" }
$ http pre-int-sp-ath.5gtango.eu:32002/api/v3/requests/862ed3af-85b8-43a0-b340-90220f6af01a HTTP/1.1 200 OK Content-Length: 503 X-Timing: 10.099343681 connection: close content-type: application/json server: thin x-content-type-options: nosniff
{ "blacklist": "[]", "callback": "", "created_at": "2019-03-15T15:36:07.797Z", "customer_email": null, "customer_name": null, "description": "", "egresses": "[]", "error": "", "id": "862ed3af-85b8-43a0-b340-90220f6af01a", "ingresses": "[]", "instance_uuid": "7fe8ff3f-e5ce-4fe1-8eb0-13cf9b139550", "name": "", "request_type": "CREATE_SERVICE", "service": { "name": "tango-nsd", "uuid": "34b6a8a6-1398-4ba4-a43d-69e8647fc496", "vendor": "eu.5gtango", "version": "0.9" }, "sla_id": null, "status": "READY", "updated_at": "2019-03-15T15:36:36.553Z" }
# Service instance termination
$ http POST pre-int-sp-ath.5gtango.eu:32002/api/v3/requests instance_uuid=7fe8ff3f-e5ce-4fe1-8eb0-13cf9b139550 request_type=TERMINATE_SERVICE HTTP/1.1 201 Created Content-Length: 504 X-Timing: 0.232575762 connection: close content-type: application/json server: thin x-content-type-options: nosniff
{ "blacklist": "[]", "callback": "", "created_at": "2019-03-15T15:42:11.286Z", "customer_email": null, "customer_name": null, "description": "", "egresses": "[]", "error": "", "id": "1ae53454-7bef-4256-9f2e-8e3e814dd651", "ingresses": "[]", "instance_uuid": "7fe8ff3f-e5ce-4fe1-8eb0-13cf9b139550", "name": "", "request_type": "TERMINATE_SERVICE", "service": { "name": "tango-nsd", "uuid": "34b6a8a6-1398-4ba4-a43d-69e8647fc496", "vendor": "eu.5gtango", "version": "0.9" }, "sla_id": null, "status": "NEW", "updated_at": "2019-03-15T15:42:11.286Z" }
$ http pre-int-sp-ath.5gtango.eu:32002/api/v3/requests/1ae53454-7bef-4256-9f2e-8e3e814dd651 HTTP/1.1 200 OK Content-Length: 506 X-Timing: 10.122801559 connection: close content-type: application/json server: thin x-content-type-options: nosniff
{ "blacklist": "[]", "callback": "", "created_at": "2019-03-15T15:42:11.286Z", "customer_email": null, "customer_name": null, "description": "", "egresses": "[]", "error": "", "id": "1ae53454-7bef-4256-9f2e-8e3e814dd651", "ingresses": "[]", "instance_uuid": "7fe8ff3f-e5ce-4fe1-8eb0-13cf9b139550", "name": "", "request_type": "TERMINATE_SERVICE", "service": { "name": "tango-nsd", "uuid": "34b6a8a6-1398-4ba4-a43d-69e8647fc496", "vendor": "eu.5gtango", "version": "0.9" }, "sla_id": null, "status": "READY", "updated_at": "2019-03-15T15:42:17.268Z" }
----
$ http pre-int-sp-ath.5gtango.eu:32002/api/v3/users/sessions username=tango password=t4ng0
HTTP/1.1 200 OK
Content-Length: 297
X-Timing: 0.316900452
connection: close
content-type: text/html;charset=utf-8
server: thin
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
{
"token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InRhbmdvIiwibmFtZSI6IjVHVEFOR08iLCJyb2xlIjoiYWRtaW4iLCJlbWFpbCI6InRhbmdvQHRhbmdvLmNvbSIsImxvZ2luX3RpbWUiOiIyMDE5LTAzLTE4IDE1OjEzOjA4ICswMDAwIiwiZXhwaXJhdGlvbl90aW1lIjoiMjAxOS0wMy0xOCAxNjoxMzowOCArMDAwMCJ9.eHRjzPD89PUmySGGq-x_3yuN6SC86VbyYSayBILPbJk"
}
$ TOKEN="eyJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InRhbmdvIiwibmFtZSI6IjVHVEFOR08iLCJyb2xlIjoiYWRtaW4iLCJlbWFpbCI6InRhbmdvQHRhbmdvLmNvbSIsImxvZ2luX3RpbWUiOiIyMDE5LTAzLTE4IDE1OjEzOjA4ICswMDAwIiwiZXhwaXJhdGlvbl90aW1lIjoiMjAxOS0wMy0xOCAxNjoxMzowOCArMDAwMCJ9.eHRjzPD89PUmySGGq-x_3yuN6SC86VbyYSayBILPbJk"
$ http pre-int-sp-ath.5gtango.eu:32002/api/v3/requests service_uuid=34b6a8a6-1398-4ba4-a43d-69e8647fc496 authorization:"bearer $TOKEN"
HTTP/1.1 201 Created
Content-Length: 467
X-Timing: 2.2735886
connection: close
content-type: application/json
server: thin
x-content-type-options: nosniff
{
"blacklist": "[]",
"callback": "",
"created_at": "2019-03-18T15:14:33.865Z",
"customer_email": null,
"customer_name": null,
"description": "",
"egresses": "[]",
"error": "",
"id": "d028b19a-ae4f-47c3-a196-e8c1c068c381",
"ingresses": "[]",
"instance_uuid": null,
"name": "",
"request_type": "CREATE_SERVICE",
"service": {
"name": "tango-nsd",
"uuid": "34b6a8a6-1398-4ba4-a43d-69e8647fc496",
"vendor": "eu.5gtango",
"version": "0.9"
},
"sla_id": null,
"status": "NEW",
"updated_at": "2019-03-18T15:14:33.865Z"
}