blob: 6010dd89d4c93db10b4f87d91b4ab29eb9d9859a [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 Keishingc25c55d2018-10-30 02:23:44 -05006Resource ../lib/utils.robot
George Keishingf1331672018-01-18 05:19:02 -06007Library SSHLibrary
8
9Test Teardown Test Teardown Execution
10
11*** Variables ****
12
George Keishingcf3df712018-10-29 09:12:58 -050013${test_password} 0penBmc123
George Keishingf1331672018-01-18 05:19:02 -060014
15*** Test Cases ***
16
Sivas SRR1a7502d2018-09-19 03:31:54 -050017
18Verify At Least One User In List
19 [Documentation] Verify user list API list minimum one user.
20 [Tags] Verify_At_Least_One_User_In_List
George Keishingb24adb32018-10-29 13:20:08 -050021 [Teardown] FFDC On Test Case Fail
Sivas SRR1a7502d2018-09-19 03:31:54 -050022
23 ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list
24 Should Not Be Empty ${bmc_user_uris}
25
26
Sivas SRRdc10cc82018-10-30 10:53:32 -050027Verify User Group And Privilege Created
28 [Documentation] Verify user group and associated privilege is created.
29 [Tags] Verify_User_Group_And_Privilege_Created
30 [Teardown] FFDC On Test Case Fail
31
32 Create Group And Privilege ${GROUP_NAME} ${GROUP_PRIVILEGE}
33 ${bmc_user_uris}= Read Properties ${BMC_USER_URI}ldap/enumerate
34 ${bmc_user_uris}= Convert To String ${bmc_user_uris}
35 Should Contain ${bmc_user_uris} ${GROUP_NAME}
36 Should Contain ${bmc_user_uris} ${GROUP_PRIVILEGE}
37
38
George Keishingf1331672018-01-18 05:19:02 -060039Verify Root Password Update
40 [Documentation] Update system "root" user password and verify.
41 [Tags] Verify_Root_Password_Update
42
43 Delete All Sessions
44
45 Initialize OpenBMC
46 Update Root Password ${test_password}
47
48 # Time for user manager to sync.
49 Sleep 5 s
50
51 Delete All Sessions
52
53 # SSH Login to BMC with new "root" password.
54 SSHLibrary.Open Connection ${OPENBMC_HOST}
55 Login ${OPENBMC_USERNAME} ${test_password}
56
57 # REST Login to BMC with new "root" password.
George Keishingcf3df712018-10-29 09:12:58 -050058 Initialize OpenBMC REST_PASSWORD=${test_password}
George Keishingf1331672018-01-18 05:19:02 -060059
60 ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate
61 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
62 ... msg=Verify of new root password failed, RC=${resp.status_code}.
63
64
65*** Keywords ***
66
67Test Teardown Execution
68 [Documentation] Do test teardown task.
69
70 # REST Login to BMC with new "root" password.
George Keishingcf3df712018-10-29 09:12:58 -050071 Initialize OpenBMC REST_PASSWORD=${test_password}
George Keishingf1331672018-01-18 05:19:02 -060072 Update Root Password
73 Sleep 5 s
74 Delete All Sessions
75
76 # SSH Login to BMC with user default "root" password.
77 SSHLibrary.Open Connection ${OPENBMC_HOST}
78 Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
79
80 # REST Login to BMC with user default "root" password.
81 Initialize OpenBMC
82
83 FFDC On Test Case Fail
84 Close All Connections
Sivas SRRdc10cc82018-10-30 10:53:32 -050085
86
87Create Group And Privilege
88 [Documentation] Create group and privilege for users.
89 [Arguments] ${user_group} ${user_privilege}
90
91 # Description of argument(s):
92 # user_group User group string.
93 # user_privilege User privilge string like priv-admin, priv-user.
94
95 @{ldap_parm_list}= Create List
96 ... ${user_group} ${user_privilege}
97
98 ${data}= Create Dictionary data=@{ldap_parm_list}
99
100 ${resp}= OpenBMC Post Request
101 ... ${BMC_USER_URI}ldap/action/Create data=${data}
102 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
103 ... msg=Updating the new root password failed, RC=${resp.status_code}.