Skip to content

Packages usage

José Bonnet edited this page Aug 31, 2017 · 13 revisions

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

/packages

POST

Through this endpoint POST request, the Gatekeeper accepts a SONATA package, validates and stores it in the Catalogues.

  • Request:
curl -X POST <base URL>/packages -H 'authorization:bearer <token>'\
  -F "package=@<package file name>"

Packages are univocally identified by the trio of fields vendor, name and version, which has to be unique.

  • Response:
{
    "created_at": "2017-05-25T12:35:54.614+00:00", 
    "md5": "49ce3e2f15aec5c012ef35575255ebfb", 
    "pd": {
        "description": "SONATA RING service for qualification environment", 
        "descriptor_version": "1.0", 
        "entry_service_template": "/service_descriptors/sonata-qual-1vnf-1pop.yml", 
        "maintainer": "Felipe Vicens, ATOS, felipe.vicens@atos.net", 
        "name": "sonata-ring-service", 
        "package_content": [
            {
                "content-type": "application/sonata.service_descriptor", 
                "md5": "3480169189d000dc70dfe5b022629c21", 
                "name": "/service_descriptors/sonata-qual-1vnf-1pop.yml"
            }, 
            {
                "content-type": "application/sonata.function_descriptor", 
                "md5": "7dac616660f603911ac6268aa3846095", 
                "name": "/function_descriptors/vring-vnf-vnfd.yml"
            }
        ], 
        "schema": "https://raw.githubusercontent.com/sonata-nfv/son-schema/master/package-descriptor/pd-schema.yml", 
        "sealed": true, 
        "vendor": "eu.sonata-nfv.package", 
        "version": "0.1"
    }, 
    "signature": null, 
    "son-package-uuid": "3e38882a-c659-4039-a159-320f7dea7dc0", 
    "status": "active", 
    "updated_at": "2017-05-25T12:35:54.614+00:00", 
    "username": "sonata", 
    "uuid": "c0343293-0f1e-46be-bc40-886eddb73a38"
}

The username of the user who has submitted the package becomes the owner of the package, the service and the functions it specifies. This ownership concept is important when different kinds of licences (see Licences usage) are considered.

GET

Through this endpoint GET request, the Gatekeeper returns a JSON formatted paginated list of packages meta-data.

  • Request:
curl <base URL>/packages -H 'authorization:bearer <token>'

Packages are univocally identified by the trio of fields vendor, name and version, which has to be unique.

  • Response:
[
    {
        "created_at": "2017-08-28T11:14:48.921+00:00", 
        "md5": "510341c643b740192d08d85143d68c49", 
        "pd": {
            "description": "SONATA vTC Y1 demo service", 
            "descriptor_version": "1.0", 
            "entry_service_template": "/service_descriptors/sonata-demo.yml", 
            "maintainer": "Steven Van Rossem, Ghent University", 
            "name": "sonata-vtc-service-sp", 
            "package_content": [
                {
                    "content-type": "application/sonata.service_descriptor", 
                    "md5": "9e87f0349779603960dfea601280298e", 
                    "name": "/service_descriptors/sonata-demo.yml"
                }, 
                {
                    "content-type": "application/sonata.function_descriptor", 
                    "md5": "e84bc7ba1a5045d560fbff4ade9f95b5", 
                    "name": "/function_descriptors/vtc-vnf-vnfd.yml"
                }
            ], 
            "schema": "https://raw.githubusercontent.com/sonata-nfv/son-schema/master/package-descriptor/pd-schema.yml", 
            "sealed": true, 
            "vendor": "eu.sonata-nfv.package", 
            "version": "0.4"
        }, 
        "signature": null, 
        "son_package_uuid": "4cc736fc-547e-479e-8cc8-b92d2284a417", 
        "status": "active", 
        "updated_at": "2017-08-28T11:14:49.276+00:00", 
        "user_licence": "public", 
        "username": "sonata-1503918883", 
        "uuid": "372743e0-b8eb-4179-a83b-3eeecf512a17"
    }, 
    {
        "created_at": "2017-08-28T11:14:51.212+00:00", 
        "md5": "19de3a5330996d65d8276fcea2903adc", 
        "pd": {
            "description": "SONATA vTC Y1 private demo service", 
            "descriptor_version": "1.0", 
            "entry_service_template": "/service_descriptors/sonata-demo.yml", 
            "maintainer": "Steven Van Rossem, Ghent University", 
            "name": "sonata-vtc-private-service-sp", 
            "package_content": [
                {
                    "content-type": "application/sonata.service_descriptor", 
                    "md5": "556b5f79a365344e906c972058257db6", 
                    "name": "/service_descriptors/sonata-demo.yml"
                }, 
                {
                    "content-type": "application/sonata.function_descriptor", 
                    "md5": "e84bc7ba1a5045d560fbff4ade9f95b5", 
                    "name": "/function_descriptors/vtc-vnf-vnfd.yml"
                }
            ], 
            "schema": "https://raw.githubusercontent.com/sonata-nfv/son-schema/master/package-descriptor/pd-schema.yml", 
            "sealed": true, 
            "vendor": "eu.sonata-nfv.package", 
            "version": "0.4"
        }, 
        "signature": null, 
        "son_package_uuid": "2ba6e367-13c9-446b-835a-832b150d23ae", 
        "status": "active", 
        "updated_at": "2017-08-28T11:14:51.440+00:00", 
        "user_licence": "public", 
        "username": "sonata-1503918883", 
        "uuid": "954ba283-1353-46ba-97c4-37cbe43e7217"
    }
]

/packages/<package_uuid>

GET

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

  • Request:
curl <base URL>/packages/0470e2e4-7bcb-4cb1-a2a5-05f0f54e2623 \
  -H 'authorization:bearer <token>'
  • Response:
{
    "created_at": "2017-08-30T15:49:27.430+00:00", 
    "md5": "19de3a5330996d65d8276fcea2903adc", 
    "pd": {
        "description": "SONATA vTC Y1 private demo service", 
        "descriptor_version": "1.0", 
        "entry_service_template": "/service_descriptors/sonata-demo.yml", 
        "maintainer": "Steven Van Rossem, Ghent University", 
        "name": "sonata-vtc-private-service-sp", 
        "package_content": [
            {
                "content-type": "application/sonata.service_descriptor", 
                "md5": "556b5f79a365344e906c972058257db6", 
                "name": "/service_descriptors/sonata-demo.yml"
            }, 
            {
                "content-type": "application/sonata.function_descriptor", 
                "md5": "e84bc7ba1a5045d560fbff4ade9f95b5", 
                "name": "/function_descriptors/vtc-vnf-vnfd.yml"
            }
        ], 
        "schema": "https://raw.githubusercontent.com/sonata-nfv/son-schema/master/package-descriptor/pd-schema.yml", 
        "sealed": true, 
        "vendor": "eu.sonata-nfv.package", 
        "version": "0.4"
    }, 
    "signature": null, 
    "son_package_uuid": "61d47789-2332-460a-8136-a5aa4be13a29", 
    "status": "active", 
    "updated_at": "2017-08-30T15:49:27.649+00:00", 
    "username": "sonata-1504108160", 
    "uuid": "0470e2e4-7bcb-4cb1-a2a5-05f0f54e2623"
}

The information shown above corresponds to a package that is licensed as public (in this case, by omitting the licences field from the package descriptor).

DELETE

Through this endpoint DELETE request, the Gatekeeper returns no data, deleting the package meta-data, file and associated service and functions meta-data.

  • Request:
curl -X DELETE <base URL>/packages/0470e2e4-7bcb-4cb1-a2a5-05f0f54e2623 \
  -H 'authorization:bearer <token>'
  • Response:
<empty response>

The deletion of a package may not succeed due to one or more of the folwoing reasons:

/packages/<package_uuid>/download

GET

Through this endpoint GET request, the Gatekeeper returns the original file that constitutes the package.

  • Request:
curl <base URL>/packages/0470e2e4-7bcb-4cb1-a2a5-05f0f54e2623/download \
  -H 'authorization:bearer <token>'
  • Response:
<binary data>
Clone this wiki locally