Set netstat command in a variable 72/72672/4
authorLuis Gomez <ecelgp@gmail.com>
Mon, 4 Jun 2018 21:03:01 +0000 (14:03 -0700)
committerSam Hague <shague@redhat.com>
Mon, 4 Jun 2018 21:18:55 +0000 (21:18 +0000)
Some systems may need to add sudo or even change the command
(e.g. lsof in MacOS)

Change-Id: Ife06559dd3cd8ff76b5b433d687bd7bbbb48b9b6
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
csit/libraries/SSHKeywords.robot

index eea009d98cb718b2a1daf4308a641d7884844ff0..2b83a592f6a1723ee4eaab7a250827d9ce2f568f 100644 (file)
@@ -19,6 +19,7 @@ Resource          ../variables/Variables.robot
 *** Variables ***
 ${SSHKeywords__current_remote_working_directory}    .
 ${SSHKeywords__current_venv_path}    /tmp/defaultvenv
+${NETSTAT_COMMAND}    netstat -punta
 
 *** Keywords ***
 Open_Connection_To_ODL_System
@@ -155,7 +156,7 @@ Assure_Library_Counter
 Count_Port_Occurences
     [Arguments]    ${port}    ${state}    ${name}
     [Documentation]    Run 'netstat' on the remote machine and count occurences of given port in the given state connected to process with the given name.
-    ${output} =    SSHLibrary.Execute_Command    netstat -natp 2> /dev/null | grep -E ":${port} .+ ${state} .+${name}" | wc -l
+    ${output} =    SSHLibrary.Execute_Command    ${NETSTAT_COMMAND} 2> /dev/null | grep -E ":${port} .+ ${state} .+${name}" | wc -l
     [Return]    ${output}
 
 Virtual_Env_Set_Path