Improve REST success rate by retry attempt
The changes involves:
- Increase retry login session Authentication
- Add delete sessions in utils
Resolves openbmc/openbmc-test-automation#94
Change-Id: Icad3044bbe0e9c345ed3633b5e72d6e170e3ed52
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/rest_client.robot b/lib/rest_client.robot
index bd2db37..3d7a36c 100644
--- a/lib/rest_client.robot
+++ b/lib/rest_client.robot
@@ -100,7 +100,7 @@
[Return] ${ret}
Initialize OpenBMC
- Create Session openbmc ${AUTH_URI} timeout=5 max_retries=1
+ Create Session openbmc ${AUTH_URI} timeout=5 max_retries=3
${headers}= Create Dictionary Content-Type=application/json
@{credentials} = Create List ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
${data} = create dictionary data=@{credentials}
@@ -132,7 +132,7 @@
[Arguments] ${uri} ${attr} &{kwargs}
${base_uri}= Catenate SEPARATOR= ${DBUS_PREFIX} ${uri}
${resp} = openbmc put request ${base_uri}/attr/${attr} &{kwargs}
- should be equal as strings ${resp.status_code} ${HTTP_OK}
+ should be equal as strings ${resp.status_code} ${HTTP_OK}
${json} = to json ${resp.content}
Read Properties
diff --git a/lib/utils.robot b/lib/utils.robot
index 2a4a01f..572c901 100644
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -207,4 +207,7 @@
Return From Keyword If '${alive}' == '${False}' ${False}
[return] ${True}
+Flush REST Sessions
+ [Documentation] Removes all the active session objects
+ Delete All Sessions
diff --git a/tests/test_networkd.robot b/tests/test_networkd.robot
index 973e590..a7927e1 100755
--- a/tests/test_networkd.robot
+++ b/tests/test_networkd.robot
@@ -25,7 +25,7 @@
should not be empty ${resp.content}
${json} = to json ${resp.content}
should be equal as strings ${json['status']} ok
- set suite variable ${OLD_MAC_ADDRESS} ${json['data']}
+ set suite variable ${OLD_MAC_ADDRESS} ${json['data']}
Get IP Address with invalid interface
@@ -128,7 +128,7 @@
${arglist}= Create List eth0 ${NEW_IP} ${NEW_MASK} ${NEW_GATEWAY}
${args}= Create Dictionary data=@{arglist}
run keyword and ignore error Call Method /org/openbmc/NetworkManager/Interface/ SetAddress4 data=${args}
-
+
Wait For Host To Ping ${NEW_IP}
Set Suite Variable ${AUTH_URI} https://${NEW_IP}
log to console ${AUTH_URI}
@@ -171,8 +171,8 @@
Get IP Address type
[Tags] GOOD-PATH
- [Documentation] This test case tries to set existing ipaddress address and
- ... later tries to verify that ip address type is set to static
+ [Documentation] This test case tries to set existing ipaddress address and
+ ... later tries to verify that ip address type is set to static
... due to the operation.
${networkInfo}= Get networkInfo from the interface eth0
@@ -187,7 +187,7 @@
run keyword and ignore error Call Method /org/openbmc/NetworkManager/Interface/ SetAddress4 data=${args}
Wait For Host To Ping ${CURRENT_IP}
-
+
@{arglist}= Create List eth0
${args}= Create Dictionary data=@{arglist}
${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetAddressType data=${args}
@@ -202,7 +202,7 @@
... will request for the ip address to check the persistency
... of the ip address.
... Expectation is the ip address should persist.
-
+
Open Connection And Log In
Execute Command reboot
# sleep 100sec
@@ -223,7 +223,7 @@
Set invalid Mac address eth0 gg:hh:jj:kk:ll:mm error
[Tags] network_test
[Template] SetMacAddress_bad
- [Documentation] This test case tries to set the invalid mac address
+ [Documentation] This test case tries to set the invalid mac address
... on the eth0 interface.
... Expectation is that it should throw error.
@@ -235,7 +235,7 @@
... This test case add the ip addresson the interface and validates
... that ip address has been added or not.
... Expectation is the ip address should get added.
-
+
Revert old Mac address eth0 ${OLD_MAC_ADDRESS} ok
[Tags] network_test
[Template] SetMacAddress_good
@@ -290,7 +290,7 @@
SetMacAddress_good
[Arguments] ${intf} ${address} ${result}
- ${arglist}= Create List ${intf} ${address}
+ ${arglist}= Create List ${intf} ${address}
${args}= Create Dictionary data=@{arglist}
${resp}= Call Method /org/openbmc/NetworkManager/Interface/ SetHwAddress data=${args}
should be equal as strings ${resp.status_code} ${HTTP_OK}
@@ -303,7 +303,7 @@
${resp}= Call Method /org/openbmc/NetworkManager/Interface/ GetHwAddress data=${args}
${json} = to json ${resp.content}
should be equal as strings ${json['data']} ${address}
-
+
validateEnvVariables
@@ -311,7 +311,7 @@
${NEW_SUBNET_MASK}= Get Environment Variable NEW_SUBNET_MASK
${NEW_GATEWAY}= Get Environment Variable NEW_GATEWAY
-
- should not be empty ${NEW_BMC_IP}
- should not be empty ${NEW_GATEWAY}
- should not be empty ${NEW_SUBNET_MASK}
+
+ should not be empty ${NEW_BMC_IP}
+ should not be empty ${NEW_GATEWAY}
+ should not be empty ${NEW_SUBNET_MASK}