X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Ftests.git;a=blobdiff_plain;f=robot-systest%2Flib%2Fssh_lib.robot;fp=robot-systest%2Flib%2Fssh_lib.robot;h=0000000000000000000000000000000000000000;hp=3e3c00b58bebb7ee76ca7ae73fecca02a2a3b010;hb=7a9e031926d2fa7ed5041485b3d41b0c1e85d2a9;hpb=23ff8f980f66ef57fb4d254336a018e3a697a187 diff --git a/robot-systest/lib/ssh_lib.robot b/robot-systest/lib/ssh_lib.robot deleted file mode 100644 index 3e3c00b..0000000 --- a/robot-systest/lib/ssh_lib.robot +++ /dev/null @@ -1,79 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Keywords *** -Test SSH Connection - [Arguments] ${host} ${username} ${password} ${privatekey} - - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} - Execute Command hostname - Close All Connections - -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} - ${rc}= Execute Command ls ${file} >& /dev/null return_stdout=False return_rc=True - Close All Connections - Should Be Equal As Integers ${rc} 0 - -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} - ${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} - - 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} - - 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 - END - Close All Connections - - -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} - ${stdout} ${rc}= Execute Command ${command} return_rc=True return_stdout=True - Log ${rc} - Log ${stdout} - Close All Connections - Should Be Equal As Integers ${rc} 0 - [Return] ${stdout} -