blob: e91aedd861cd495ec992ec6cc8ae848a47c84ed7 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
Felipe Vicensf96bb452020-06-22 08:12:30 +02002# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
garciadeblas7a9e0312023-12-11 22:24:46 +010014
15*** Settings ***
16Documentation Library providing keywords for testing connectivity to hosts via ping.
17Library OperatingSystem
18
19
garciadeblas36b03122020-09-25 09:39:31 +000020*** Variables ***
garciadeblas7a9e0312023-12-11 22:24:46 +010021${SUCCESS_RETURN_CODE} 0
22${CONNECTIVITY_POL_TIME} 5sec
23${CONNECTIVITY_MAX_WAIT_TIME} 30sec
24
garciadeblas36b03122020-09-25 09:39:31 +000025
Felipe Vicensf96bb452020-06-22 08:12:30 +020026*** Keywords ***
garciadeblas36b03122020-09-25 09:39:31 +000027Test Ping Host
28 [Documentation] Run Ping
29 ... Parameters:
30 ... host: IP or name of the host
31 ... Execution example:
32 ... Ping Test \${host}
garciadeblasf4ebaa82022-06-23 13:33:26 +020033 [Arguments] ${host}
garciadeblas7a9e0312023-12-11 22:24:46 +010034 ${rc} ${stdout}= Run And Return Rc And Output ping -c 2 -W 1 ${host}
garciadeblas321726f2022-12-21 11:43:06 +010035 Log ${stdout}
garciadeblas7a9e0312023-12-11 22:24:46 +010036 Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE}
garciadeblas36b03122020-09-25 09:39:31 +000037
Felipe Vicensf96bb452020-06-22 08:12:30 +020038Test Connectivity
garciadeblas7a9e0312023-12-11 22:24:46 +010039 [Documentation] Ping a host several times during ${CONNECTIVITY_MAX_WAIT_TIME} until it succeeds or raises a timeout.
garciadeblasf4ebaa82022-06-23 13:33:26 +020040 [Arguments] ${host}
garciadeblas7a9e0312023-12-11 22:24:46 +010041 Wait Until Keyword Succeeds ${CONNECTIVITY_MAX_WAIT_TIME} ${CONNECTIVITY_POL_TIME} Test Ping Host ${host}