X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FChangeCounter.robot;h=883ca65a04a148554d52f0d90b5f065737ea4194;hb=056dccee2fcd331a1148d0f9fd7e12604cb09c9c;hp=64a281b4af7db94cf0b76f89386b45da6d80f1e8;hpb=8252a1e83666ddb607256e77550c2f9d535191a7;p=integration%2Ftest.git diff --git a/csit/libraries/ChangeCounter.robot b/csit/libraries/ChangeCounter.robot index 64a281b4af..883ca65a04 100644 --- a/csit/libraries/ChangeCounter.robot +++ b/csit/libraries/ChangeCounter.robot @@ -8,38 +8,42 @@ Documentation Robot keyword library (Resource) for common handling of data c ... and is available at http://www.eclipse.org/legal/epl-v10.html ... ... -... This resource assumes that RequestsLibrary has open a connection named "operational" -... which points to (an analogue of) http://${ODL_SYSTEM_IP}:${RESTCONFPORT}/${OPERATIONAL_API} +... This resource creates a "default" session using TemplatedRequests.Create_Default_Session +... which points to (an analogue of) http://${ODL_SYSTEM_IP}:${RESTCONFPORT} Library RequestsLibrary -Resource ${CURDIR}/ConfigViaRestconf.robot +Resource ${CURDIR}/CompareStream.robot Resource ${CURDIR}/ScalarClosures.robot +Resource ${CURDIR}/TemplatedRequests.robot Resource ${CURDIR}/WaitUtils.robot *** Variables *** ${CHANGE_COUNTER_TEMPLATE_FOLDER} ${CURDIR}/../variables/bgpuser +${CC_DATA_CHANGE_COUNTER_URL} /restconf/operational/data-change-counter:data-change-counter *** Keywords *** CC_Setup [Documentation] Initialize dependency libraries. - ConfigViaRestconf.Setup_Config_Via_Restconf + TemplatedRequests.Create_Default_Session WaitUtils.WU_Setup # includes ScalarClosures.SC_Setup ${counter} = ScalarClosures.Closure_From_Keyword_And_Arguments Get_Change_Count BuiltIn.Set_Suite_Variable ${ChangeCounter__getter} ${counter} Get_Change_Count + [Arguments] ${session}=operational [Documentation] GET data change request, assert status 200, return the value. - ${response} = RequestsLibrary.Get_Request operational data-change-counter:data-change-counter + ${response} = RequestsLibrary.Get_Request ${session} ${CC_DATA_CHANGE_COUNTER_URL} BuiltIn.Should_Be_Equal ${response.status_code} ${200} Got status: ${response.status_code} and message: ${response.text} - # TODO: The following line can be insecure. Should we use regexp instead? - ${count} = BuiltIn.Evaluate ${response.text}["data-change-counter"]["count"] + # CompareStream.Set_Variable_If_At_Least_Else cannot be used direcly, because ${response.text}["data-change-counter"]["count"] would be + # evaluated before the stream comparison and it causes failures + ${count} = BuiltIn.Evaluate ${response.text}["data-change-counter"]["counter"][0]["count"] [Return] ${count} Reconfigure_Topology_Name [Arguments] ${topology_name}=example-linkstate-topology [Documentation] Configure data change counter to count transactions affecting ... ${topology_name} instead of previously configured topology name. - ${template_as_string}= BuiltIn.Set_Variable {'TOPOLOGY_NAME': '${topology_name}'} - ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf ${CHANGE_COUNTER_TEMPLATE_FOLDER}${/}change_counter ${template_as_string} + &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} TOPOLOGY_NAME=${topology_name} + TemplatedRequests.Put_As_Xml_Templated ${CHANGE_COUNTER_TEMPLATE_FOLDER}${/}change_counter mapping=${mapping} Wait_For_Change_Count_To_Become_Stable [Arguments] ${timeout}=60s ${period}=1s ${repetitions}=4 ${count_to_overcome}=-1