|
1 | 1 | # [SONATA](http://www.sonata-nfv.eu)'s Gatekeeper Function Management micro-service |
2 | 2 | [](http://jenkins.sonata-nfv.eu/job/son-gkeeper) |
3 | 3 |
|
4 | | -# Tests |
| 4 | +This is the folder of the **Functions Management** micro-service. This micro-service is used by the [`Gatekeeper API`](https://github.com/sonata-nfv/son-gkeeper/son-gtkapi). |
5 | 5 |
|
6 | | -## Obtain a list of available functions |
7 | | -The full list of functions registered in the Catalogues can be obrained with |
| 6 | +## Configuration |
| 7 | +The configuration of the Gatekeeper's Function Management micro-service is done mostly by defining `ENV` variables in the [`Dockerfile`](https://github.com/sonata-nfv/son-gkeeper/blob/master/son-gtkfnct/Dockerfile). These variables are: |
8 | 8 |
|
9 | | -```curl -vi http://sp.int.sonata-nfv.eu:32001/functions``` |
| 9 | +* `PORT`: the port the micro-service is to provide it's services, currently `5500`; |
| 10 | +* `CATALOGUES_URL`: the Catalogues URL, currently `http://catalogues:4002/catalogues`; |
10 | 11 |
|
11 | | -**Note:** For this version, no user authentication/authorization is being done. In the future, with authentication/authorization mechanisms in place, this list will be adequately filtered. |
| 12 | +Future work includes evolving the way we store these environment variables, as well as avoiding at least some of the repetition between this information and the one provided in the [`docker-compose.yml`](https://github.com/sonata-nfv/son-gkeeper/blob/master/docker-compose.yml). |
12 | 13 |
|
13 | | -## Obtain a list of functions with specific attribute values |
14 | | -To obtain only the list of functions that have specific values for some of the attributes (e.g., `status=Active`), you can do this: |
| 14 | +## Usage |
| 15 | +To use this application, we write |
| 16 | +```sh |
| 17 | +$ foreman start |
| 18 | +``` |
15 | 19 |
|
16 | | -```curl -vi http://sp.int.sonata-nfv.eu:32001/functions?status=Active``` |
| 20 | +[`Foreman`](https://github.com/ddollar/foreman) is a `ruby gem` for managing applications based on a [`Procfile`](https://github.com/sonata-nfv/son-gkeeper/blob/master/son-gtkfnct/Procfile). |
17 | 21 |
|
18 | | -## Obtain specific attributes on a list of functions |
19 | | -To obtain only specific attributes (e.g., only `uuid`, `vendor`, `name` and `version`), you can do this: |
| 22 | +### Implemented API |
| 23 | +The implemented API of the Gatekeeper is the following: |
20 | 24 |
|
21 | | -```curl -vi http://sp.int.sonata-nfv.eu:32001/functions?fields=uuid,vendor,name,version``` |
| 25 | +* `/functions`: |
| 26 | + * `GET`: provides a list of functions records, available in the Repository; |
| 27 | + * `/:uuid`: provides the function record data with the given `:uuid`; |
| 28 | + * `/functions?status=active`: provides the function with the status active; |
| 29 | + * `/functions?fields=uuid,vendor,name,version`: provides the function data with the given `uuid`, `vendor`, `name` and `version`; |
| 30 | + * `/admin/logs`: |
| 31 | + * `GET`: Retrieve the currently available log file |
22 | 32 |
|
23 | | -**Note:** We are assuming there aren't any attributes of the entity called `fields`. |
| 33 | +**Note 1:** `PUT`and `DELETE`operations are already supported by some of the micro-services, and will be described in the next version(s); |
24 | 34 |
|
25 | | -## Check directly in the Catalogue |
| 35 | +**Note 2:** all `GET`operations support pagination, though this still needs some work. This pagination can be done by using the `offset` and `limit` parameters, like in: |
| 36 | +```sh |
| 37 | +$ curl <resource_url>?offset=0,limit=10 |
| 38 | +``` |
| 39 | +This command will result in a list of `10`values (the `limit`) of the first page (`offset` zero). These are the default values used for those parameters. |
26 | 40 |
|
27 | | -```curl -vi -H "Content-Type: application/json" http://sp.int.sonata-nfv.eu:4002/catalogues/vnfs``` |
| 41 | +## Tests |
| 42 | +At the module level, we only do **automated unit tests**, using the `RSpec` framework (see the `./spec/`folder). For the remaining tests please see the repositorie's [`README`](https://github.com/sonata-nfv/son-gkeeper/blob/master/README.md) file. |
0 commit comments