diff options
author | SantoshB <santosh.bayas@amdocs.com> | 2020-09-10 17:32:12 +0530 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2020-10-12 06:20:07 +0000 |
commit | 70902ea6a8086368524fef892ad52a951138e7c1 (patch) | |
tree | 026658baa86ac999ee737751b0e7fbf4f709eeef | |
parent | f8a43939aff21f0340ed3c1bcae467ce5900f791 (diff) |
Improved CDS Health Check
Issue-ID: CCSDK-2768
Change-Id: Idbdd01f8a4fde657140e4cc3889936bff1f12a36
Signed-off-by: SantoshB <santosh.bayas@amdocs.com>
-rwxr-xr-x | robot/assets/cds/bootstrap.json | 5 | ||||
-rwxr-xr-x | robot/assets/cds/cba.zip | bin | 0 -> 3514 bytes | |||
-rwxr-xr-x | robot/assets/cds/cba_process.json | 20 | ||||
-rwxr-xr-x | robot/assets/cds/create_dictionary.json | 25 | ||||
-rw-r--r-- | robot/resources/cds_interface.robot | 92 | ||||
-rw-r--r-- | robot/testsuites/health-check.robot | 11 |
6 files changed, 149 insertions, 4 deletions
diff --git a/robot/assets/cds/bootstrap.json b/robot/assets/cds/bootstrap.json new file mode 100755 index 00000000..45c34db9 --- /dev/null +++ b/robot/assets/cds/bootstrap.json @@ -0,0 +1,5 @@ +{ + "loadModelType": true, + "loadResourceDictionary": true, + "loadCBA": false +} diff --git a/robot/assets/cds/cba.zip b/robot/assets/cds/cba.zip Binary files differnew file mode 100755 index 00000000..71e8d02f --- /dev/null +++ b/robot/assets/cds/cba.zip diff --git a/robot/assets/cds/cba_process.json b/robot/assets/cds/cba_process.json new file mode 100755 index 00000000..e55073e6 --- /dev/null +++ b/robot/assets/cds/cba_process.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "test101", + "blueprintVersion": "1.0.1", + "actionName": "helloworld" + }, + "payload": { + "helloworld-request": { + "template-prefix": [ + "hello-world" + ] + } + }, + "commonHeader": { + "subRequestId": "654-654", + "requestId": "654321", + "originatorId": "CDS" + } +} diff --git a/robot/assets/cds/create_dictionary.json b/robot/assets/cds/create_dictionary.json new file mode 100755 index 00000000..d3e50837 --- /dev/null +++ b/robot/assets/cds/create_dictionary.json @@ -0,0 +1,25 @@ +{ + "tags": "restmock", + "name": "restmock", + "property": { + "description": "calls a rest mock", + "type": "string" + }, + "updated-by": "titans", + "sources": { + "rest": { + "type": "source-rest", + "properties": { + "type": "json", + "verb": "GET", + "url-path": "/test", + "endpoint-selector": "rest-endpoint", + "path": "", + "input-key-mapping": {}, + "output-key-mapping": { + "res": "myvalue" + } + } + } + } +} diff --git a/robot/resources/cds_interface.robot b/robot/resources/cds_interface.robot index ac92d5dc..358ef64e 100644 --- a/robot/resources/cds_interface.robot +++ b/robot/resources/cds_interface.robot @@ -2,14 +2,30 @@ Documentation The main interface for interacting with CDS. It handles low level stuff like managing the http request library and CDS required fields Library RequestsLibrary Resource global_properties.robot +Library SSHLibrary +Library OperatingSystem +Library String *** Variables *** ${CDS_HEALTH_CHECK_PATH} /api/v1/execution-service/health-check ${CDS_HEALTH_ENDPOINT} ${GLOBAL_CCSDK_CDS_SERVER_PROTOCOL}://${GLOBAL_INJECTED_CCSDK_CDS_BLUEPRINT_PROCESSOR_IP_ADDR}:${GLOBAL_CCSDK_CDS_HEALTH_SERVER_PORT} - +${CDS_CREATE_DATA_DICTIONARY_ENDPOINT} /api/v1/dictionary/definition +${CDS_RETRIEVE_DATA_DICTIONARY_ENDPOINT} /api/v1/dictionary/search/ +${CDS_BOOTSTRAP_ENDPOINT} /api/v1/blueprint-model/bootstrap +${CDS_CBA_ENRICH_ENDPOINT} /api/v1/blueprint-model/enrich +${CDS_CBA_PUBLISH_ENDPOINT} /api/v1/blueprint-model/publish +${CDS_CBA_PROCESS_API_ENDPOINT} /api/v1/execution-service/process +${CDS_CBA_DELETE_ENDPOINT} /api/v1/blueprint-model/ +${CREATE_DICTIONARY_JSON_PATH} ${CURDIR}${/}../assets/cds/create_dictionary.json +${BOOTSTRAP_JSON_PATH} ${CURDIR}${/}../assets/cds/bootstrap.json +${CDS_CBA_PROCESS_FILE_PATH} ${CURDIR}${/}../assets/cds/cba_process.json +${CDS_CBA_PACKAGE_FILE} ${CURDIR}${/}../assets/cds/cba.zip +${CDS_CBA_ENRICHED_FILE} ${CURDIR}${/}../assets/cds/enriched-cba.zip +${CDS_CD_TAG} restmock +${SUCCESS} EVENT_COMPONENT_EXECUTED *** Keywords *** -Run CDS Health Check +Run CDS Basic Health Check [Documentation] Runs a CDS health check ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} @@ -18,3 +34,75 @@ Run CDS Health Check Log Received response code from cds ${resp} Log Received content from cds ${resp.content} Should Be Equal As Strings ${resp.status_code} 200 + +Run CDS Create Data Dictionary Health Check + [Documentation] Runs CDS Create Data Dictionary Health Check + ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} + ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${json} Get Binary File ${CREATE_DICTIONARY_JSON_PATH} + ${resp}= Post Request cds ${CDS_CREATE_DATA_DICTIONARY_ENDPOINT} data=${json} headers=${headers} + Log Received response code from cds ${resp} + Log Received content from cds ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + +Run CDS GET Data Dictionary Health Check + [Documentation] Runs CDS Get Data Dictionary health check + ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} + ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request cds ${CDS_RETRIEVE_DATA_DICTIONARY_ENDPOINT}${CDS_CD_TAG} headers=${headers} + Log Received response code from cds ${resp} + Log Received content from cds ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + ${res_body}= Convert to string ${resp.content} + Should Contain ${res_body} ${CDS_CD_TAG} + +Run CDS Bootstrap Health Check + [Documentation] Run CDS Bootstrap Health Check + ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} + ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${json_bootstrap} Get Binary File ${BOOTSTRAP_JSON_PATH} + ${resp}= Post Request cds ${CDS_BOOTSTRAP_ENDPOINT} data=${json_bootstrap} headers=${headers} + Log Received response code from cds ${resp} + Log Received content from cds ${resp.content} + Should Be Equal As Strings ${resp.status_code} 200 + +Run CDS Enrich CBA Health Check + [Documentation] Runs a successful CDS enrich Post requests + ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} + ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} + ${data}= Get Binary File ${CDS_CBA_PACKAGE_FILE} + ${file}= Create Dictionary file=${data} + ${resp}= Post Request cds ${CDS_CBA_ENRICH_ENDPOINT} files=${file} + Should Be Equal As Strings ${resp.status_code} 200 + Create File ${CDS_CBA_ENRICHED_FILE} ${resp.text} encoding=ISO-8859-1 + +Run CDS Publish CBA Health Check + [Documentation] Runs a publish CDS upload enriched Post requests API + ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} + ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} + ${data}= Get Binary File ${CDS_CBA_ENRICHED_FILE} + ${file}= Create Dictionary file=${data} + ${resp}= Post Request cds ${CDS_CBA_PUBLISH_ENDPOINT} files=${file} + Should Be Equal As Strings ${resp.status_code} 200 And ${resp.json()['blueprintModel']['id']}!= ${NONE} + Set Global Variable ${blueprintModel} ${resp.json()['blueprintModel']['id']} + +Run CDS Process CBA Health Check + [Documentation] Runs a process CDS enriched CBA Post requests API + ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} + ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} + ${headers}= Create Dictionary Accept=*/* Content-Type=application/json + ${file} Get Binary File ${CDS_CBA_PROCESS_FILE_PATH} + ${resp}= Post Request cds ${CDS_CBA_PROCESS_API_ENDPOINT} data=${file} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['status']['eventType']} ${SUCCESS} + +Run CDS Delete CBA Health Check + [Documentation] Runs a CDS Delete CBA Delete requests API + ${auth}= Create List ${GLOBAL_CCSDK_CDS_USERNAME} ${GLOBAL_CCSDK_CDS_PASSWORD} + ${session}= Create Session cds ${CDS_HEALTH_ENDPOINT} auth=${auth} + ${headers}= Create Dictionary Accept=*/* Content-Type=application/json + ${resp}= Delete Request cds ${CDS_CBA_DELETE_ENDPOINT}${blueprintModel} headers=${headers} + Should Be Equal As Strings ${resp.status_code} 200 diff --git a/robot/testsuites/health-check.robot b/robot/testsuites/health-check.robot index 1f5d0f07..03bd24da 100644 --- a/robot/testsuites/health-check.robot +++ b/robot/testsuites/health-check.robot @@ -335,6 +335,13 @@ Basic Modeling genericparser API Health Check [Tags] health api health-modeling Run MSB Get Request /api/parser/v1/health_check -Basic CDS Health Check +Enhanced CDS Health Check [Tags] health medium health-cds - Run CDS Health Check + Run CDS Basic Health Check + Run CDS Create Data Dictionary Health Check + Run CDS GET Data Dictionary Health Check + Run CDS Bootstrap Health Check + Run CDS Enrich CBA Health Check + Run CDS Publish CBA Health Check + Run CDS Process CBA Health Check + Run CDS Delete CBA Health Check |