|
| 1 | +--- |
| 2 | +sidebar_position: 3 |
| 3 | +title: "Swagger UI" |
| 4 | +sidebar_label: "Swagger UI" |
| 5 | +draft: false |
| 6 | +--- |
| 7 | + |
| 8 | +## Login |
| 9 | + |
| 10 | +The API set forth in the TNLCM is as follows: |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +If it is the first time using the API it is necessary to create a user: |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +Once the user has been created or if it has been previously created, add the user and its password in the Basic Authorization section of the **Authorize** box: |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +Once the user has been added, an access token and its refresh token can be generated. This access token has a duration of one day (can be modified): |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +The next step is to add the token in the green **Authorize** box. It is required to put the word **Bearer**, a space and then the token. An example is shown: |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +Now, requests that involve having an access token can be made. |
| 31 | + |
| 32 | +If the access token expires, it can be refreshed by using the refresh token. The token in the green **Authorize** box must be updated with the refresh token and the post request must be made: |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +When the request is made, it will return another access token that will need to be put back into the green **Authorize** box. |
| 37 | + |
| 38 | +## Create Trial Network |
| 39 | + |
| 40 | +Once logged into TNLCM, execute the POST request of the `trial-network` namespace: |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +Fill in the following fields: |
| 45 | + |
| 46 | +- `tn_id`: must start with a character and be at least 4 characters long. This field can be left blank, in which case a random value will be generated. |
| 47 | +- `deployment_site`: must be one of the sites available in the [6G-Sandbox-Sites](https://github.com/6G-SANDBOX/6G-Sandbox-Sites) repository. |
| 48 | +- `library_reference_type`: you can specify a branch, tag, or commit of the 6G-Library repository. |
| 49 | +- `library_reference_value`: value corresponding to the type specified in the `library_reference_type` field. |
| 50 | +- `sites_reference_type`: you can specify a branch, tag, or commit of the 6G-Sandbox-Sites repository. |
| 51 | +- `sites_reference_value`: value corresponding to the type specified in the `sites_reference_type` field. |
| 52 | +- `descriptor`: descriptor file containing the definition of the trial network. To create a descriptor file, refer to the [Trial Network Descriptor Guide](https://github.com/6G-SANDBOX/TNLCM/wiki/Trial-Network-Descriptor-Guide) section. |
| 53 | + |
| 54 | +## Deploy Trial Network |
| 55 | + |
| 56 | +Once logged into TNLCM and the trial network has been created, execute the PUT request of the `trial-network` namespace: |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +Fill in the following fields: |
| 61 | + |
| 62 | +- `jenkins_deploy_pipeline`: if nothing is specified, a pipeline will be created inside the TNLCM folder in Jenkins with the name `TN_DEPLOY_<tn_id>`. If specified, it will be checked if it exists in Jenkins and that there is nothing queued to execute. |
| 63 | +- `tn_id`: the identifier of the trial network received in the [POST request](#create-trial-network). |
| 64 | + |
| 65 | +## Destroy trial network |
| 66 | + |
| 67 | +Once logged into TNLCM, the trial network has been created and the trial network has been deployed, execute the DELETE request to destroy a trial network: |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +Fill in the following fields: |
| 72 | + |
| 73 | +- `jenkins_destroy_pipeline`: if nothing is specified, a pipeline will be created inside TNLCM folder in Jenkins with the name `TN_DESTROY_<tn_id>`. If specified, it will be checked if it exists in Jenkins and that there is nothing queued to execute. |
| 74 | +- `tn_id`: the identifier of the trial network received in the [POST request](#create-trial-network). |
| 75 | + |
| 76 | +## Purge trial network |
| 77 | + |
| 78 | +Once logged into TNLCM, the trial network has been created, deployed and destroyed, execute the DELETE request to purge a trial network: |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +Fill in the following fields: |
| 83 | + |
| 84 | +- `tn_id`: the identifier of the trial network received in the [POST request](#create-trial-network). |
0 commit comments