Library Process
Library Collections
Library RequestsLibrary
-Library ./UtilLibrary.py
-Resource KarafKeywords.robot
-Resource TemplatedRequests.robot
-Variables ../variables/Variables.py
+Library ${CURDIR}/UtilLibrary.py
+Resource ${CURDIR}/SSHKeywords.robot
+Resource ${CURDIR}/TemplatedRequests.robot
+Variables ${CURDIR}/../variables/Variables.py
*** Variables ***
# TODO: Introduce ${tree_size} and use instead of 1 in the next line.
... robot keyword, taking care to log in with a public key and. The command given is written
... and the output returned. No test conditions are checked.
${current_ssh_connection}= SSHLibrary.Get Connection
- Log Attempting to execute command "${cmd}" on remote system "${system}" by user "${user}" with keyfile pass "${keyfile_pass}" and prompt "${prompt}"
+ BuiltIn.Log Attempting to execute command "${cmd}" on remote system "${system}" by user "${user}" with keyfile pass "${keyfile_pass}" and prompt "${prompt}"
+ BuiltIn.Log ${password}
${conn_id}= SSHLibrary.Open Connection ${system} prompt=${prompt} timeout=${prompt_timeout}
Flexible SSH Login ${user} ${password}
${stdout} ${stderr} SSHLibrary.Execute Command ${cmd} return_stderr=True
SSHLibrary.Close Connection
Log ${stderr}
- [Teardown] KarafKeywords.Restore_Current_SSH_Connection_From_Index ${current_ssh_connection.index}
+ [Teardown] SSHKeywords.Restore_Current_SSH_Connection_From_Index ${current_ssh_connection.index}
[Return] ${stdout}
Write_Bare_Ctrl_C
Run Command On Controller
[Arguments] ${system}=${ODL_SYSTEM_IP} ${cmd}=echo ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
[Documentation] Call Run Comand On Remote System, but with default values suitable for Controller machine.
+ BuiltIn.Log ${password}
BuiltIn.Run Keyword And Return Run Command On Remote System ${system} ${cmd} ${user} ${password} prompt=${prompt}
Verify File Exists On Remote System
SSHLibrary.File Should Exist ${file}
Close Connection
+Check Karaf Log File Does Not Have Messages
+ [Arguments] ${ip} ${message} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT} ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
+ [Documentation] Fails if the provided ${message} is found in the karaf.log file. Uses grep to search. The
+ ... karaf.log file can be overridden with ${log_file} to be any file on the given system @ ${ip}
+ ${output}= Run Command On Controller ${ip} grep -c '${message}' ${log_file} user=${user} password=${password} prompt=${prompt}
+ Should Be Equal As Strings ${output} 0
+
Verify Controller Is Not Dead
[Arguments] ${controller_ip}=${ODL_SYSTEM_IP}
[Documentation] Will execute any tests to verify the controller is not dead. Some checks are
${resp} RequestsLibrary.Get Request session ${uri}
Should Be Equal As Strings ${resp.status_code} 404
+Remove All Elements If Exist
+ [Arguments] ${uri}
+ [Documentation] Delete all elements from an URI if the configuration was not empty
+ ${resp} RequestsLibrary.Get Request session ${uri}
+ Run Keyword If '${resp.status_code}'!='404' Remove All Elements At URI ${uri}
+
Add Elements To URI From File
[Arguments] ${dest_uri} ${data_file} ${headers}=${headers}
${body} OperatingSystem.Get File ${data_file}