diff options
Diffstat (limited to 'robot/resources/dcae_interface.robot')
-rw-r--r-- | robot/resources/dcae_interface.robot | 72 |
1 files changed, 19 insertions, 53 deletions
diff --git a/robot/resources/dcae_interface.robot b/robot/resources/dcae_interface.robot index 392a2b04..fafa57ab 100644 --- a/robot/resources/dcae_interface.robot +++ b/robot/resources/dcae_interface.robot @@ -7,8 +7,7 @@ Library Collections Resource global_properties.robot *** Variables *** -${DCAE_HEALTH_CHECK_BODY} robot/assets/dcae/dcae_healthcheck.json -${DCAE_HEALTH_CHECK_PATH} /gui +${DCAE_HEALTH_CHECK_PATH} /healthcheck ${DCAE_ENDPOINT} ${GLOBAL_DCAE_SERVER_PROTOCOL}://${GLOBAL_INJECTED_DCAE_IP_ADDR}:${GLOBAL_DCAE_SERVER_PORT} *** Keywords *** @@ -18,9 +17,8 @@ Run DCAE Health Check Log Creating session ${DCAE_ENDPOINT} ${session}= Create Session dcae ${DCAE_ENDPOINT} auth=${auth} ${uuid}= Generate UUID - ${data}= OperatingSystem.Get File ${DCAE_HEALTH_CHECK_BODY} ${headers}= Create Dictionary X-ECOMP-Client-Version=ONAP-R2 action=getTable Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} - ${resp}= Put Request dcae ${DCAE_HEALTH_CHECK_PATH} data=${data} headers=${headers} + ${resp}= Get Request dcae ${DCAE_HEALTH_CHECK_PATH} headers=${headers} Log Received response from dcae ${resp.json()} Should Be Equal As Strings ${resp.status_code} 200 Check DCAE Results ${resp.json()} @@ -28,53 +26,21 @@ Run DCAE Health Check Check DCAE Results [Documentation] Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN (except for the exceptions ;-) [Arguments] ${json} - @{rows}= Get From Dictionary ${json['returns']} rows - @{headers}= Get From Dictionary ${json['returns']} columns + # ${service_names} to contain only the names of services that are passing + ${service_names}= Evaluate map( lambda s: s['ServiceName'], filter(lambda s: s['Status'] == 'passing', ${json} )) + Should Contain Match ${service_names} cdap + Should Contain Match ${service_names} cdap_broker + Should Contain Match ${service_names} config_binding_service + Should Contain Match ${service_names} deployment_handler + Should Contain Match ${service_names} inventory + Should Contain Match ${service_names} service-change-handler + # Should Contain Match ${service_names} policy_handler + Should Contain Match ${service_names} platform_dockerhost + Should Contain Match ${service_names} component_dockerhost + Should Contain Match ${service_names} cloudify_manager + Should Contain Match ${service_names} regexp=.*dcaegen2-collectors-ves + Should Contain Match ${service_names} regexp=.*cdap_app_cdap_app_tca + Should Contain Match ${service_names} regexp=.*dcae-analytics-holmes-rule-management + Should Contain Match ${service_names} regexp=.*dcae-analytics-holmes-engine-management + [Return] ${service_names} - # Retrieve column names from headers - ${columns}= Create List - :for ${header} in @{headers} - \ ${colName}= Get From Dictionary ${header} colName - \ Append To List ${columns} ${colName} - - # Process each row making sure status=GREEN - :for ${row} in @{rows} - \ ${cells}= Get From Dictionary ${row} cells - \ ${dict}= Make A Dictionary ${cells} ${columns} - \ Is DCAE Status Valid ${dict} - -Is DCAE Status Valid - [Arguments] ${dict} - # If it is GREEN we are done. - ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Item ${dict} healthTestStatus GREEN - Return From Keyword If '${status}' == 'PASS' - - # Check for Exceptions - # Only 1 so far - ${status} ${value}= Run Keyword And Ignore Error Check For Exception ${dict} vm-controller UNDEPLOYED YELLOW - Return From Keyword If '${status}' == 'PASS' - - # Status not GREEN or is not an exception - Fail Health check failed ${dict} - -Check for Exception - [Arguments] ${dict} ${service} ${status} ${healthTestStatus} - # Test the significant attributes to see if this is a legit exception - ${exception}= Copy Dictionary ${dict} - Set To Dictionary ${exception} service=${service} status=${status} healthTestStatus=${healthTestStatus} - Dictionaries Should Be Equal ${dict} ${exception} - - - -Make A Dictionary - [Documentation] Given a list of column names and a list of dictionaries, map columname=value - [Arguments] ${columns} ${names} ${valuename}=value - ${dict}= Create Dictionary - ${collength}= Get Length ${columns} - ${namelength}= Get Length ${names} - :for ${index} in range 0 ${collength} - \ ${name}= Evaluate ${names}[${index}] - \ ${valued}= Evaluate ${columns}[${index}] - \ ${value}= Get From Dictionary ${valued} ${valueName} - \ Set To Dictionary ${dict} ${name} ${value} - [Return] ${dict}
\ No newline at end of file |