Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation CPS Core - Admin REST API |
| 3 | |
| 4 | Library Collections |
| 5 | Library OperatingSystem |
| 6 | Library RequestsLibrary |
| 7 | |
| 8 | Suite Setup Create Session CPS_HOST ${CPS_HOST} |
| 9 | |
| 10 | *** Variables *** |
| 11 | |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 12 | ${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE= |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 13 | ${basePath} /cps/api |
| 14 | ${dataspaceName} CSIT-Dataspace |
| 15 | ${schemaSetName} CSIT-SchemaSet |
| 16 | ${anchorName} CSIT-Anchor |
Bruno Sakoto | ddedbd1 | 2021-05-05 08:11:19 -0400 | [diff] [blame^] | 17 | ${ranDataspaceName} NFP-Operational |
| 18 | ${ranSchemaSetName} cps-ran-schema-model |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 19 | |
| 20 | *** Test Cases *** |
| 21 | Create Dataspace |
| 22 | ${uri}= Set Variable ${basePath}/v1/dataspaces |
| 23 | ${params}= Create Dictionary dataspace-name=${dataspaceName} |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 24 | ${headers}= Create Dictionary Authorization=${auth} |
| 25 | ${response}= POST On Session CPS_HOST ${uri} params=${params} headers=${headers} |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 26 | Should Be Equal As Strings ${response.status_code} 201 |
| 27 | |
| 28 | Create Schema Set from YANG file |
| 29 | ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets |
| 30 | ${params}= Create Dictionary schema-set-name=${schemaSetName} |
| 31 | ${fileData}= Get Binary File ${DATADIR}${/}test-tree.yang |
| 32 | ${fileTuple}= Create List test.yang ${fileData} application/zip |
| 33 | &{files}= Create Dictionary file=${fileTuple} |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 34 | ${headers}= Create Dictionary Authorization=${auth} |
| 35 | ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params} headers=${headers} |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 36 | Should Be Equal As Strings ${response.status_code} 201 |
| 37 | |
| 38 | Create Schema Set from ZIP file |
| 39 | ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets |
| 40 | ${params}= Create Dictionary schema-set-name=ZipTestSchemaSet |
| 41 | ${fileData}= Get Binary File ${DATADIR}${/}yang-resources.zip |
| 42 | ${fileTuple}= Create List test.zip ${fileData} application/zip |
| 43 | &{files}= Create Dictionary file=${fileTuple} |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 44 | ${headers}= Create Dictionary Authorization=${auth} |
| 45 | ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params} headers=${headers} |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 46 | Should Be Equal As Strings ${response.status_code} 201 |
| 47 | |
| 48 | Get Schema Set info |
| 49 | ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets/${schemaSetName} |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 50 | ${headers}= Create Dictionary Authorization=${auth} |
| 51 | ${response}= Get On Session CPS_HOST ${uri} headers=${headers} expected_status=200 |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 52 | ${responseJson}= Set Variable ${response.json()} |
| 53 | Should Be Equal As Strings ${responseJson['name']} ${schemaSetName} |
| 54 | Should Be Equal As Strings ${responseJson['dataspaceName']} ${dataspaceName} |
| 55 | |
| 56 | Create Anchor |
| 57 | ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors |
| 58 | ${params}= Create Dictionary schema-set-name=${schemaSetName} anchor-name=${anchorName} |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 59 | ${headers}= Create Dictionary Authorization=${auth} |
| 60 | ${response}= POST On Session CPS_HOST ${uri} params=${params} headers=${headers} |
Bruno Sakoto | ddedbd1 | 2021-05-05 08:11:19 -0400 | [diff] [blame^] | 61 | Should Be Equal As Strings ${response.status_code} 201 |
| 62 | |
| 63 | Get CPS RAN Schema Set info |
| 64 | ${uri}= Set Variable ${basePath}/v1/dataspaces/${ranDataspaceName}/schema-sets/${ranSchemaSetName} |
| 65 | ${headers}= Create Dictionary Authorization=${auth} |
| 66 | ${response}= Get On Session CPS_HOST ${uri} headers=${headers} expected_status=200 |
| 67 | ${responseJson}= Set Variable ${response.json()} |
| 68 | Should Be Equal As Strings ${responseJson['name']} ${ranSchemaSetName} |
| 69 | Should Be Equal As Strings ${responseJson['dataspaceName']} ${ranDataspaceName} |