X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fssh_lib.robot;h=3e3c00b58bebb7ee76ca7ae73fecca02a2a3b010;hb=43f34481b4c5ccfda407a7f82a124012aab0dccc;hp=216cd59347d55feba20b1becc243a8a78364fb4a;hpb=6cd74807debed3f4414da8b4d3fc4c17b1b56c14;p=osm%2Ftests.git diff --git a/robot-systest/lib/ssh_lib.robot b/robot-systest/lib/ssh_lib.robot index 216cd59..3e3c00b 100644 --- a/robot-systest/lib/ssh_lib.robot +++ b/robot-systest/lib/ssh_lib.robot @@ -14,7 +14,7 @@ Test SSH Connection [Arguments] ${host} ${username} ${password} ${privatekey} - Open Connection ${host} + Open Connection ${host} Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} ... ELSE Login With Public Key ${username} ${privatekey} Execute Command hostname @@ -24,8 +24,8 @@ Check If remote File Exists [Arguments] ${host} ${username} ${password} ${privatekey} ${file} Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} ${rc}= Execute Command ls ${file} >& /dev/null return_stdout=False return_rc=True Close All Connections Should Be Equal As Integers ${rc} 0 @@ -34,32 +34,32 @@ Check If Remote Folder Exists [Arguments] ${host} ${username} ${password} ${privatekey} ${folder} Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} ${output}= Execute Command ls -d ${folder} Close All Connections Should Be Equal As Strings ${output} ${folder} Get Remote File Content - [Arguments] ${host} ${username} ${password} ${privatekey} ${file} + [Arguments] ${host} ${username} ${password} ${privatekey} ${file} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + Open Connection ${host} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} ${output}= Execute Command cat ${file} Close All Connections [Return] ${output} Ping Many - [Arguments] ${host} ${username} ${password} ${privatekey} @{ip_list} + [Arguments] ${host} ${username} ${password} ${privatekey} @{ip_list} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + Open Connection ${host} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} FOR ${ip} IN @{ip_list} - ${result}= Execute Command ping -c 5 -W 1 ${ip} > /dev/null && echo OK shell=True - Log ${result} - Should Contain ${result} OK + ${result}= Execute Command ping -c 5 -W 1 ${ip} > /dev/null && echo OK shell=True + Log ${result} + Should Contain ${result} OK END Close All Connections @@ -68,11 +68,11 @@ Execute Remote Command Check Rc Return Output [Arguments] ${host} ${username} ${password} ${privatekey} ${command} Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} + ... ELSE Login With Public Key ${username} ${privatekey} ${stdout} ${rc}= Execute Command ${command} return_rc=True return_stdout=True - log ${rc} - log ${stdout} + Log ${rc} + Log ${stdout} Close All Connections Should Be Equal As Integers ${rc} 0 [Return] ${stdout}