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/extended/test_user_management.robot b/extended/test_user_management.robot
index 180ce7f..9523477 100644
--- a/extended/test_user_management.robot
+++ b/extended/test_user_management.robot
@@ -3,6 +3,7 @@
 
 Resource         ../lib/rest_client.robot
 Resource         ../lib/openbmc_ffdc.robot
+Resource         ../lib/utils.robot
 Library          SSHLibrary
 
 Test Teardown    Test Teardown Execution
@@ -69,20 +70,3 @@
 
     FFDC On Test Case Fail
     Close All Connections
-
-
-Update Root Password
-    [Documentation]  Update system default "root" user password.
-    [Arguments]  ${user_password}=${OPENBMC_PASSWORD}
-
-    # Description of argument(s):
-    # user_password  User password string.
-
-    @{password} =  Create List  ${user_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}.
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}.
diff --git a/remote_logging/test_remote_logging.robot b/remote_logging/test_remote_logging.robot
index ddfc3ff..4c0fb90 100644
--- a/remote_logging/test_remote_logging.robot
+++ b/remote_logging/test_remote_logging.robot
@@ -209,11 +209,17 @@
     [Documentation]  Check that BMC journald doesn't log any credential data.
     [Tags]  Verify_BMC_Journald_Contains_No_Credential_Data
 
+    Initialize OpenBMC
+    Update Root Password  ${REST_PASSWORD}
+
+    # Time for user manager to sync.
+    Sleep  5 s
+
     Open Connection And Log In
     ${bmc_journald}  ${stderr}  ${rc}=  BMC Execute Command
     ...  journalctl -o json-pretty | cat
 
-    Should Not Contain Any  ${bmc_journald}  ${OPENBMC_PASSWORD}
+    Should Not Contain Any  ${bmc_journald}  ${OPENBMC_PASSWORD}  ${REST_PASSWORD}
     ...  msg=Journald logs BMC credentials/password ${OPENBMC_PASSWORD}.