Skip to content

Requests usage

José Bonnet edited this page Oct 30, 2017 · 17 revisions

This page details the Requests-related endpoints of the SONATA Gatekeeper API.

Requests are made to create, update or delete service instances. Service instances have the following state diagram:

Service Instances' state diagram

  • Created: the MANO Framework has successfully finished instantiating or updating the service;
  • Updating: the customer who had previously requested the service instantiation is now requesting an update (through the the BSS). The MANO Framework has accepted the UPDATE request and is working on its execution;
  • Terminating: the customer who had previously requested the service instantiation is now requesting a termination (through the the BSS). The MANO Framework has accepted the TERMINATE request and is working on its execution;

Requests have the following state diagram.

Requests' state diagram

  • New: this is the default state for new CREATE request. The request has been submitted to the MANO Framework and no answer has yet been received;
  • In Progress: the MANO Framework has accepted the request and is working on its execution;
  • Succeeded: the MANO Framework has successfully finished instantiating, updating or terminating the service instance;
  • Error: whenever the MANO Framework fails to execute a CREATE, UPDATE or TERMINATE request, the request is put into this state.

/requests

POST

Through this endpoint POST request, the Gatekeeper creates a request, stores it in a database and submits it to the MANO Framework, returning a JSON formatted request.

Create request

  • Request:
curl <base URL>/requests -H 'authorization:bearer <token>' \
  -d '{"service_uuid":<service uuid>, "ingresses":[], "egresses":[]}'

If absent from the request, the request_type field is treated as having the value CREATE. The other possible value for this field is TERMINATE, for terminating a service instance that is running.

  • Response:
{
    "began_at": "2017-09-15T13:36:04.805Z", 
    "callback": "http://sp.int3.sonata-nfv.eu:5400/service-instantiation-time", 
    "created_at": "2017-09-15T13:36:04.867Z", 
    "id": "de0d4c7e-9450-4c3f-8add-5f9531303c65", 
    "request_type": "CREATE", 
    "service_instance_uuid": null, 
    "service_uuid": "233cb9b2-5575-4ddd-8bd6-6c32396afe02", 
    "status": "NEW", 
    "updated_at": "2017-09-15T13:36:04.867Z"
}

Please note fields status (with value NEW) and service_instance_uuid(with value null): this is because the request to the MANO Framework is asynchronous. If a request (see GET, below) is done some time after, the answer may be the following:

{
    "began_at": "2017-09-15T13:36:04.805Z", 
    "callback": "http://sp.int3.sonata-nfv.eu:5400/service-instantiation-time", 
    "created_at": "2017-09-15T13:36:04.867Z", 
    "id": "de0d4c7e-9450-4c3f-8add-5f9531303c65", 
    "request_type": "CREATE", 
    "service_instance_uuid": "64bebf45-9c58-4615-9fe6-d42c89189876", 
    "service_uuid": "233cb9b2-5575-4ddd-8bd6-6c32396afe02", 
    "status": "READY", 
    "updated_at": "2017-09-15T13:37:06.224Z"
}

Notice the READYstatus now, as well as the service_instance_uuid (and the updated_at, which is now later than the created_at).

Terminate request

  • Request:
curl <base URL>/requests -H 'authorization:bearer <token>' \
  -d '{"service_instance_uuid":<service uuid>, "request_type":"TERMINATE"}'
  • Response:
{
    "began_at": "2017-08-29T11:04:48.100Z", 
    "callback": null,
    "created_at": "2017-08-29T11:04:48.100Z", 
    "id": "0da4fbc4-97bd-48ed-94ba-5ae4fd8fcb82", 
    "request_type": "TERMINATE", 
    "service_instance_uuid": "e6d0fbd6-74be-43c6-959d-667f3ace1cb4", 
    "service_uuid": null, 
    "status": "NEW", 
    "updated_at": "2017-08-29T11:04:48.100Z"
}

GET

Through this endpoint GET request, the Gatekeeper returns a JSON formatted paginated list of requests.

  • Request:
curl <base URL>/requests -H 'authorization:bearer <token>'
  • Response:
[
    {
        "began_at": "2017-08-29T09:38:15.485Z", 
        "callback": "http://sp.int3.sonata-nfv.eu:5400/service-instantiation-time", 
        "created_at": "2017-08-29T09:38:15.485Z", 
        "id": "7282a2a4-24fd-4d20-a378-5c00a3d6305e", 
        "request_type": "CREATE", 
        "service_instance_uuid": null, 
        "service_uuid": "88e6be04-46d2-4245-85d3-3be692ce8a4f", 
        "status": "ERROR", 
        "updated_at": "2017-08-29T09:40:39.271Z"
    }, 
    {
        "began_at": "2017-08-29T11:04:48.100Z", 
        "callback": "http://sp.int3.sonata-nfv.eu:5400/service-instantiation-time", 
        "created_at": "2017-08-29T11:04:48.100Z", 
        "id": "0da4fbc4-97bd-48ed-94ba-5ae4fd8fcb82", 
        "request_type": "CREATE", 
        "service_instance_uuid": null, 
        "service_uuid": "e6d0fbd6-74be-43c6-959d-667f3ace1cb4", 
        "status": "INSTANTIATING", 
        "updated_at": "2017-08-29T11:04:56.142Z"
    }
]

/requests/<request id>

GET

Through this endpoint GET request, the Gatekeeper returns the JSON formatted request data.

  • Request:
curl <base URL>/requests/0da4fbc4-97bd-48ed-94ba-5ae4fd8fcb82 \
  -H 'authorization:bearer <token>'
  • Response:
{
    "began_at": "2017-08-29T11:04:48.100Z", 
    "callback": "http://sp.int3.sonata-nfv.eu:5400/service-instantiation-time", 
    "created_at": "2017-08-29T11:04:48.100Z", 
    "id": "0da4fbc4-97bd-48ed-94ba-5ae4fd8fcb82", 
    "request_type": "CREATE", 
    "service_instance_uuid": null, 
    "service_uuid": "e6d0fbd6-74be-43c6-959d-667f3ace1cb4", 
    "status": "INSTANTIATING", 
    "updated_at": "2017-08-29T11:04:56.142Z"
}
Clone this wiki locally