diff --git a/Robot-Framework/config/variables.robot b/Robot-Framework/config/variables.robot index 61d8535..ec63267 100644 --- a/Robot-Framework/config/variables.robot +++ b/Robot-Framework/config/variables.robot @@ -7,9 +7,11 @@ Library OperatingSystem *** Variables *** -${BUILD_ID} ${EMPTY} -${SWITCH_TOKEN} ${EMPTY} -${SWITCH_SECRET} ${EMPTY} +${BUILD_ID} ${EMPTY} +${SWITCH_TOKEN} ${EMPTY} +${SWITCH_SECRET} ${EMPTY} +${TEST_WIFI_SSID} ${EMPTY} +${TEST_WIFI_PSWD} ${EMPTY} *** Keywords *** diff --git a/Robot-Framework/resources/ssh_keywords.resource b/Robot-Framework/resources/ssh_keywords.resource index ddf3173..37b613b 100644 --- a/Robot-Framework/resources/ssh_keywords.resource +++ b/Robot-Framework/resources/ssh_keywords.resource @@ -33,7 +33,9 @@ Check Network Availability Read Until 1 received Set Global Variable ${is_available} True Log To Console ${host} is available - BREAK + IF ${expected_result} == True + BREAK + END EXCEPT IF ${expected_result} == False Log To Console ${host} is unavailable diff --git a/Robot-Framework/test-suites/bat-tests/netvm.robot b/Robot-Framework/test-suites/bat-tests/netvm.robot index 642a5f2..714d1fa 100644 --- a/Robot-Framework/test-suites/bat-tests/netvm.robot +++ b/Robot-Framework/test-suites/bat-tests/netvm.robot @@ -12,9 +12,6 @@ Suite Teardown Close All Connections *** Variables *** ${netvm_ip} 192.168.101.1 -${SSID} test_network -${wifi_pswd} test1234 -${netwotk_ip} 192.168.1.1 ${netvm_state} ${EMPTY} ${ghaf_host_ssh} ${EMPTY} ${netvm_ssh} ${EMPTY} @@ -32,35 +29,15 @@ Verify NetVM is started Wifi passthrought into NetVM [Documentation] Verify that wifi works inside netvm - [Tags] bat SP-T50 - ... test:retry(1) - [Setup] Run Keywords - ... Connect to ghaf host AND Connect to netvm AND - ... Verify service status service=wpa_supplicant.service - Configure wifi ${netvm_ssh} ${SSID} ${wifi_pswd} - Get wifi IP - Check Network Availability ${netwotk_ip} expected_result=True - Log To Console Switch connection to Ghaf Host - Switch Connection ${ghaf_host_ssh} - Check Network Availability ${netwotk_ip} expected_result=False - Remove Wifi configuration - Check Network Availability ${netwotk_ip} expected_result=False - [Teardown] Run Keywords Remove Wifi configuration AND Close All Connections - -Wifi passthrought into NetVM on LenovoX1 - [Documentation] Verify that wifi works inside netvm on LenovoX1 laptop - [Tags] bat SP-T108 lenovo-x1 - ... test:retry(1) + [Tags] bat SP-T50 SP-T108 nuc orin-agx lenovo-x1 [Setup] Run Keywords ... Connect to ghaf host AND Connect to netvm - Configure wifi ${netvm_ssh} ${SSID} ${wifi_pswd} lenovo=True - Check Network Availability ${netwotk_ip} expected_result=True - Log To Console Switch connection to Ghaf Host - Switch Connection ${ghaf_host_ssh} - Check Network Availability ${netwotk_ip} expected_result=False - Remove Wifi configuration lenovo=True - Check Network Availability ${netwotk_ip} expected_result=False - [Teardown] Run Keywords Remove Wifi configuration lenovo=True AND Close All Connections + Configure wifi ${netvm_ssh} ${TEST_WIFI_SSID} ${TEST_WIFI_PSWD} + Get wifi IP + Check Network Availability 8.8.8.8 expected_result=True + Remove Wifi configuration ${TEST_WIFI_SSID} + Check Network Availability 8.8.8.8 expected_result=False + [Teardown] Run Keywords Remove Wifi configuration ${TEST_WIFI_SSID} AND Close All Connections NetVM stops and starts successfully [Documentation] Verify that NetVM stops properly and starts after that @@ -116,26 +93,18 @@ Restart NetVM Check if ssh is ready on netvm Configure wifi - [Arguments] ${netvm_ssh} ${SSID} ${passw} ${lenovo}=False - Switch Connection ${netvm_ssh} - Log To Console Configuring Wifi - IF ${lenovo} - Execute Command nmcli dev wifi connect ${SSID} password ${passw} sudo=True sudo_password=${PASSWORD} - ELSE - Execute Command sh -c "wpa_passphrase ${SSID} ${passw} > /etc/wpa_supplicant.conf" sudo=True sudo_password=${PASSWORD} - Execute Command systemctl restart wpa_supplicant.service sudo=True sudo_password=${PASSWORD} - END + [Arguments] ${netvm_ssh} ${SSID} ${passw} ${lenovo}=False + Switch Connection ${netvm_ssh} + Log To Console Configuring Wifi + Set Log Level NONE + Execute Command nmcli dev wifi connect ${SSID} password ${passw} sudo=True sudo_password=${PASSWORD} + Set Log Level INFO Remove Wifi configuration - [Arguments] ${lenovo}=False + [Arguments] ${SSID} Switch Connection ${netvm_ssh} Log To Console Removing Wifi configuration - IF ${lenovo} - Execute Command nmcli con down id ${SSID} sudo=True sudo_password=${PASSWORD} - ELSE - Execute Command rm /etc/wpa_supplicant.conf sudo=True sudo_password=${PASSWORD} - Execute Command systemctl restart wpa_supplicant.service sudo=True sudo_password=${PASSWORD} - END + Execute Command nmcli con down id ${SSID} sudo=True sudo_password=${PASSWORD} Stop NetVM [Documentation] Ensure that NetVM is started, stop it and check the status.