blob: 358ef64ee5323ab91b5eb5664561bb56c071e155 [file] [log] [blame]
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +00001*** Settings ***
2Documentation The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields
3Library RequestsLibrary
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +00004Resource global_properties.robot
SantoshB70902ea2020-09-10 17:32:12 +05305Library SSHLibrary
6Library OperatingSystem
7Library String
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +00008
9*** Variables ***
mrichomme3256fa22020-03-09 11:23:35 +010010${CDS_HEALTH_CHECK_PATH} /api/v1/execution-service/health-check
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +000011${CDS_HEALTH_ENDPOINT} ${GLOBAL_CCSDK_CDS_SERVER_PROTOCOL}://${GLOBAL_INJECTED_CCSDK_CDS_BLUEPRINT_PROCESSOR_IP_ADDR}:${GLOBAL_CCSDK_CDS_HEALTH_SERVER_PORT}
SantoshB70902ea2020-09-10 17:32:12 +053012${CDS_CREATE_DATA_DICTIONARY_ENDPOINT} /api/v1/dictionary/definition
13${CDS_RETRIEVE_DATA_DICTIONARY_ENDPOINT} /api/v1/dictionary/search/
14${CDS_BOOTSTRAP_ENDPOINT} /api/v1/blueprint-model/bootstrap
15${CDS_CBA_ENRICH_ENDPOINT} /api/v1/blueprint-model/enrich
16${CDS_CBA_PUBLISH_ENDPOINT} /api/v1/blueprint-model/publish
17${CDS_CBA_PROCESS_API_ENDPOINT} /api/v1/execution-service/process
18${CDS_CBA_DELETE_ENDPOINT} /api/v1/blueprint-model/
19${CREATE_DICTIONARY_JSON_PATH} ${CURDIR}${/}../assets/cds/create_dictionary.json
20${BOOTSTRAP_JSON_PATH} ${CURDIR}${/}../assets/cds/bootstrap.json
21${CDS_CBA_PROCESS_FILE_PATH} ${CURDIR}${/}../assets/cds/cba_process.json
22${CDS_CBA_PACKAGE_FILE} ${CURDIR}${/}../assets/cds/cba.zip
23${CDS_CBA_ENRICHED_FILE} ${CURDIR}${/}../assets/cds/enriched-cba.zip
24${CDS_CD_TAG} restmock
25${SUCCESS} EVENT_COMPONENT_EXECUTED
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +000026
27*** Keywords ***
SantoshB70902ea2020-09-10 17:32:12 +053028Run CDS Basic Health Check
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +000029 [Documentation] Runs a CDS health check
30 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
Abdelmuhaimen Seaudi756eb6a2019-08-10 08:20:52 +000031 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
32 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
33 ${resp}= Get Request cds ${CDS_HEALTH_CHECK_PATH} headers=${headers}
34 Log Received response code from cds ${resp}
35 Log Received content from cds ${resp.content}
mrichomme3256fa22020-03-09 11:23:35 +010036 Should Be Equal As Strings ${resp.status_code} 200
SantoshB70902ea2020-09-10 17:32:12 +053037
38Run CDS Create Data Dictionary Health Check
39 [Documentation] Runs CDS Create Data Dictionary Health Check
40 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
41 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
42 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
43 ${json} Get Binary File ${CREATE_DICTIONARY_JSON_PATH}
44 ${resp}= Post Request cds ${CDS_CREATE_DATA_DICTIONARY_ENDPOINT} data=${json} headers=${headers}
45 Log Received response code from cds ${resp}
46 Log Received content from cds ${resp.content}
47 Should Be Equal As Strings ${resp.status_code} 200
48
49Run CDS GET Data Dictionary Health Check
50 [Documentation] Runs CDS Get Data Dictionary health check
51 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
52 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
53 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
54 ${resp}= Get Request cds ${CDS_RETRIEVE_DATA_DICTIONARY_ENDPOINT}${CDS_CD_TAG} headers=${headers}
55 Log Received response code from cds ${resp}
56 Log Received content from cds ${resp.content}
57 Should Be Equal As Strings ${resp.status_code} 200
58 ${res_body}= Convert to string ${resp.content}
59 Should Contain ${res_body} ${CDS_CD_TAG}
60
61Run CDS Bootstrap Health Check
62 [Documentation] Run CDS Bootstrap Health Check
63 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
64 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
65 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
66 ${json_bootstrap} Get Binary File ${BOOTSTRAP_JSON_PATH}
67 ${resp}= Post Request cds ${CDS_BOOTSTRAP_ENDPOINT} data=${json_bootstrap} headers=${headers}
68 Log Received response code from cds ${resp}
69 Log Received content from cds ${resp.content}
70 Should Be Equal As Strings ${resp.status_code} 200
71
72Run CDS Enrich CBA Health Check
73 [Documentation] Runs a successful CDS enrich Post requests
74 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
75 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
76 ${data}= Get Binary File ${CDS_CBA_PACKAGE_FILE}
77 ${file}= Create Dictionary file=${data}
78 ${resp}= Post Request cds ${CDS_CBA_ENRICH_ENDPOINT} files=${file}
79 Should Be Equal As Strings ${resp.status_code} 200
80 Create File ${CDS_CBA_ENRICHED_FILE} ${resp.text} encoding=ISO-8859-1
81
82Run CDS Publish CBA Health Check
83 [Documentation] Runs a publish CDS upload enriched Post requests API
84 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
85 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
86 ${data}= Get Binary File ${CDS_CBA_ENRICHED_FILE}
87 ${file}= Create Dictionary file=${data}
88 ${resp}= Post Request cds ${CDS_CBA_PUBLISH_ENDPOINT} files=${file}
89 Should Be Equal As Strings ${resp.status_code} 200 And ${resp.json()['blueprintModel']['id']}!= ${NONE}
90 Set Global Variable ${blueprintModel} ${resp.json()['blueprintModel']['id']}
91
92Run CDS Process CBA Health Check
93 [Documentation] Runs a process CDS enriched CBA Post requests API
94 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
95 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
96 ${headers}= Create Dictionary Accept=*/* Content-Type=application/json
97 ${file} Get Binary File ${CDS_CBA_PROCESS_FILE_PATH}
98 ${resp}= Post Request cds ${CDS_CBA_PROCESS_API_ENDPOINT} data=${file} headers=${headers}
99 Should Be Equal As Strings ${resp.status_code} 200
100 Should Be Equal As Strings ${resp.json()['status']['eventType']} ${SUCCESS}
101
102Run CDS Delete CBA Health Check
103 [Documentation] Runs a CDS Delete CBA Delete requests API
104 ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD}
105 ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth}
106 ${headers}= Create Dictionary Accept=*/* Content-Type=application/json
107 ${resp}= Delete Request cds ${CDS_CBA_DELETE_ENDPOINT}${blueprintModel} headers=${headers}
108 Should Be Equal As Strings ${resp.status_code} 200