diff --git a/Robot-Framework/resources/serial_keywords.resource b/Robot-Framework/resources/serial_keywords.resource index f7c3bd7..bd23b86 100644 --- a/Robot-Framework/resources/serial_keywords.resource +++ b/Robot-Framework/resources/serial_keywords.resource @@ -27,7 +27,6 @@ Check Serial Connection ${output} = SerialLibrary.Read Until ${status} = Run Keyword And Return Status Should contain ${output} ghaf IF ${status} BREAK - Log To Console ${output} Sleep 1 END Delete All Ports diff --git a/Robot-Framework/resources/ssh_keywords.resource b/Robot-Framework/resources/ssh_keywords.resource index 88d9b5f..4d16dfd 100644 --- a/Robot-Framework/resources/ssh_keywords.resource +++ b/Robot-Framework/resources/ssh_keywords.resource @@ -279,3 +279,23 @@ Get wifi IP Sleep 1 END IF ${status} == False FAIL NetVM hasn't gotten an IP + +Check if ssh is ready on device + [Arguments] ${timeout}=30 + ${is_ready} = Set Variable False + FOR ${i} IN RANGE ${timeout} + ${rc} ${output} Run And Return Rc And Output nc -zvw3 ${DEVICE_IP_ADDRESS} 22 + ${status} Run Keyword And Return Status + ... Should Be Equal As Integers ${rc} 0 + IF ${status} + Log to console ${output} + ${is_ready} = Set Variable True + BREAK + END + Sleep 1 + END + IF ${is_ready} == False + Log to console Port 22 (ssh) of ${DEVICE} is not ready after ${timeout} + END + + [Return] ${is_ready} diff --git a/Robot-Framework/test-suites/boot_test.robot b/Robot-Framework/test-suites/boot_test.robot index d2e1529..803b38e 100644 --- a/Robot-Framework/test-suites/boot_test.robot +++ b/Robot-Framework/test-suites/boot_test.robot @@ -54,19 +54,30 @@ Teardown Check If Device Is Up [Arguments] ${range}=20 + Set Global Variable ${IS_AVAILABLE} False ${start_time}= Get Time epoch FOR ${i} IN RANGE ${range} ${ping}= Ping Host ${DEVICE_IP_ADDRESS} IF ${ping} - Set Global Variable ${IS_AVAILABLE} True + Log To Console Ping ${DEVICE_IP_ADDRESS} successfull BREAK END END + + IF ${ping} + ${port_22_is_available} Check if ssh is ready on device + IF ${port_22_is_available} + Set Global Variable ${IS_AVAILABLE} True + ELSE + Set Global Variable ${IS_AVAILABLE} False + END + END + ${diff}= Evaluate int(time.time()) - int(${start_time}) IF ${IS_AVAILABLE} Log To Console Device woke up after ${diff} sec. - IF ${ping}==False + IF ${IS_AVAILABLE} == False Log To Console Device is not available after reboot via SSH, waited for ${diff} sec! IF "${SERIAL_PORT}" == "NONE" Log To Console There is no address for serial connection