From 70902ea6a8086368524fef892ad52a951138e7c1 Mon Sep 17 00:00:00 2001 From: SantoshB Date: Thu, 10 Sep 2020 17:32:12 +0530 Subject: [PATCH] Improved CDS Health Check Issue-ID: CCSDK-2768 Change-Id: Idbdd01f8a4fde657140e4cc3889936bff1f12a36 Signed-off-by: SantoshB --- robot/assets/cds/bootstrap.json | 5 ++ robot/assets/cds/cba.zip | Bin 0 -> 3514 bytes robot/assets/cds/cba_process.json | 20 +++++++ robot/assets/cds/create_dictionary.json | 25 +++++++++ robot/resources/cds_interface.robot | 92 +++++++++++++++++++++++++++++++- robot/testsuites/health-check.robot | 11 +++- 6 files changed, 149 insertions(+), 4 deletions(-) create mode 100755 robot/assets/cds/bootstrap.json create mode 100755 robot/assets/cds/cba.zip create mode 100755 robot/assets/cds/cba_process.json create mode 100755 robot/assets/cds/create_dictionary.json 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 new file mode 100755 index 0000000000000000000000000000000000000000..71e8d02f71167e3be931eedde46cef191ecc5709 GIT binary patch literal 3514 zcmaJ@3piA17@lEtVag?o+(VmW7^0O@C1pYOG|5k`q3pifzWq66>C>_6x! z9w5_51O^bOYY)argHM(qI>ManwzvAzM8IFd;H5S%&L1F=sF+|Xo#cxl6KFIdWuMOe zKq@8S#DEauJIE*qV%DF3O&naj?0-QRvs=&!VvxpnKB}*G)@;&kuyW|n;FIyU=Vx>3<6953(#`7cfsOhE*LZkUMmHId24mZ;94N*(efy)#L>4JRogtz z{ZevI&g@0MomvMg(&@mt)z3aQmzT%bB$jtm{esuOfBMGy5NdZ-i~5*?QG2JfwrmEc z)we7C^x+{>Np#hFk-{`*jw`_FODztN%$@2h&RoPjKlJ*BRqB)E@o@2A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~UYs_AksRVZI-G z`|19(FD?gk^iVxdub`e6Z5_SStUIOn`}DKvjpi~36ePorrcId|=f*0Ed978c*&u>8 za%))Bxa)FL4D+MO^sAd2M=>mVOJ-mN`H;$|8jIRNbmqFwx-E&)S8uW0PI?^O_uKHk zhMbM(5=>j#dW#fo$FaR%F*0!^vYYb&deXeCGX40-jJ*v~NCm+!o1h7R&K~rU;NM`D zKop_Mdxk{FAu16kRyiK*L{3HqWqQPRB8iR>E0rTVk$mi*8HYJ+2uBmVzT1tT*$6l% zBISkU$Jh=e;Z>KIImnsD7UUH48E{VWPdVYPV;-mZD=&zXDf@!Q`Sn^POy|#9e~uH% zVHLzV-~4d zjW467mL?!WaPq=sB>ac_|8p45nv?aQw}sV-G|`g~gVYR21i)DNY6M5h94pjinxI9P z8y#@u>6-zv&{3JwGZP;ofV|M#h|kLt4u(8Cl;8xIkEi%`pM9yBUV{_xTUc;(&23#3 v+&W8;V8I}R^KA={p!kM&A~&4J@eZW(n$TH6B9Kc$EC>JCpj#J)MlRxC5&DgP literal 0 HcmV?d00001 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 -- 2.16.6