blob: 5ca03b0651b730face760050b7c4a46dc213c889 [file] [log] [blame]
George Keishingf1331672018-01-18 05:19:02 -06001*** Settings ***
2Documentation OpenBMC user management test.
3
Sweta Potthuria659ad22018-01-31 12:24:51 -06004Resource ../lib/rest_client.robot
5Resource ../lib/openbmc_ffdc.robot
George Keishingf1331672018-01-18 05:19:02 -06006Library SSHLibrary
7
8Test Teardown Test Teardown Execution
9
10*** Variables ****
11
12${test_password} abc123
13
14*** Test Cases ***
15
Sivas SRR1a7502d2018-09-19 03:31:54 -050016
17Verify At Least One User In List
18 [Documentation] Verify user list API list minimum one user.
19 [Tags] Verify_At_Least_One_User_In_List
20
21 ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list
22 Should Not Be Empty ${bmc_user_uris}
23
24
George Keishingf1331672018-01-18 05:19:02 -060025Verify Root Password Update
26 [Documentation] Update system "root" user password and verify.
27 [Tags] Verify_Root_Password_Update
28
29 Delete All Sessions
30
31 Initialize OpenBMC
32 Update Root Password ${test_password}
33
34 # Time for user manager to sync.
35 Sleep 5 s
36
37 Delete All Sessions
38
39 # SSH Login to BMC with new "root" password.
40 SSHLibrary.Open Connection ${OPENBMC_HOST}
41 Login ${OPENBMC_USERNAME} ${test_password}
42
43 # REST Login to BMC with new "root" password.
44 Initialize OpenBMC OPENBMC_PASSWORD=${test_password}
45
46 ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate
47 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
48 ... msg=Verify of new root password failed, RC=${resp.status_code}.
49
50
51*** Keywords ***
52
53Test Teardown Execution
54 [Documentation] Do test teardown task.
55
56 # REST Login to BMC with new "root" password.
57 Initialize OpenBMC OPENBMC_PASSWORD=${test_password}
58 Update Root Password
59 Sleep 5 s
60 Delete All Sessions
61
62 # SSH Login to BMC with user default "root" password.
63 SSHLibrary.Open Connection ${OPENBMC_HOST}
64 Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
65
66 # REST Login to BMC with user default "root" password.
67 Initialize OpenBMC
68
69 FFDC On Test Case Fail
70 Close All Connections
71
72
73Update Root Password
74 [Documentation] Update system default "root" user password.
75 [Arguments] ${user_password}=${OPENBMC_PASSWORD}
76
77 # Description of argument(s):
78 # user_password User password string.
79
80 @{password} = Create List ${user_password}
81 ${data} = Create Dictionary data=@{password}
82
83 ${headers} = Create Dictionary Content-Type=application/json
84 ${resp} = Post Request openbmc ${BMC_USER_URI}root/action/SetPassword
85 ... data=${data} headers=${headers}
86 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
87 ... msg=Updating the new root password failed, RC=${resp.status_code}.