[VOL-2264] Radius Restart Scenario-Update the tests to include re-authentication case
Change-Id: Ie26b992f97e7ae8090d389e6e92e4a0c14ac16e0
diff --git a/libraries/utils.robot b/libraries/utils.robot
index 58c039a..62c8569 100644
--- a/libraries/utils.robot
+++ b/libraries/utils.robot
@@ -89,4 +89,30 @@
... voltha-ro-core voltha-rw-core-11 voltha-rw-core-12 voltha-ofagent
Set Suite Variable ${container_list}
${datetime}= Get Current Date
- Set Suite Variable ${datetime}
\ No newline at end of file
+ Set Suite Variable ${datetime}
+
+WPA Reassociate
+ [Arguments] ${iface} ${ip} ${user} ${pass}=${None} ${container_type}=${None} ${container_name}=${None}
+ [Documentation] Executes a particular wpa_cli reassociate, which performs force reassociation
+ #Below for loops are used instead of sleep time, to execute reassociate command and check status
+ : FOR ${i} IN RANGE 70
+ \ ${output}= Login And Run Command On Remote System wpa_cli -i ${iface} reassociate ${ip} ${user}
+ ... ${pass} ${container_type} ${container_name}
+ \ ${passed}= Run Keyword And Return Status Should Contain ${output} OK
+ \ Run Keyword If ${passed} Exit For Loop
+ : FOR ${i} IN RANGE 70
+ \ ${output}= Login And Run Command On Remote System wpa_cli status | grep SUCCESS ${ip} ${user}
+ ... ${pass} ${container_type} ${container_name}
+ \ ${passed}= Run Keyword And Return Status Should Contain ${output} SUCCESS
+ \ Run Keyword If ${passed} Exit For Loop
+
+Validate Authentication After Reassociate
+ [Arguments] ${auth_pass} ${iface} ${ip} ${user} ${pass}=${None} ${container_type}=${None} ${container_name}=${None}
+ [Documentation] Executes a particular reassociate request on the RG using wpa_cli. auth_pass determines if authentication should pass
+ WPA Reassociate ${iface} ${ip} ${user} ${pass} ${container_type} ${container_name}
+ Run Keyword If '${auth_pass}' == 'True' Wait Until Keyword Succeeds ${timeout} 2s Check Remote File Contents
+ ... True /tmp/wpa.log authentication completed successfully ${ip} ${user} ${pass}
+ ... ${container_type} ${container_name}
+ Run Keyword If '${auth_pass}' == 'False' Sleep 20s
+ Run Keyword If '${auth_pass}' == 'False' Check Remote File Contents False /tmp/wpa.log
+ ... authentication completed successfully ${ip} ${user} ${pass} ${container_type} ${container_name}