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