Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / libraries / PcepOperations.robot
index 5b324bbfbcf488aa08b7a2105392718719ac1d10..4dae800afd6f94e03c51fe39b9acc41bbdf9abfe 100644 (file)
@@ -23,17 +23,15 @@ ${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
+    RequestsLibrary.Create_Session
     ...    pcep_session
-    ...    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}/rests/operations
+    ...    url=http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
     ...    headers=${HEADERS_XML}
     ...    auth=${AUTH}
 
 Teardown_Pcep_Operations
     [Documentation]    Teardown to pair with Setup (otherwise no-op).
-    Log    TODO: The following line does not seem to be implemented by RequestsLibrary. Look for a workaround.
-    # Delete_Session    pcep_session
+    RequestsLibrary.Delete_All_Sessions
 
 Add_Xml_Lsp_Return_Json
     [Documentation]    Instantiate LSP according to XML data and return response (json) text.
@@ -59,7 +57,12 @@ Remove_Xml_Lsp_Return_Json
 Operate_Xml_Lsp_Return_Json
     [Documentation]    Post XML data to given pcep-operations URI, check status_code is 200 and return response text (JSON).
     [Arguments]    ${uri_part}    ${xml_data}
-    ${response}=    RequestsLibrary.Post Request    pcep_session    ${uri_part}    data=${xml_data}
+    ${uri_path}=    BuiltIn.Set_Variable    /rests/operations/${uri_part}
+    ${response}=    RequestsLibrary.POST On Session
+    ...    pcep_session
+    ...    url=${uri_path}
+    ...    data=${xml_data}
+    ...    expected_status=anything
     Log    ${xml_data}
     Should Contain    ${ALLOWED_STATUS_CODES}    ${response.status_code}
     RETURN    ${response.text}