From 9f074b03bf384dcb18179e76a1a1fe642a47900c Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Wed, 24 Feb 2016 16:35:58 +0100 Subject: [PATCH] Add ability to compose java command according to version This fixes Boron csit jobs which download Java tools from Nexus. UscUtils not edited, as their jar presumably does not depend on {stream}. Change-Id: I1e61ad44b810838d333fde56cfe5edca906fda9f Signed-off-by: Vratko Polak --- csit/libraries/NetconfKeywords.robot | 2 +- csit/libraries/NexusKeywords.robot | 17 +++++++++++++++++ csit/suites/bgpcep/pcepuser/pcepuser.robot | 2 +- csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot | 2 +- csit/suites/bgpcep/throughpcep/cases.robot | 2 +- .../netconf/restperfclient/performance.robot | 2 +- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/csit/libraries/NetconfKeywords.robot b/csit/libraries/NetconfKeywords.robot index 36731719f9..234f99d8f1 100644 --- a/csit/libraries/NetconfKeywords.robot +++ b/csit/libraries/NetconfKeywords.robot @@ -152,7 +152,7 @@ Install_And_Start_Testtool ${filename}= NexusKeywords.Deploy_Test_Tool netconf netconf-testtool ${schemas_option}= NetconfKeywords__Deploy_Additional_Schemas ${schemas} # Start the testtool - ${command} BuiltIn.Set_Variable java ${java_options} -jar ${filename} ${tool_options} --device-count ${device-count} --debug ${debug} ${schemas_option} --md-sal ${mdsal} + ${command}= NexusKeywords.Compose_Full_Java_Command ${java_options} -jar ${filename} ${tool_options} --device-count ${device-count} --debug ${debug} ${schemas_option} --md-sal ${mdsal} BuiltIn.Log Running testtool: ${command} ${logfile}= Utils.Get_Log_File_Name testtool BuiltIn.Set_Suite_Variable ${testtool_log} ${logfile} diff --git a/csit/libraries/NexusKeywords.robot b/csit/libraries/NexusKeywords.robot index f93f707f40..850711e5d0 100644 --- a/csit/libraries/NexusKeywords.robot +++ b/csit/libraries/NexusKeywords.robot @@ -102,3 +102,20 @@ Deploy_Test_Tool ${name_suffix}= BuiltIn.Set_Variable -${suffix}.jar ${filename}= Deploy_Artifact ${component} ${artifact} ${name_prefix} ${name_suffix} [Return] ${filename} + +Compose_Base_Java_Command + [Arguments] ${openjdk}=${JDKVERSION} + [Documentation] Return string suitable for launching Java programs over SSHLibrary, depending on JRE version needed. + ... Not directly related to nexus, but different versioned Java artifacts may need this. + BuiltIn.Return_From_Keyword_If """${openjdk}""" == "openjdk8" /usr/lib/jvm/java-1.8.0/bin/java + BuiltIn.Return_From_Keyword_If """${openjdk}""" == "openjdk7" /usr/lib/jvm/java-1.7.0/bin/java + BuiltIn.Return_From_Keyword java + +Compose_Full_Java_Command + [Arguments] ${options} ${openjdk}=${JDKVERSION} + [Documentation] Return full Bash command to run Java with given options. + ... The options may include JVM options, application command line arguments, Bash redirects and other constructs. + ${base_command} = Compose_Base_Java_Command openjdk=${openjdk} + ${full_command} = BuiltIn.Set_Variable ${base_command} ${options} + BuiltIn.Log ${full_command} + [Return] ${full_command} diff --git a/csit/suites/bgpcep/pcepuser/pcepuser.robot b/csit/suites/bgpcep/pcepuser/pcepuser.robot index fa1e7625b1..c1d37b19a5 100644 --- a/csit/suites/bgpcep/pcepuser/pcepuser.robot +++ b/csit/suites/bgpcep/pcepuser/pcepuser.robot @@ -34,7 +34,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 ${MININET} --remote-address ${CONTROLLER} 2>&1 | tee pccmock.log Log ${command} Write ${command} Read_Until started, sent proposal Open diff --git a/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot b/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot index bc717f4d59..d3cad0f210 100644 --- a/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot +++ b/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot @@ -41,7 +41,7 @@ Topology_Precondition Start_Secure_Pcc_Mock [Documentation] Execute pcc-mock on Mininet with password set, fail if pcc-mock promptly exits. Keep pcc-mock running for next test cases. - ${command}= BuiltIn.Set_Variable java -jar ${filename} --password topsecret --reconnect 1 --local-address ${MININET} --remote-address ${CONTROLLER} 2>&1 | tee pccmock.log + ${command}= NexusKeywords.Compose_Full_Java_Command -jar ${filename} --password topsecret --reconnect 1 --local-address ${MININET} --remote-address ${CONTROLLER} 2>&1 | tee pccmock.log BuiltIn.Log ${command} SSHLibrary.Write ${command} Read_And_Fail_If_Prompt_Is_Seen diff --git a/csit/suites/bgpcep/throughpcep/cases.robot b/csit/suites/bgpcep/throughpcep/cases.robot index 0249d67b79..8bd6077aa2 100644 --- a/csit/suites/bgpcep/throughpcep/cases.robot +++ b/csit/suites/bgpcep/throughpcep/cases.robot @@ -218,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 ${mock_location} --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. diff --git a/csit/suites/netconf/restperfclient/performance.robot b/csit/suites/netconf/restperfclient/performance.robot index fb77e16382..411321a23e 100644 --- a/csit/suites/netconf/restperfclient/performance.robot +++ b/csit/suites/netconf/restperfclient/performance.robot @@ -69,7 +69,7 @@ Deploy_And_Run_RestPerfClient ${options}= BuiltIn.Set_Variable ${options} --destination /restconf/config/network-topology:network-topology/topology/topology-netconf/node/${DEVICE_NAME}/yang-ext:mount/car:cars ${options}= BuiltIn.Set_Variable ${options} --edit-content request1.json ${options}= BuiltIn.Set_Variable ${options} --auth ${ODL_RESTCONF_USER} ${ODL_RESTCONF_PASSWORD} - ${command} BuiltIn.Set_Variable java -Xmx1G -XX:MaxPermSize=256M -jar ${filename} ${options} + ${command}= NexusKeywords.Compose_Full_Java_Command -Xmx1G -XX:MaxPermSize=256M -jar ${filename} ${options} BuiltIn.Log Running restperfclient: ${command} ${restperfclientlog}= Utils.Get_Log_File_Name restperfclient BuiltIn.Set_Suite_Variable ${restperfclientlog} ${restperfclientlog} -- 2.36.6