Check for REST password logged in journald
Changes:
- Added code to update password.
- Added check for REST_PASSWORD footprint.
- Move "Update Root Password" keyword to lib/utils.robot.
Change-Id: Id1989a87e4169335cd0033f4de8049bca8e4a803
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index c4cd4d5..72dbc96 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1580,3 +1580,19 @@
Write Attribute ${BMC_LOGGING_URI}${/}rest_api_logs Enabled
... data=${log_dict} verify=${1} expected_value=${policy_setting}
+
+Update Root Password
+ [Documentation] Update system "root" user password.
+ [Arguments] ${openbmc_password}=${OPENBMC_PASSWORD}
+
+ # Description of argument(s):
+ # openbmc_password The root password for the open BMC system.
+
+ @{password} = Create List ${openbmc_password}
+ ${data} = Create Dictionary data=@{password}
+
+ ${headers} = Create Dictionary Content-Type=application/json
+ ${resp} = Post Request openbmc ${BMC_USER_URI}root/action/SetPassword
+ ... data=${data} headers=${headers}
+ Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ ... msg=Updating the new root password failed, RC=${resp.status_code}.