Enable loglevel as Trace for VTN Manager
[integration/test.git] / csit / libraries / PcepOperations.robot
index fb00068644d4c026f8670234f7a4386e940370ec..78130a83f17f92e66ad40a8155662f1a8e8bcdbb 100644 (file)
@@ -7,13 +7,14 @@ Documentation     Robot keyword library (Resource) for performing PCEP operation
 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
 Library           RequestsLibrary
+Library           ${CURDIR}/HsfJson/hsf_json.py
 Variables         ${CURDIR}/../variables/Variables.py
 
 *** 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).
@@ -44,7 +45,7 @@ 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}
+    ${response}=    RequestsLibrary.Post Request    pcep_session    ${uri_part}    data=${xml_data}
     Should_Be_Equal_As_Strings    ${response.status_code}    200
     [Return]    ${response.text}
 
@@ -54,7 +55,11 @@ Pcep_Json_Is_Success
     Should_Be_Equal_As_Strings    ${text}    {"output":{}}
 
 Pcep_Json_Is_Refused
-    [Arguments]    ${text}
+    [Arguments]    ${actual_raw}
     [Documentation]    Given text should be equal to json response when device refuses tunnel removal.
-    # FIXME: We probably should normalize text as json (and by that, test whether it is a json at all).
-    Should_Be_Equal_As_Strings    ${text}    {"output":{"error":[{"error-object":{"ignore":false,"processing-rule":false,"type":19,"value":9}}],"failure":"failed"}}
+    ${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}
+    BuiltIn.Should_Be_Equal    ${actual_normalized}    ${expected_normalized}
+    # TODO: Would the diff approach be more useful?