*** Settings ***
Documentation General Utils library. This library has broad scope, it can be used by any robot system tests.
Library SSHLibrary
+Library HttpLibrary.HTTP
Library String
Library DateTime
Library Process
${start} sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --topo tree,1 --switch ovsk,protocols=OpenFlow13
*** Keywords ***
-Start Suite
+Start Mininet
[Arguments] ${system}=${TOOLS_SYSTEM_IP} ${user}=${TOOLS_SYSTEM_USER} ${password}=${TOOLS_SYSTEM_PASSWORD} ${prompt}=${DEFAULT_LINUX_PROMPT} ${timeout}=30s
[Documentation] Basic setup/cleanup work that can be done safely before any system
... is run.
Write ${start}
Read Until mininet>
-Start Mininet
- [Arguments] ${system}=${TOOLS_SYSTEM_IP} ${cmd}=${start} ${custom}= ${user}=${TOOLS_SYSTEM_USER} ${password}=${TOOLS_SYSTEM_PASSWORD} ${prompt}=${DEFAULT_LINUX_PROMPT}
- ... ${prompt_timeout}=30s
- [Documentation] Basic setup to start mininet with custom topology
- Log Start the test on the base edition
- Clean Mininet System
- ${mininet_conn_id}= Open Connection ${system} prompt=${prompt} timeout=${prompt_timeout}
- Set Suite Variable ${mininet_conn_id}
- Flexible Mininet Login user=${user} password=${password}
- Put File ${custom}
- Write ${cmd}
- Read Until mininet>
- [Return] ${mininet_conn_id}
-
Stop Mininet
- [Arguments] ${mininet_conn_id} ${prompt}=${DEFAULT_LINUX_PROMPT}
- [Documentation] Basic setup to stop/clean mininet
- Switch Connection ${mininet_conn_id}
- SSHLibrary.Write exit
- Read Until ${prompt}
- Close Connection
-
-Stop Suite
[Arguments] ${prompt}=${DEFAULT_LINUX_PROMPT}
[Documentation] Cleanup/Shutdown work that should be done at the completion of all
... tests
BuiltIn.Set Test Message ${msg}${newline}${bugs}${newline}${newline}${TEST_MESSAGE}
BuiltIn.Log ${msg}${newline}${bugs}
-Ensure All Nodes Are In Response
- [Arguments] ${URI} ${node_list}
- [Documentation] A GET is made to the supplied ${URI} and every item in the ${node_list}
- ... is verified to exist in the repsonse. This keyword currently implies that it's node
- ... specific but any list of strings can be given in ${node_list}. Refactoring of this
- ... to make it more generic should be done. (see keyword "Check For Elements At URI")
- : FOR ${node} IN @{node_list}
- \ ${resp} RequestsLibrary.Get Request session ${URI}
- \ Should Be Equal As Strings ${resp.status_code} 200
- \ Should Contain ${resp.content} ${node}
-
Check Nodes Stats
[Arguments] ${node}
[Documentation] A GET on the /node/${node} API is made and specific flow stat
Should Contain ${resp.content} flow-capable-node-connector-statistics
Should Contain ${resp.content} flow-table-statistics
-Check That Port Count Is Ok
- [Arguments] ${node} ${count}
- [Documentation] A GET on the /port API is made and the specified port ${count} is
- ... verified. A more generic Keyword "Check For Specific Number Of Elements At URI"
- ... also does this work and further consolidation should be done.
- ${resp} RequestsLibrary.Get Request session ${REST_CONTEXT}/${CONTAINER}/port
- Log ${resp.content}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Contain X Times ${resp.content} ${node} ${count}
-
Check For Specific Number Of Elements At URI
[Arguments] ${uri} ${element} ${expected_count}
[Documentation] A GET is made to the specified ${URI} and the specific count of a
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
+ ${stdout} ${stderr} ${rc} SSHLibrary.Execute Command ${cmd} return_stderr=True return_rc=True
SSHLibrary.Close Connection
Log ${stderr}
[Teardown] SSHKeywords.Restore_Current_SSH_Connection_From_Index ${current_ssh_connection.index}
- [Return] ${stdout}
+ [Return] ${stdout} ${rc}
Write_Bare_Ctrl_C
[Documentation] Construct ctrl+c character and SSH-write it (without endline) to the current SSH connection.