Revert test REST user management
Code pulled from branch v2.0-stable file extended/test_user_management.robot
due to backward compatibility support.
Change-Id: Iba3ea00db86d9f9f0f01462653589fd10c21e4d6
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/test_rest_user_management.robot b/extended/test_rest_user_management.robot
new file mode 100644
index 0000000..5919a83
--- /dev/null
+++ b/extended/test_rest_user_management.robot
@@ -0,0 +1,71 @@
+*** Settings ***
+Documentation OpenBMC user management test.
+
+Resource ../lib/rest_client.robot
+Resource ../lib/openbmc_ffdc.robot
+Resource ../lib/utils.robot
+Library SSHLibrary
+
+Test Teardown Test Teardown Execution
+
+*** Variables ****
+
+${test_password} 0penBmc123
+
+*** Test Cases ***
+
+
+Verify At Least One User In List
+ [Documentation] Verify user list API list minimum one user.
+ [Tags] Verify_At_Least_One_User_In_List
+ [Teardown] FFDC On Test Case Fail
+
+ ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list
+ Valid Value bmc_user_uris
+
+
+Verify Root Password Update
+ [Documentation] Update system "root" user password and verify.
+ [Tags] Verify_Root_Password_Update
+
+ Delete All Sessions
+
+ Initialize OpenBMC
+ Update Root Password ${test_password}
+
+ # Time for user manager to sync.
+ Sleep 5 s
+
+ Delete All Sessions
+
+ # SSH Login to BMC with new "root" password.
+ SSHLibrary.Open Connection ${OPENBMC_HOST}
+ SSHLibrary.Login ${OPENBMC_USERNAME} ${test_password}
+
+ # REST Login to BMC with new "root" password.
+ Initialize OpenBMC rest_password=${test_password}
+
+ ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate
+ Valid Value resp.status_code [${HTTP_OK}]
+
+
+*** Keywords ***
+
+Test Teardown Execution
+ [Documentation] Do test teardown task.
+
+ # REST Login to BMC with new "root" password.
+ Initialize OpenBMC rest_password=${test_password}
+ Update Root Password
+ Sleep 5 s
+ Delete All Sessions
+
+ # SSH Login to BMC with user default "root" password.
+ SSHLibrary.Open Connection ${OPENBMC_HOST}
+ SSHLibrary.Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
+
+ # REST Login to BMC with user default "root" password.
+ Initialize OpenBMC
+
+ FFDC On Test Case Fail
+ Close All Connections
diff --git a/lib/utils.robot b/lib/utils.robot
index 34fa216..ab5faec 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -20,6 +20,7 @@
Library utils.py
Library var_funcs.py
Library SCPLibrary WITH NAME scp
+Library gen_robot_valid.py
*** Variables ***
@@ -696,3 +697,19 @@
${bmc_time_via_date} ${stderr} ${rc}= BMC Execute Command date +"%Y-%m-%d %H:%M:%S" print_err=1
[Return] ${bmc_time_via_date}
+
+
+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 X-Auth-Token=${XAUTH_TOKEN}
+ ${resp}= Post Request openbmc ${BMC_USER_URI}root/action/SetPassword
+ ... data=${data} headers=${headers}
+ Valid Value resp.status_code [${HTTP_OK}]