*** Settings ***
Library SSHLibrary
+Library String
Library ./UtilLibrary.py
Resource KarafKeywords.txt
[Arguments] ${node}
[Documentation] A GET on the /node/${node} API is made and specific flow stat
... strings are checked for existence.
- ${resp} RequestsLibrary.Get session ${REST_CONTEXT}/node/${node}
+ ${resp} RequestsLibrary.Get session ${OPERATIONAL_NODES_API}/node/${node}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} flow-capable-node-connector-statistics
Should Contain ${resp.content} flow-table-statistics
${value}= Run Keyword If '${strip}' == 'strip' Strip Quotes ${value}
[Return] ${value}
+Get Process ID Based On Regex On Remote System
+ [Documentation] Uses ps to find a process that matches the supplied regex. Returns the PID of that process
+ ... The ${regex_string_to_match_on} should produce a unique process otherwise the PID returned may not be
+ ... the expected PID
+ [Arguments] ${remote_system} ${regex_string_to_match_on}
+ # doing the extra -v grep in this command to exclude the grep process itself from the output
+ ${output}= Run Command On Remote System ${remote_system} ps -elf | grep -v grep | grep ${regex_string_to_match_on} | awk '{print $4}'
+ # ${output} contains the system prompt and all we want is the value of the number
+ ${pid}= Fetch From Left ${output} \r
+ [Return] ${pid}
+
+Get Process Thread Count On Remote System
+ [Documentation] Executes the ps command to retrieve the lightweight process (aka thread) count.
+ [Arguments] ${remote_system} ${pid}
+ ${output}= Run Command On Remote System ${remote_system} ps --no-headers -o nlwp ${pid}
+ # ${output} contains the system prompt and all we want is the value of the number
+ ${thread_count}= Fetch From Left ${output} \r
+ [Return] ${thread_count}
+
Strip Quotes
[Arguments] ${string_to_strip}
[Documentation] Will strip ALL quotes from given string and return the new string
... taking care to log in with a public key and. The command given is written and the output returned. No test conditions
... are checked.
Log Attempting to execute ${cmd} on ${remote_system}
- ${conn_id}= Open Connection ${remote_system} prompt=${prompt} timeout=${prompt_timeout}
+ ${conn_id}= SSHLibrary.Open Connection ${remote_system} prompt=${prompt} timeout=${prompt_timeout}
Login With Public Key ${user} ${USER_HOME}/.ssh/id_rsa any
- Write ${cmd}
- ${output}= Read Until ${linux_prompt}
- Close Connection
+ SSHLibrary.Write ${cmd}
+ ${output}= SSHLibrary.Read Until ${linux_prompt}
+ SSHLibrary.Close Connection
+ Log ${output}
[Return] ${output}
Verify File Exists On Remote System