Edited suites to use norm_json.py instead of HsfJson
[integration/test.git] / csit / suites / bgpcep / pcepuser / pcepuser.robot
index 4c320b4a1a0ca2b275fc3d2d2804c25dc2fbf8c7..f95b29e7cfd16b5ed90b6aee44f636269841cd61 100644 (file)
@@ -9,14 +9,18 @@ Documentation     Basic tests for odl-bgpcep-pcep-all feature.
 Suite Setup       Set_It_Up
 Suite Teardown    Tear_It_Down
 Library           OperatingSystem
-Library           SSHLibrary    prompt=]>
+Library           SSHLibrary
 Library           RequestsLibrary
-Library           ${CURDIR}/../../../libraries/HsfJson/hsf_json.py
+Library           ${CURDIR}/../../../libraries/norm_json.py
+Resource          ${CURDIR}/../../../libraries/NexusKeywords.robot
 Resource          ${CURDIR}/../../../libraries/PcepOperations.robot
+Resource          ${CURDIR}/../../../libraries/Utils.robot
 Variables         ${CURDIR}/../../../variables/Variables.py
-Variables         ${CURDIR}/../../../variables/pcepuser/variables.py    ${MININET}
+Variables         ${CURDIR}/../../../variables/pcepuser/variables.py    ${TOOLS_SYSTEM_IP}
 
 *** Variables ***
+${OUTPUT_TIMEOUT}    10
+# FIXME: Unify parameter naming and case.
 ${ExpDir}         ${CURDIR}/expected
 ${ActDir}         ${CURDIR}/actual
 
@@ -29,7 +33,7 @@ Topology_Precondition
 
 Start_Pcc_Mock
     [Documentation]    Execute pcc-mock on Mininet, fail is Open is not sent, keep it running for next tests.
-    ${command}=    Set_Variable    java -jar ${filename} --local-address ${MININET} --remote-address ${CONTROLLER} 2>&1 | tee pccmock.log
+    ${command}=    NexusKeywords.Compose_Full_Java_Command    -jar ${filename} --local-address ${TOOLS_SYSTEM_IP} --remote-address ${ODL_SYSTEM_IP} 2>&1 | tee pccmock.log
     Log    ${command}
     Write    ${command}
     Read_Until    started, sent proposal Open
@@ -113,18 +117,11 @@ Set_It_Up
     [Documentation]    Create SSH session to Mininet machine, prepare HTTP client session to Controller.
     ...    Figure out latest pcc-mock version and download it from Nexus to Mininet.
     ...    Also, delete and create directories for json diff handling.
-    Open_Connection    ${MININET}
-    Login_With_Public_Key    ${MININET_USER}    ${USER_HOME}/.ssh/${SSH_KEY}    any
-    Create_Session    ses    http://${CONTROLLER}:${RESTCONFPORT}/restconf/operational/network-topology:network-topology    auth=${AUTH}
-    ${urlbase}=    Set_Variable    ${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot/org/opendaylight/bgpcep/pcep-pcc-mock
-    ${version}=    Execute_Command    curl ${urlbase}/maven-metadata.xml | grep latest | cut -d '>' -f 2 | cut -d '<' -f 1
-    Log    ${version}
-    ${namepart}=    Execute_Command    curl ${urlbase}/${version}/maven-metadata.xml | grep value | head -n 1 | cut -d '>' -f 2 | cut -d '<' -f 1
-    Log    ${namepart}
-    Set_Suite_Variable    ${filename}    pcep-pcc-mock-${namepart}-executable.jar
-    Log    ${filename}
-    ${response}=    Execute_Command    wget -q -N ${urlbase}/${version}/${filename} 2>&1
-    Log    ${response}
+    NexusKeywords.Initialize_Artifact_Deployment_And_Usage
+    # FIXME: Unify Module prefix usage across whole file.
+    Create_Session    ses    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}/restconf/operational/network-topology:network-topology    auth=${AUTH}
+    ${name}=    NexusKeywords.Deploy_Test_Tool    bgpcep    pcep-pcc-mock
+    BuiltIn.Set_Suite_Variable    ${filename}    ${name}
     Remove_Directory    ${ExpDir}
     Remove_Directory    ${ActDir}
     Create_Directory    ${ExpDir}
@@ -136,13 +133,13 @@ Compare_Topology
     [Documentation]    Get current pcep-topology as json, normalize both expected and actual json.
     ...    Save normalized jsons to files for later processing.
     ...    Error codes and normalized jsons should match exactly.
-    ${normexp}=    Hsf_Json    ${expected}
+    ${normexp}=    norm_json.normalize_json_text    ${expected}
     Log    ${normexp}
     Create_File    ${ExpDir}${/}${name}    ${normexp}
-    ${resp}=    RequestsLibrary.Get    ses    topology/pcep-topology
+    ${resp}=    RequestsLibrary.Get Request    ses    topology/pcep-topology
     Log    ${resp}
     Log    ${resp.text}
-    ${normresp}=    Hsf_Json    ${resp.text}
+    ${normresp}=    norm_json.normalize_json_text    ${resp.text}
     Log    ${normresp}
     Create_File    ${ActDir}${/}${name}    ${normresp}
     Should_Be_Equal_As_Strings    ${resp.status_code}    200