Skip to content

Service instantiation or termination

José Bonnet edited this page Mar 15, 2019 · 4 revisions

This wiki page is part of the usage and explains how to use the `5GTANGO API to instantiate a service or terminate an instance of a service.

Service instantiation request

A request is created by POSTing 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 to CREATE_SERVICE, can also be TERMINATE_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"

Querying a specific function record

We may query a specific function record by executing the command:

$ curl :api_root/records/functions/:record_uuid

Expected returned data is:

  • HTTP code 200 (Ok) if the function record with the given UUID is found, with the function record in the body (JSON format);
  • HTTP code 400 (Bad Request), if the :record_uuid is mal-formed;
  • HTTP code 404 (Not Found), if the function record is not found.

Querying several function records

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 code 200 (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" }