diff options
Diffstat (limited to 'test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot')
-rw-r--r-- | test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot index 98b341529..6820050fe 100644 --- a/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot +++ b/test/csit/tests/dcaegen2/testcases/resources/dcae_keywords.robot @@ -1,4 +1,4 @@ - *** Settings *** +*** Settings *** Documentation The main interface for interacting with DCAE. It handles low level stuff like managing the http request library and DCAE required fields Library RequestsLibrary Library DcaeLibrary @@ -6,9 +6,23 @@ Library OperatingSystem Library Collections Variables ../resources/DcaeVariables.py Resource ../resources/dcae_properties.robot + *** Variables *** ${DCAE_HEALTH_CHECK_BODY} %{WORKSPACE}/test/csit/tests/dcae/testcases/assets/json_events/dcae_healthcheck.json + *** Keywords *** +Create sessions + [Documentation] Create all required sessions + Create Session dcae_vesc_url ${VESC_URL} + Set Suite Variable ${suite_dcae_vesc_url_session} dcae_vesc_url + ${auth}= Create List ${VESC_HTTPS_USER} ${VESC_HTTPS_PD} + Create Session dcae_vesc_url_https ${VESC_URL_HTTPS} auth=${auth} disable_warnings=1 + Set Suite Variable ${suite_dcae_vesc_url_https_session} dcae_vesc_url_https + +Create header + ${headers}= Create Dictionary Content-Type=application/json + Set Suite Variable ${suite_headers} ${headers} + Get DCAE Nodes [Documentation] Get DCAE Nodes from Consul Catalog #Log Creating session ${GLOBAL_DCAE_CONSUL_URL} @@ -22,7 +36,8 @@ Get DCAE Nodes ${NodeListLength}= Get Length ${NodeList} ${len}= Get Length ${NodeList} Should Not Be Equal As Integers ${len} 0 - [return] ${NodeList} + [Return] ${NodeList} + DCAE Node Health Check [Documentation] Perform DCAE Node Health Check [Arguments] ${NodeName} @@ -38,18 +53,22 @@ DCAE Node Health Check Should Not Be Equal As Integers ${len} 0 DCAE Check Health Status ${NodeName} ${StatusList[0]} Serf Health Status #Run Keyword if ${len} > 1 DCAE Check Health Status ${NodeName} ${StatusList[1]} Serf Health Status + DCAE Check Health Status [Arguments] ${NodeName} ${ItemStatus} ${CheckType} Should Be Equal As Strings ${ItemStatus} passing Log Node: ${NodeName} ${CheckType} check pass ok + VES Collector Suite Setup DMaaP [Documentation] Start DMaaP Mockup Server ${ret}= Setup DMaaP Server Should Be Equal As Strings ${ret} true + VES Collector Suite Shutdown DMaaP [Documentation] Shutdown DMaaP Mockup Server ${ret}= Shutdown DMaap Should Be Equal As Strings ${ret} true + Check DCAE Results [Documentation] Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN [Arguments] ${json} @@ -65,6 +84,7 @@ Check DCAE Results \ ${cells}= Get From Dictionary ${row} cells \ ${dict}= Make A Dictionary ${cells} ${columns} \ Dictionary Should Contain Item ${dict} healthTestStatus GREEN + Make A Dictionary [Documentation] Given a list of column names and a list of dictionaries, map columname=value [Arguments] ${columns} ${names} ${valuename}=value @@ -77,57 +97,49 @@ Make A Dictionary \ ${value}= Get From Dictionary ${valued} ${valueName} \ Set To Dictionary ${dict} ${name} ${value} [Return] ${dict} -Get Event Data From File - [Arguments] ${jsonfile} - ${data}= OperatingSystem.Get File ${jsonfile} - #Should Not Be_Equal ${data} None - [return] ${data} + Json String To Dictionary [Arguments] ${json_string} ${json_dict}= evaluate json.loads('''${json_string}''') json - [return] ${json_dict} + [Return] ${json_dict} + Dictionary To Json String [Arguments] ${json_dict} ${json_string}= evaluate json.dumps(${json_dict}) json - [return] ${json_string} + [Return] ${json_string} + Get DCAE Service Component Status [Documentation] Get the status of a DCAE Service Component [Arguments] ${url} ${urlpath} ${usr} ${passwd} ${auth}= Create List ${usr} ${passwd} ${session}= Create Session dcae-service-component ${url} auth=${auth} ${resp}= Get Request dcae-service-component ${urlpath} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector No Auth [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} - Log Creating session ${url} - ${session}= Create Session dcaegen2-d1 ${url} - ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Post Request ${suite_dcae_vesc_url_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd} - ${auth}= Create List ${user} ${pd} - Log Creating session ${url} - ${session}= Create Session dcaegen2-d1 ${url} auth=${auth} disable_warnings=1 - ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Post Request ${suite_dcae_vesc_url_https_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector With Put Method [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} ${user} ${pd} - ${auth}= Create List ${user} ${pd} - Log Creating session ${url} - ${session}= Create Session dcae-d1 ${url} auth=${auth} - ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Put Request ${suite_dcae_vesc_url_https_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} + Publish Event To VES Collector With Put Method No Auth [Documentation] Send an event to VES Collector - [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata} - Log Creating session ${url} - ${session}= Create Session dcae-d1 ${url} - ${resp}= Put Request dcae-d1 ${evtpath} data=${evtdata} headers=${httpheaders} + [Arguments] ${evtpath} ${evtdata} + ${resp}= Put Request ${suite_dcae_vesc_url_session} ${evtpath} data=${evtdata} headers=${suite_headers} #Log Received response from dcae ${resp.json()} - [return] ${resp} + [Return] ${resp} |