Fix spelling in DCAE healthcheck service names
[testsuite.git] / robot / resources / dcae_interface.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with DCAE. It handles low level stuff like managing the http request library and DCAE required fields
3 Library               RequestsLibrary
4 Library           UUID
5 Library           OperatingSystem
6 Library           Collections
7 Resource          global_properties.robot
8
9 *** Variables ***
10 ${DCAE_HEALTH_CHECK_PATH}    /healthcheck
11 ${DCAE_ENDPOINT}     ${GLOBAL_DCAE_SERVER_PROTOCOL}://${GLOBAL_INJECTED_DCAE_IP_ADDR}:${GLOBAL_DCAE_SERVER_PORT}
12
13 *** Keywords ***
14 Run DCAE Health Check
15     [Documentation]    Runs a DCAE health check
16     ${auth}=  Create List  ${GLOBAL_DCAE_USERNAME}    ${GLOBAL_DCAE_PASSWORD}
17     Log    Creating session ${DCAE_ENDPOINT}
18     ${session}=    Create Session       dcae    ${DCAE_ENDPOINT}    auth=${auth}
19     ${uuid}=    Generate UUID
20     ${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}
21     ${resp}=    Get Request     dcae    ${DCAE_HEALTH_CHECK_PATH}     headers=${headers}
22     Log    Received response from dcae ${resp.json()}
23     Should Be Equal As Strings  ${resp.status_code}     200
24     Check DCAE Results    ${resp.json()}
25
26 Check DCAE Results
27     [Documentation]    Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN (except for the exceptions ;-)
28     [Arguments]    ${json}
29     # ${service_names} to contain only the names of services that are passing
30     ${service_names}=    Evaluate    map( lambda s: s['ServiceName'], filter(lambda s: s['Status'] == 'passing', ${json} ))
31     Should Contain Match    ${service_names}   cdap
32     Should Contain Match    ${service_names}   cdap_broker
33     Should Contain Match    ${service_names}   config_binding_service
34     Should Contain Match    ${service_names}   deployment_handler
35     Should Contain Match    ${service_names}   inventory
36     Should Contain Match    ${service_names}   service_change_handler
37     # Should Contain Match    ${service_names}   policy_handler
38     Should Contain Match    ${service_names}   platform_dockerhost
39     Should Contain Match    ${service_names}   component_dockerhost
40     Should Contain Match    ${service_names}   cloudify_manager
41     Should Contain Match    ${service_names}   regexp=.*dcaegen2-collectors-ves
42     Should Contain Match    ${service_names}   regexp=.*cdap_app_cdap_app_tca
43     Should Contain Match    ${service_names}   regexp=.*dcae-analytics-holmes-rule-management
44     Should Contain Match    ${service_names}   regexp=.*dcae-analytics-holmes-engine-management
45     [Return]   ${service_names}
46