Convert HTTPS response to JSON and return
Changes:
- This is needed for test caller to be able to access to JSON
data from login session.
Example of the response:
{
'@odata.id': '/redfish/v1/SessionService/Sessions/ZZNZ3SYN0i',
'@odata.type': '#Session.v1_0_2.Session',
'Description': 'Manager User Session',
'Id': 'ZZNZ3SYN0i',
'Name': 'User Session',
'Oem': {
'OpenBMC': {
'@odata.type': '#OemSession.v1_0_0.Session',
'ClientID': '123456',
'ClientOriginIP': '::ffff:xx.xx.xx.xx'
}
},
'UserName': 'root'
}
Tested:
By adding a piece of test code as
${resp}= Redfish Login kwargs= "Oem":{"OpenBMC" : {"ClientID":"123456"}}
Log To Console \n Session ID: ${resp["Id"]}
${resp}= Redfish Login
Log To Console \n Session ID: ${resp["Id"]}
Output:
Session ID: RNUnVGoyIF
Session ID: ipDXBgxDjg
Change-Id: I14ce07287ba3c30761e1c8f1a28c34a74d87e9c7
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/rest_client.robot b/lib/rest_client.robot
index 423ab0d..2b70d54 100644
--- a/lib/rest_client.robot
+++ b/lib/rest_client.robot
@@ -396,6 +396,8 @@
... data=${data} headers=${headers}
Should Be Equal As Strings ${resp.status_code} ${HTTP_CREATED}
+ ${content}= To JSON ${resp.content}
+
Set Global Variable ${XAUTH_TOKEN} ${resp.headers["X-Auth-Token"]}
- [Return] ${resp}
+ [Return] ${content}