X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=tests%2Fdcaegen2%2Ftestcases%2Fresources%2Fdcae_keywords.robot;h=660f1451cdf8b7375f756faa3061c7d9ae83906d;hb=322b8e8df0ecf9deabba4cea7edf24e14ce4c5b5;hp=0735ce8e13fe4904c669440374b1b603b6d573f0;hpb=e5660b6e427feee59fa34832cc798cf106ae5cbd;p=integration%2Fcsit.git diff --git a/tests/dcaegen2/testcases/resources/dcae_keywords.robot b/tests/dcaegen2/testcases/resources/dcae_keywords.robot index 0735ce8e..660f1451 100644 --- a/tests/dcaegen2/testcases/resources/dcae_keywords.robot +++ b/tests/dcaegen2/testcases/resources/dcae_keywords.robot @@ -1,13 +1,14 @@ *** 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 robot_library.DcaeLibrary +Library robot_library.DmaapLibrary +Library robot_library.CertsLibrary Library RequestsLibrary -Library DcaeLibrary Library OperatingSystem Library Collections -Library CertsLibrary -Variables ../resources/DcaeVariables.py +Variables ./robot_library/DcaeVariables.py Resource ../../../common.robot -Resource ../resources/dcae_properties.robot +Resource ./dcae_properties.robot *** Keywords *** Create sessions @@ -139,21 +140,30 @@ Publish Event To VES Collector With Put Method ${resp}= Put Request ${session} ${evtpath} data=${evtdata} headers=${suite_headers} [Return] ${resp} +Send Request And Validate Response And Error Message + [Documentation] Post single event to passed url and validate received response code and content + [Arguments] ${keyword} ${session} ${evtpath} ${evtjson} ${resp_code} ${msg_content} + ${resp}= Send Request And Validate Response ${keyword} ${session} ${evtpath} ${evtjson} ${resp_code} + ${error_message}= Set Variable ${resp.json()['requestError']['ServiceException']['text']} + Should Be Equal As Strings ${msg_content} ${error_message} + Send Request And Validate Response - [Documentation] Post singel event to passed url with passed data and validate received response - [Arguments] ${keyword} ${session} ${evtpath} ${evtjson} ${resp_code} ${msg_code}=None + [Documentation] Post single event to passed url with passed data and validate received response + [Arguments] ${keyword} ${session} ${evtpath} ${evtjson} ${resp_code} ${msg_code}=None ${topic}=None ${evtdata}= Get Data From File ${evtjson} ${resp}= Run Keyword ${keyword} ${session} ${evtpath} ${evtdata} Log Receive HTTPS Status code ${resp.status_code} Should Be Equal As Strings ${resp.status_code} ${resp_code} ${isEmpty}= Is Json Empty ${resp} Run Keyword If '${isEmpty}' == False Log ${resp.json()} - Run Keyword If '${msg_code}' != 'None' Check Whether Message Received ${msg_code} + Run Keyword If '${msg_code}' != 'None' Check Whether Message Received ${msg_code} ${topic} + [Return] ${resp} Check Whether Message Received - [Documentation] Validare if message has been received - [Arguments] ${msg_code} - ${ret}= DMaaP Message Receive ${msg_code} + [Documentation] Validate if message has been received + [Arguments] ${msg_code} ${topic} + ${ret}= Run Keyword If '${topic}' != 'None' DMaaP Message Receive On Topic ${msg_code} ${topic} + ... ELSE DMaaP Message Receive ${msg_code} Should Be Equal As Strings ${ret} true Send Request And Expect Error @@ -161,8 +171,9 @@ Send Request And Expect Error [Arguments] ${keyword} ${session} ${evtpath} ${evtjson} ${error_type} @{error_content} ${evtdata}= Get Data From File ${evtjson} ${err_msg}= Run Keyword And Expect Error ${error_type} ${keyword} ${session} ${evtpath} ${evtdata} - :FOR ${content} IN @{error_content} - \ Should Contain ${err_msg} ${content} + FOR ${content} IN @{error_content} + Should Contain ${err_msg} ${content} + END Log Recieved error message ${err_msg} Run Healthcheck