X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Fsuites%2Fbgpcep%2Fthroughpcep%2Fcases.robot;h=8bd6077aa230732e7078de5007c0c84a19961dd2;hb=9f074b03bf384dcb18179e76a1a1fe642a47900c;hp=40cac484c1dcde6040bdb4419d2568b5ffa8b368;hpb=5ae5def4713f994db87431017625d4a7dce7087c;p=integration%2Ftest.git diff --git a/csit/suites/bgpcep/throughpcep/cases.robot b/csit/suites/bgpcep/throughpcep/cases.robot index 40cac484c1..8bd6077aa2 100644 --- a/csit/suites/bgpcep/throughpcep/cases.robot +++ b/csit/suites/bgpcep/throughpcep/cases.robot @@ -117,8 +117,10 @@ Variables ${CURDIR}/../../../variables/Variables.py Library SSHLibrary timeout=10s Library RequestsLibrary Library ${CURDIR}/../../../libraries/AuthStandalone.py -Resource ${CURDIR}/../../../libraries/Utils.robot Resource ${CURDIR}/../../../libraries/FailFast.robot +Resource ${CURDIR}/../../../libraries/NexusKeywords.robot # for Deploy_Artifact +Resource ${CURDIR}/../../../libraries/SSHKeywords.robot # for Require_* and Assure_* +Resource ${CURDIR}/../../../libraries/Utils.robot # for Flexible_SSH_Login *** Variables *** # This table acts as an exhaustive list of variables users can modify on pybot invocation. @@ -139,7 +141,6 @@ ${MININET} 127.0.0.1 ${MININET_PROMPT} ${DEFAULT_LINUX_PROMPT} # from Variables.py ${MININET_USER} mininet ${MININET_WORKSPACE} /tmp -${MOCK_FILE} pcc-mock-ecexutable.jar ${PCCDOWNLOAD_HOSTHEADER} nexus.opendaylight.org ${PCCDOWNLOAD_URLBASE} http://${PCCDOWNLOAD_HOSTHEADER}/content/repositories/opendaylight.snapshot/org/opendaylight/bgpcep/pcep-pcc-mock/ ${PCCMOCK_COLOCATED} False @@ -170,22 +171,13 @@ ${UPDATERVM_WORKSPACE} ${MININET_WORKSPACE} Download_Pcc_Mock [Documentation] SSH login to pcc-mock VM, download latest pcc-mock executable from Nexus. BuiltIn.Run_Keyword_If ${PCCMOCK_COLOCATED} Pccmock_From_Controller + NexusKeywords.Initialize_Artifact_Deployment_And_Usage tools_system_connect=False SSHLibrary.Open_Connection ${PCCMOCKVM_IP} alias=pccmock SSHLibrary.Set_Client_Configuration timeout=10s SSHLibrary.Set_Client_Configuration prompt=${PCCMOCKVM_PROMPT} Utils.Flexible_SSH_Login ${PCCMOCKVM_USER} ${PCCMOCKVM_PASSWORD} delay=4s - ${curl_common} = BuiltIn.Set_Variable curl -s -H "Host:${PCCDOWNLOAD_HOSTHEADER}" ${PCCDOWNLOAD_URLBASE} - ${version} = SSHLibrary.Execute_Command ${curl_common}/maven-metadata.xml \| grep latest \| cut -d '>' -f 2 \| cut -d '<' -f 1 - BuiltIn.Log ${version} - ${namepart} = SSHLibrary.Execute_Command ${curl_common}/${version}/maven-metadata.xml \| grep value \| head -n 1 \| cut -d '>' -f 2 \| cut -d '<' -f 1 - BuiltIn.Log ${namepart} - BuiltIn.Set_Suite_Variable ${filename} pcep-pcc-mock-${namepart}-executable.jar - BuiltIn.Log ${filename} - BuiltIn.Set_Suite_Variable ${mocklocation} ${PCCMOCKVM_WORKSPACE}/${MOCK_FILE} - # TODO: Debug to make wget -N work - ${response} ${err} ${return_code} = SSHLibrary.Execute_Command ${curl_common}/${version}/${filename} > ${mocklocation} return_rc=True return_stderr=True - BuiltIn.Log ${err} - BuiltIn.Should_Be_Equal ${return_code} ${0} + ${file_name} = NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock + BuiltIn.Set_Suite_Variable ${mock_location} ${file_name} Put_Updater [Documentation] Open SSH session to updater VM, copy the utility there, including dependencies, also prepare direct http session. @@ -194,11 +186,11 @@ Put_Updater SSHLibrary.Set_Client_Configuration timeout=20s SSHLibrary.Set_Client_Configuration prompt=${UPDATERVM_PROMPT} Utils.Flexible_SSH_Login ${UPDATERVM_USER} ${UPDATERVM_PASSWORD} delay=4s - Require_Python + SSHKeywords.Require_Python SSHLibrary.Put_File ${CURDIR}/../../../../tools/pcep_updater/updater.py ${UPDATERVM_WORKSPACE}/ SSHLibrary.Put_File ${CURDIR}/../../../libraries/AuthStandalone.py ${UPDATERVM_WORKSPACE}/ - Assure_Library_Counter workspace=${UPDATERVM_WORKSPACE} - Assure_Library_Ipaddr workspace=${UPDATERVM_WORKSPACE} + SSHKeywords.Assure_Library_Counter target_dir=${UPDATERVM_WORKSPACE} + SSHKeywords.Assure_Library_Ipaddr terget_dir=${UPDATERVM_WORKSPACE} # Done preparation of Updater VM, now use AuthStandalone to create session from robot VM too. BuiltIn.Log_Many ${RESTCONF_USER} ${RESTCONF_PASSWORD} ${RESTCONF_SCOPE} ${CONTROLLER} ${session} = AuthStandalone.Init_Session ${CONTROLLER} ${RESTCONF_USER} ${RESTCONF_PASSWORD} ${RESTCONF_SCOPE} @@ -226,7 +218,7 @@ Topology_Precondition Start_Pcc_Mock [Documentation] Launch pcc-mock on background so simulated PCCs start connecting to controller. SSHLibrary.Switch_Connection pccmock - ${command} = BuiltIn.Set_Variable java -jar ${mocklocation} --local-address ${FIRST_PCC_IP} --remote-address ${CONTROLLER} --pcc ${PCCS} --lsp ${LSPS} &> ${LOG_PATH}/${LOG_NAME} + ${command} = NexusKeywords.Compose_Full_Java_Command -jar ${mock_location} --local-address ${FIRST_PCC_IP} --remote-address ${CONTROLLER} --pcc ${PCCS} --lsp ${LSPS} &> ${LOG_PATH}/${LOG_NAME} BuiltIn.Log ${command} SSHLibrary.Write ${command} # The pccmock SSH session is left alive, but no data will be exchanged for a while. @@ -400,37 +392,6 @@ Updater_From_Controller BuiltIn.Set_Suite_Variable ${UPDATERVM_PROMPT} ${CONTROLLER_PROMPT} BuiltIn.Set_Suite_Variable ${UPDATERVM_WORKSPACE} ${CONTROLLER_WORKSPACE} -Require_Python - [Documentation] Verify current SSH connection leads to machine with python working. Fatal fail otherwise. - ${passed} = Execute_Command_Passes python --help - BuiltIn.Return_From_Keyword_If ${passed} - BuiltIn.Fatal_Error Python is not installed! - -Assure_Library_Counter - [Arguments] ${workspace}=/tmp - [Documentation] Tests whether Counter is present in collections on ssh-connected machine, Puts Counter.py to workspace if not. - ${passed} = Execute_Command_Passes bash -c 'cd "${workspace}" && python -c "from collections import Counter"' - # TODO: Move the bash-cd wrapper to separate keyword? - BuiltIn.Return_From_Keyword_If ${passed} - SSHLibrary.Put_File ${CURDIR}/../../../libraries/Counter.py ${workspace}/ - -Assure_Library_Ipaddr - [Arguments] ${workspace}=/tmp - [Documentation] Tests whether ipaddr module is present on ssh-connected machine, Puts ipaddr.py to workspace if not. - ${passed} = Execute_Command_Passes bash -c 'cd "${workspace}" && python -c "import ipaddr"' - BuiltIn.Return_From_Keyword_If ${passed} - SSHLibrary.Put_File ${CURDIR}/../../../libraries/ipaddr.py ${workspace}/ - -Execute_Command_Passes - [Arguments] ${command} - [Documentation] Execute command via SSH. If RC is nonzero, log everything. Retrun bool of command success. - ${stdout} ${stderr} ${rc} = SSHLibrary.Execute_Command ${command} return_stderr=True return_rc=True - BuiltIn.Return_From_Keyword_If ${rc} == 0 True - BuiltIn.Log ${stdout} - BuiltIn.Log ${stderr} - BuiltIn.Log ${rc} - [Return] False - Disconnect [Documentation] Explicitly close all SSH connections. SSHLibrary.Close_All_Connections