Storage of 5GTANGO Packages and Arbitrary Files - sonata-nfv/tng-cat GitHub Wiki
In this page, the documentation of the API regarding the storage of 5GTANGO packages and arbitrary files is provided. The API for 5GTANGO packages (tgo-package) and arbitrary files works very similarly to the API for the descriptors. Packages are compressed files, hosting several individual entities, some of which are descriptors, arbitrary files, etc. In order to support the storage of this kind of files, additional endpoints are provided. The structure information of 5GTANGO packages can be found here. Last but not least, the API reference of <base_url> can be found here.
The POST method provides the upload of 5GTANGO packages and arbitrary files.
In order to upload a 5GTANGO package file, which is named as 5gtango-test-package.tgo, you can use
curl -X POST -H "Content-Type: application/zip" -H "Content-Disposition: attachment; filename=5gtango-test-package.tgo" --data-binary @5gtango-test-package.tgo <base URL>/api/v2/tgo-packagesHeader 'Content-Type' must be set to application/zip for tgo-packages. Also, the HTTP header 'Content-Disposition' must be set to attachment; filename=<name of the package file>.
In order to upload an arbitrary file, which is named as MyExample.cfg, you can use
curl -X POST -H "Content-Type: application/octet-stream" -H "Content-Disposition: attachment; filename=MyExample.cfg" --data-binary @MyExample.cfg <base URL>/api/v2/filesHeader 'Content-Type' must be set to application/octet-stream for files. Also, the HTTP header 'Content-Disposition' must be set to attachment; filename=<name of the package file>.
The GET method provides the retrieval of 5GTANGO packages and arbitrary files. Dependent on the request, different endpoints are created and analyzed below.
The request can be created with json or yml extension format of the response. An example in json format is:
curl -H "Content-Type: application/json" <base URL>/api/v2/tgo-packagesThe request can be created with json or yml extension format of the response. An example in json format is:
curl -H "Content-Type: application/json" <base URL>/api/v2/filesThe request can be created with json or yml extension format of the response. An example in json format is:
curl -H "Content-type:application/json" /api/v2/tgo-packages/c382c6d1-41c9-42cb-b442-44f434d86ba9
The request can be created with json or yml extension format of the response. An example in json format is:
curl -H "Content-type:application/json" /api/v2/files/c382c6d1-41c9-42cb-b442-44f434d86ba9
To receive the raw data response of a 5GTANGO package, the request can be created by setting the header Content-Type as application/zip, similar to the following example:
curl -H "Content-Type:application/zip" <base URL>/api/v2/tgo-packages/c382c6d1-41c9-42cb-b442-44f434d86ba9Same as above, in order to receive the raw data response of a fil, the request can be created by setting the header Content-Type as application/octet-stream, similar to the following example:
curl -H "Content-Type:application/octet-stream" <base URL>/api/v2/files/c382c6d1-41c9-42cb-b442-44f434d86ba9the header Content-Type defines the format of the response and can be configured also as application/json. To receive the raw data response of a package/arbitrary file, you can use
The DELETE method provides the deletion of 5GTANGO packages and arbitrary files. Dependent on the request, different endpoints are created and analyzed below
In order to delete a specific 5GTANGO package using its UUID, the endpoint is:
curl -X DELETE <base URL>/api/v2/tgo-packages/c382c6d1-41c9-42cb-b442-44f434d86ba9In order to delete a specific arbitrary file using its UUID, the endpoint is:
curl -X DELETE <base URL>/api/v2/files/c382c6d1-41c9-42cb-b442-44f434d86ba9The same approach is followed for the upload of arbitrary files
curl -X DELETE http://localhost:4011/api/catalogues/v2/files/{id}