X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FPcepOperations.robot;h=6455a6a77165a1f884f40018cd03a6011095d56e;hb=aff5ab67e558c98f530161ff014704512aade695;hp=d9c81d78f9fcd25130082ff5d7104c11fbc7bffe;hpb=605ea2d089891599df1554c36464f6fa135eb3b2;p=integration%2Ftest.git diff --git a/csit/libraries/PcepOperations.robot b/csit/libraries/PcepOperations.robot index d9c81d78f9..6455a6a771 100644 --- a/csit/libraries/PcepOperations.robot +++ b/csit/libraries/PcepOperations.robot @@ -6,15 +6,22 @@ Documentation Robot keyword library (Resource) for performing PCEP operation ... This program and the accompanying materials are made available under the ... terms of the Eclipse Public License v1.0 which accompanies this distribution, ... and is available at http://www.eclipse.org/legal/epl-v10.html +... +... TODO: Remove all old keywords, update pcepuser.robot accordingly +... TODO: Add new KWs, update all pcep tests to use them. Library RequestsLibrary -Library ${CURDIR}/HsfJson/hsf_json.py -Variables ${CURDIR}/../variables/Variables.py +Library norm_json.py +Resource ../variables/Variables.robot +Resource TemplatedRequests.robot + +*** Variables *** +${PCEP_VAR_FOLDER} ${CURDIR}/../variables/tcpmd5user *** Keywords *** Setup_Pcep_Operations [Documentation] Creates Requests session to be used by subsequent keywords. # Do not append slash at the end uf URL, Requests would add another, resulting in error. - Create_Session pcep_session http://${CONTROLLER}:${RESTCONFPORT}/restconf/operations headers=${HEADERS_XML} auth=${AUTH} + Create_Session pcep_session http://${ODL_SYSTEM_IP}:${RESTCONFPORT}/restconf/operations headers=${HEADERS_XML} auth=${AUTH} Teardown_Pcep_Operations [Documentation] Teardown to pair with Setup (otherwise no-op). @@ -45,8 +52,9 @@ Remove_Xml_Lsp_Return_Json Operate_Xml_Lsp_Return_Json [Arguments] ${uri_part} ${xml_data} [Documentation] Post XML data to given pcep-operations URI, check status_code is 200 and return response text (JSON). - ${response}= RequestsLibrary.Post pcep_session ${uri_part} data=${xml_data} - Should_Be_Equal_As_Strings ${response.status_code} 200 + ${response}= RequestsLibrary.Post Request pcep_session ${uri_part} data=${xml_data} + Log ${xml_data} + Should Contain ${ALLOWED_STATUS_CODES} ${response.status_code} [Return] ${response.text} Pcep_Json_Is_Success @@ -59,7 +67,13 @@ Pcep_Json_Is_Refused [Documentation] Given text should be equal to json response when device refuses tunnel removal. ${expected_raw}= BuiltIn.Set_Variable {"output":{"error":[{"error-object":{"ignore":false,"processing-rule":false,"type":19,"value":9}}],"failure":"failed"}} # TODO: Is that JSON worth referencing pcepuser variables from this library? - ${expected_normalized}= hsf_json.hsf_json ${expected_raw} - ${actual_normalized}= hsf_json.hsf_json ${actual_raw} + ${expected_normalized}= norm_json.normalize_json_text ${expected_raw} + ${actual_normalized}= norm_json.normalize_json_text ${actual_raw} BuiltIn.Should_Be_Equal ${actual_normalized} ${expected_normalized} # TODO: Would the diff approach be more useful? + +Pcep_Topology_Precondition + [Arguments] ${session} + [Documentation] Compare current pcep-topology to empty one. + ... Timeout is long enough to see that pcep is ready. + BuiltIn.Wait_Until_Keyword_Succeeds 300s 1s TemplatedRequests.Get_As_Json_Templated ${PCEP_VAR_FOLDER}/default_off session=${session} verify=True