Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields |
| 3 | Library RequestsLibrary |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 4 | Resource global_properties.robot |
SantoshB | 70902ea | 2020-09-10 17:32:12 +0530 | [diff] [blame] | 5 | Library SSHLibrary |
| 6 | Library OperatingSystem |
| 7 | Library String |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 8 | |
| 9 | *** Variables *** |
mrichomme | 3256fa2 | 2020-03-09 11:23:35 +0100 | [diff] [blame] | 10 | ${CDS_HEALTH_CHECK_PATH} /api/v1/execution-service/health-check |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 11 | ${CDS_HEALTH_ENDPOINT} ${GLOBAL_CCSDK_CDS_SERVER_PROTOCOL}://${GLOBAL_INJECTED_CCSDK_CDS_BLUEPRINT_PROCESSOR_IP_ADDR}:${GLOBAL_CCSDK_CDS_HEALTH_SERVER_PORT} |
SantoshB | 70902ea | 2020-09-10 17:32:12 +0530 | [diff] [blame] | 12 | ${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 Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 26 | |
| 27 | *** Keywords *** |
SantoshB | 70902ea | 2020-09-10 17:32:12 +0530 | [diff] [blame] | 28 | Run CDS Basic Health Check |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 29 | [Documentation] Runs a CDS health check |
| 30 | ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} |
Abdelmuhaimen Seaudi | 756eb6a | 2019-08-10 08:20:52 +0000 | [diff] [blame] | 31 | ${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} |
mrichomme | 3256fa2 | 2020-03-09 11:23:35 +0100 | [diff] [blame] | 36 | Should Be Equal As Strings ${resp.status_code} 200 |
SantoshB | 70902ea | 2020-09-10 17:32:12 +0530 | [diff] [blame] | 37 | |
| 38 | Run 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 | |
| 49 | Run 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 | |
| 61 | Run 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 | |
| 72 | Run 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 | |
| 82 | Run 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 | |
| 92 | Run 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 | |
| 102 | Run 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 |