Functions querying - sonata-nfv/tng-gtk-common GitHub Wiki

This wiki page is part of the usage documentation of the tng-gtk-common module.

Context

Functions are are on-boarded within packages (see Packages management), so one can only GET or OPTIONS them, and not POST, PUT, PATCH or DELETE.

Querying a specific function

A specific function's metadata can be fetched using the following command:

$ curl :api_root/functions/:function_uuid

Expected returned data is:

  • HTTP code 200 (Ok) if the function is found, with the function's metadata in the body (JSON format);
  • HTTP code 400 (Bad Request), if the :function_uuid is mal-formed;
  • HTTP code 404 (Not Found), if the function is not found.

Querying several functions

Querying all existing functions can be done using the following command (default values for DEFAULT_PAGE_SIZE and DEFAULT_PAGE_NUMBER mentioned above are used):

$ curl :api_root/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/functions?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 functions' metadata in the body (JSON format), or an empty array ([]) if none is found according to the parameters passed;

Options

We may query which operations are allowed with the HTTP verb OPTIONS, by issuing the following command:

$ curl -X OPTIONS :api_root/functions
  • HTTP code 200 (Ok) if the functions options are defined;