... That may include Utils.Flexible_SSH_Login, and similar.
Library SSHLibrary
Resource ${CURDIR}/Utils.robot
+Resource ../variables/Variables.robot
*** Variables ***
${SSHKeywords__current_remote_working_directory} .
${output}= SSHLibrary.Read_Until_Prompt
BuiltIn.Run_Keyword_If ${log_output}==${True} BuiltIn.Log ${output}
-Copy File To Remote System
- [Arguments] ${system} ${source} ${destination} ${user}=${TOOLS_SYSTEM_USER} ${password}=${TOOLS_SYSTEM_PASSWORD} ${prompt}=${TOOLS_SYSTEM_PROMPT}
+Unsafe_Copy_File_To_Remote_System
+ [Arguments] ${system} ${source} ${destination}=./ ${user}=${DEFAULT_USER} ${password}=${DEFAULT_PASSWORD} ${prompt}=${DEFAULT_LINUX_PROMPT}
... ${prompt_timeout}=5s
- [Documentation] Simplifies copy file operations to remote system
- ${conn_id}= Open Connection ${system} prompt=${prompt} timeout=${prompt_timeout}
- Flexible SSH Login ${user} ${password}
- SSHLibrary.Put File ${source} ${destination}
- Close Connection
+ [Documentation] Copy the ${source} file to the ${destination} file on the remote ${system}. The keyword opens and closes a single
+ ... ssh connection and does not rely on any existing ssh connection that may be open.
+ SSHLibrary.Open_Connection ${system} prompt=${prompt} timeout=${prompt_timeout}
+ Utils.Flexible_SSH_Login ${user} ${password}
+ SSHLibrary.Put_File ${source} ${destination}
+ SSHLibrary.Close Connection
+
+Copy_File_To_Remote_System
+ [Arguments] ${system} ${source} ${destination}=./ ${user}=${DEFAULT_USER} ${password}=${DEFAULT_PASSWORD} ${prompt}=${DEFAULT_LINUX_PROMPT}
+ ... ${prompt_timeout}=5s
+ [Documentation] Copy the ${source} file to the ${destination} file on the remote ${system}. Any pre-existing active
+ ... ssh connection will be retained.
+ SSHKeywords.Run_Keyword_Preserve_Connection SSHKeywords.Unsafe_Copy_File_To_Remote_System ${system} ${source} ${destination} ${user} ${password}
+ ... ${prompt} ${prompt_timeout}
+
+Copy_File_To_Odl_System
+ [Arguments] ${system} ${source} ${destination}=./
+ [Documentation] Wrapper keyword to make it easier to copy a file to an ODL specific system
+ SSHKeywords.Copy_File_To_Remote_System ${system} ${source} ${destination} ${ODL_SYSTEM_USER} ${ODL_SYSTEM_PASSWORD} ${ODL_SYSTEM_PROMPT}
+
+Copy_File_To_Tools_System
+ [Arguments] ${system} ${source} ${destination}=./
+ [Documentation] Wrapper keyword to make it easier to copy a file to an Tools specific system
+ SSHKeywords.Copy_File_To_Remote_System ${system} ${source} ${destination} ${TOOLS_SYSTEM_USER} ${TOOLS_SYSTEM_PASSWORD} ${TOOLS_SYSTEM_PROMPT}
# limitation in pycurl library that does not support key pem files with passphrase in automatic mode (it asks for it)
Run openssl req -x509 -newkey rsa:4096 -nodes -keyout ${USER_HOME}/clientkey.pem -out ${USER_HOME}/clientcert.pem -days 365 -subj "/C=ES/ST=Madrid/L=Madrid/O=OpenDayLight/OU=AAA/CN=MiguelAngelMunoz/emailAddress=myemail@unknown.com"
# Import client's cert as trusted
- Copy File To Remote System ${ODL_SYSTEM_IP} ${USER_HOME}/clientcert.pem .
+ Copy File To Odl System ${ODL_SYSTEM_IP} ${USER_HOME}/clientcert.pem
Run Command On Remote System ${ODL_SYSTEM_IP} ${JAVA_HOME}/bin/keytool -import -trustcacerts -file clientcert.pem -keystore ${KEYSTORE_PATH} -storepass 123456 -noprompt
Log Certificates in Keystore
Restart Jetty
Run openssl x509 -req -in ${USER_HOME}/server.csr -CA ${USER_HOME}/rootCA.pem -CAkey ${USER_HOME}/rootCA.key -CAcreateserial -out ${USER_HOME}/server.crt -days 500 -sha256
# Convert to pkcs12 (including public and private key together)
Run openssl pkcs12 -export -in ${USER_HOME}/server.crt -inkey ${USER_HOME}/server.key -out ${USER_HOME}/server.p12 -name odl -passin pass:myPass -passout pass:myPass
- Copy File To Remote System ${ODL_SYSTEM_IP} ${USER_HOME}/server.p12 .
+ Copy File To Odl System ${ODL_SYSTEM_IP} ${USER_HOME}/server.p12
# Import Certifcate into keystore
${KEYSTORE_DIR}= Split Path ${KEYSTORE_PATH}
Run Command On Remote System ${ODL_SYSTEM_IP} mkdir -p ${KEYSTORE_DIR[0]}
Run openssl req -new -key ${USER_HOME}/client_ca_signed-key.pem -out ${USER_HOME}/client_ca_signed.csr -subj "/C=ES/ST=Madrid/L=Madrid/O=OpenDayLight/OU=RestClient/CN=RestClient/emailAddress=unknown@unknownclient.com"
#Sign CSR
Run openssl x509 -req -in ${USER_HOME}/client_ca_signed.csr -CA ${USER_HOME}/rootCA_for_clients-cert.pem -CAkey ${USER_HOME}/rootCA_for_clients-key.pem -CAcreateserial -out ${USER_HOME}/client_ca_signed-cert.pem -days 500 -sha256
- Copy File To Remote System ${ODL_SYSTEM_IP} ${USER_HOME}/rootCA_for_clients-cert.pem .
+ Copy File To Odl System ${ODL_SYSTEM_IP} ${USER_HOME}/rootCA_for_clients-cert.pem
# Import RootCA Certifcate into keystore
${KEYSTORE_DIR}= Split Path ${KEYSTORE_PATH}
Run Command On Remote System ${ODL_SYSTEM_IP} mkdir -p ${KEYSTORE_DIR[0]}