FFDC REST data pretty print logging and resource fix
The changes fixes logging in pretty print format to the
FFDC file and include rest_client.robot for making GET
call for the interfaces for REST.
Resolves openbmc/openbmc-test-automation#144
Change-Id: I6c4a833e2f76a0d4f6f291ab8dd8546d02e91146
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 39d2796..5c4b9cf 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -3,6 +3,7 @@
... data to a list of FFDC files
Resource openbmc_ffdc_utils.robot
+Resource rest_client.robot
*** Keywords ***
@@ -139,14 +140,18 @@
[Documentation] Create file in current FFDC log directory.
... Do openbmc get request and write to
... corresponding file name.
+ ... JSON pretty print for logging to file.
[Arguments] ${key_index}
@{cmd_list}= Get ffdc get request ${key_index}
:FOR ${cmd} IN @{cmd_list}
\ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}
\ ${resp}= OpenBMC Get Request ${cmd[1]}
- \ ${jsondata}= to json ${resp.content}
- \ Write Data to File ${jsondata["data"]}${\n} ${logpath}
+ \ ${status}= Run Keyword and Return Status
+ ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ \ Run Keyword If '${status}' == '${False}' Continue For Loop
+ \ ${jsondata}= to json ${resp.content} pretty_print=True
+ \ Write Data to File ${\n}${jsondata}${\n} ${logpath}
BMC FFDC Get Requests