blob: 446a59b86d887b7521b182b66ca9911b0da7ac5b [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
12${basePath} /cps/api
13${dataspaceName} CSIT-Dataspace
14${schemaSetName} CSIT-SchemaSet
15${anchorName} CSIT-Anchor
16
17*** Test Cases ***
18Create Dataspace
19 ${uri}= Set Variable ${basePath}/v1/dataspaces
20 ${params}= Create Dictionary dataspace-name=${dataspaceName}
21 ${response}= POST On Session CPS_HOST ${uri} params=${params}
22 Should Be Equal As Strings ${response.status_code} 201
23
24Create Schema Set from YANG file
25 ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets
26 ${params}= Create Dictionary schema-set-name=${schemaSetName}
27 ${fileData}= Get Binary File ${DATADIR}${/}test-tree.yang
28 ${fileTuple}= Create List test.yang ${fileData} application/zip
29 &{files}= Create Dictionary file=${fileTuple}
30 ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params}
31 Should Be Equal As Strings ${response.status_code} 201
32
33Create Schema Set from ZIP file
34 ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets
35 ${params}= Create Dictionary schema-set-name=ZipTestSchemaSet
36 ${fileData}= Get Binary File ${DATADIR}${/}yang-resources.zip
37 ${fileTuple}= Create List test.zip ${fileData} application/zip
38 &{files}= Create Dictionary file=${fileTuple}
39 ${response}= POST On Session CPS_HOST ${uri} files=${files} params=${params}
40 Should Be Equal As Strings ${response.status_code} 201
41
42Get Schema Set info
43 ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/schema-sets/${schemaSetName}
44 ${response}= Get On Session CPS_HOST ${uri} expected_status=200
45 ${responseJson}= Set Variable ${response.json()}
46 Should Be Equal As Strings ${responseJson['name']} ${schemaSetName}
47 Should Be Equal As Strings ${responseJson['dataspaceName']} ${dataspaceName}
48
49Create Anchor
50 ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors
51 ${params}= Create Dictionary schema-set-name=${schemaSetName} anchor-name=${anchorName}
52 ${response}= POST On Session CPS_HOST ${uri} params=${params}
53 Should Be Equal As Strings ${response.status_code} 201