| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 2 | # 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 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 14 | |
| 15 | *** Settings *** |
| 16 | Documentation Library providing keywords for testing connectivity to hosts via ping. |
| 17 | Library OperatingSystem |
| 18 | |
| 19 | |
| garciadeblas | 36b0312 | 2020-09-25 09:39:31 +0000 | [diff] [blame] | 20 | *** Variables *** |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 21 | ${SUCCESS_RETURN_CODE} 0 |
| 22 | ${CONNECTIVITY_POL_TIME} 5sec |
| 23 | ${CONNECTIVITY_MAX_WAIT_TIME} 30sec |
| 24 | |
| garciadeblas | 36b0312 | 2020-09-25 09:39:31 +0000 | [diff] [blame] | 25 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 26 | *** Keywords *** |
| garciadeblas | 36b0312 | 2020-09-25 09:39:31 +0000 | [diff] [blame] | 27 | Test Ping Host |
| 28 | [Documentation] Run Ping |
| 29 | ... Parameters: |
| 30 | ... host: IP or name of the host |
| 31 | ... Execution example: |
| 32 | ... Ping Test \${host} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 33 | [Arguments] ${host} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 34 | ${rc} ${stdout}= Run And Return Rc And Output ping -c 2 -W 1 ${host} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 35 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 36 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} |
| garciadeblas | 36b0312 | 2020-09-25 09:39:31 +0000 | [diff] [blame] | 37 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 38 | Test Connectivity |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 39 | [Documentation] Ping a host several times during ${CONNECTIVITY_MAX_WAIT_TIME} until it succeeds or raises a timeout. |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 40 | [Arguments] ${host} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 41 | Wait Until Keyword Succeeds ${CONNECTIVITY_MAX_WAIT_TIME} ${CONNECTIVITY_POL_TIME} Test Ping Host ${host} |