blob: 93818070ba22ed780a23e05018e68dfcd1d13d71 [file] [log] [blame]
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +02001*** Settings ***
2Documentation CPS Core - Admin REST API
3
4Library Collections
5Library OperatingSystem
6Library RequestsLibrary
7
8Suite Setup Create Session CPS_HOST ${CPS_HOST}
9
10*** Variables ***
11
Bruno Sakotof05a5032021-03-03 18:27:54 -050012${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE=
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020013${basePath} /cps/api
14${dataspaceName} CSIT-Dataspace
15${schemaSetName} CSIT-SchemaSet
16${anchorName} CSIT-Anchor
Bruno Sakotoddedbd12021-05-05 08:11:19 -040017${ranDataspaceName} NFP-Operational
18${ranSchemaSetName} cps-ran-schema-model
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020019
20*** Test Cases ***
21Create Dataspace
22 ${uri}= Set Variable ${basePath}/v1/dataspaces
23 ${params}= Create Dictionary dataspace-name=${dataspaceName}
Bruno Sakotof05a5032021-03-03 18:27:54 -050024 ${headers}= Create Dictionary Authorization=${auth}
25 ${response}= POST On Session CPS_HOST ${uri} params=${params} headers=${headers}
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020026 Should Be Equal As Strings ${response.status_code} 201
27
28Create 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 Sakotof05a5032021-03-03 18:27:54 -050034 ${headers}= Create Dictionary Authorization=${auth}
35 ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params} headers=${headers}
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020036 Should Be Equal As Strings ${response.status_code} 201
37
38Create 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 Sakotof05a5032021-03-03 18:27:54 -050044 ${headers}= Create Dictionary Authorization=${auth}
45 ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params} headers=${headers}
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020046 Should Be Equal As Strings ${response.status_code} 201
47
48Get Schema Set info
49 ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets/${schemaSetName}
Bruno Sakotof05a5032021-03-03 18:27:54 -050050 ${headers}= Create Dictionary Authorization=${auth}
51 ${response}= Get On Session CPS_HOST ${uri} headers=${headers} expected_status=200
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020052 ${responseJson}= Set Variable ${response.json()}
53 Should Be Equal As Strings ${responseJson['name']} ${schemaSetName}
54 Should Be Equal As Strings ${responseJson['dataspaceName']} ${dataspaceName}
55
56Create Anchor
57 ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors
58 ${params}= Create Dictionary schema-set-name=${schemaSetName} anchor-name=${anchorName}
Bruno Sakotof05a5032021-03-03 18:27:54 -050059 ${headers}= Create Dictionary Authorization=${auth}
60 ${response}= POST On Session CPS_HOST ${uri} params=${params} headers=${headers}
Bruno Sakotoddedbd12021-05-05 08:11:19 -040061 Should Be Equal As Strings ${response.status_code} 201
62
63Get 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}