Storage of Network Services (NS) - sonata-nfv/tng-cat GitHub Wiki
In this page, the documentation of the API regarding the Network Service Descriptors (NSD) storage is provided. Last but not least, the API reference of <base_url> can be found here.
The POST method provides the upload of NS descriptors. The upload of a NS descriptor with json or yml extension format is available through a POST endpoint. For example, in order to upload the descriptor nsd_example.json, the endpoint is composed as:
curl -X POST --data-binary @nsd_example.json -H "Content-type:application/json" <base URL>/api/v2/network-services
The header of Content-Type
must be the corresponding with the format of the file upload. Also, the above endpoint assumes that the descriptor nsd_example.json is located at the current directory. In any other occasion, the provision of the full path is a necessity. The Catalogues API will return a universally unique identifier (UUID) which is used to reference the specific descriptor in the endpoints below.
The GET method provides the retrieval of NS descriptors. 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/network-services
The response will be in the form of the corresponding format requested from above, regardless of the stored format.
The request of retrieving a descriptor using the uuid 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/network-services/c382c6d1-41c9-42cb-b442-44f434d86ba9
The response will be in the form of the corresponding format requested from above, regardless of the stored format.
The request of receiving a list of the last version for every descriptor 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/network-services?version=last
The response will be in the form of the corresponding format requested from above, regardless of the stored format.
The request of receiving a list of all descriptors matching a specific filter(s) can be created with 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/network-services?{attributeName1}={value1}[&{attributeName2}={value2}]
The fields in the brackets are not mandatory but they are compulsory in terms of providing multiple attribute names. The response will be in the form of the corresponding format requested from above. In order to efficiently use this endpoint, first, read the corresponding section.
The PUT method provides the update of NS descriptors. Dependent on the request, different endpoints are created and analyzed below.
This PUT method enables the update of a certain field of a descriptor with the provided UUID. The fields that can be changed are:
- status field from the attached metadata of the Catalogue to the descriptor
- the root level field of the uploaded descriptor The corresponding descriptor is provided below:
curl -X PUT <base URL>/api/v2/network-services/c382c6d1-41c9-42cb-b442-44f434d86ba9?<field>=<value>
In the example of the status field in the attached metadata of the Catalogue to the descriptor, the endpoint to update the value of the status to disabled is:
curl -X PUT <base URL>/api/v2/network-services/c382c6d1-41c9-42cb-b442-44f434d86ba9?status=disabled
This special endpoint is provided for the aim of versioning. The upload of a descriptor will be successful since a check for another given descriptor is successful also. For example, the upload of the descriptor nsd_example.json is needed while the presence of the previously uploaded descriptor with uuid=c382c6d1-41c9-42cb-b442-44f434d86ba9
is necessary. The corresponding endpoint is provided below:
curl -X PUT --data-binary @nsd_example.json -H "Content-type:application/json" <base URL>/api/v2/network-services/c382c6d1-41c9-42cb-b442-44f434d86ba9
The format of the provided header with Content-Type
must be the corresponding extension of the descriptor to be uploaded. Instead of using the uuid to check for a specific descriptor, the naming triplet of name, vendor, version can be supported:
curl -X PUT --data-binary @nsd_example.json -H "Content-type:application/json" <base URL>/api/v2/network-services?name={name1}&vendor={vendor1}&version={1.0}
The above example checks for the presence of a descriptor with naming triplet name={name1}&vendor={vendor1}&version={1.0}
and uploads the descriptor nsd_example.json if the presence of the previous descriptor is valid.
The DELETE method provides the deletion of NS descriptors. Dependent on the request, different endpoints are created and analyzed below.
In order to delete a specific descriptor using its UUID, the endpoint is:
curl -X DELETE <base URL>/api/v2/network-services/c382c6d1-41c9-42cb-b442-44f434d86ba9
In order to delete a specific descriptor using its naming triplet attributes of name, vendor and version, a special case of using these attributes takes place. For example, to delete a descriptor which contains a name field with value name1
, a vendor field with value vendor1
and a version field with value 1.0
, the endpoint is:
curl -X DELETE <base URL>/api/v2/network-services?name={name1}&vendor={vendor1}&version={1.0}