blob: 25fb474a195eba25c1434a1d572c6444d8163b68 [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
Sivas SRR1d3e4be2018-11-20 07:35:50 -06007Resource ../lib/user_utils.robot
George Keishingf1331672018-01-18 05:19:02 -06008Library SSHLibrary
9
10Test Teardown Test Teardown Execution
11
12*** Variables ****
13
George Keishingcf3df712018-10-29 09:12:58 -050014${test_password} 0penBmc123
George Keishingf1331672018-01-18 05:19:02 -060015
16*** Test Cases ***
17
Sivas SRR1a7502d2018-09-19 03:31:54 -050018
19Verify At Least One User In List
20 [Documentation] Verify user list API list minimum one user.
21 [Tags] Verify_At_Least_One_User_In_List
George Keishingb24adb32018-10-29 13:20:08 -050022 [Teardown] FFDC On Test Case Fail
Sivas SRR1a7502d2018-09-19 03:31:54 -050023
24 ${bmc_user_uris}= Read Properties ${BMC_USER_URI}list
25 Should Not Be Empty ${bmc_user_uris}
26
27
Sivas SRRdc10cc82018-10-30 10:53:32 -050028Verify User Group And Privilege Created
29 [Documentation] Verify user group and associated privilege is created.
30 [Tags] Verify_User_Group_And_Privilege_Created
31 [Teardown] FFDC On Test Case Fail
32
33 Create Group And Privilege ${GROUP_NAME} ${GROUP_PRIVILEGE}
34 ${bmc_user_uris}= Read Properties ${BMC_USER_URI}ldap/enumerate
35 ${bmc_user_uris}= Convert To String ${bmc_user_uris}
36 Should Contain ${bmc_user_uris} ${GROUP_NAME}
37 Should Contain ${bmc_user_uris} ${GROUP_PRIVILEGE}
Sivas SRR1d3e4be2018-11-20 07:35:50 -060038 Delete Defined LDAP Group And Privilege ${GROUP_NAME}
39
40
41Verify LDAP User With Privilege Admin Able To Power On
42 [Documentation] Verify LDAP user with privilege admin able to power on.
43 [Tags] Verify_LDAP_User_With_Privilege_Admin_Able_To_Power_On
44 [Teardown] FFDC On Test Case Fail
45
46 Create Privilege priv-admin
47 Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD}
48 REST Power On stack_mode=normal quiet=1
49 Delete Defined LDAP Group And Privilege ${GROUP_NAME}
50
51
52Verify LDAP User With Privilege Admin Able To Power Off
53 [Documentation] Verify LDAP user with privilege admin able to power off.
54 [Tags] Verify_LDAP_User_With_Privilege_Admin_Able_To_Power_Off
55 [Teardown] FFDC On Test Case Fail
56
57 Create Privilege priv-admin
58 Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD}
59 REST Hard Power Off stack_mode=normal quiet=1
60 Delete Defined LDAP Group And Privilege ${GROUP_NAME}
61
62
63Verify LDAP User With Privilege User Able To Read Inventory
64 [Documentation] Verify LDAP user with privilege usern able to read
65 ... inventory assettag.
66 [Tags] Verify_LDAP_User_With_Privilege_User_Able_To_Read_Inventory
67 [Teardown] FFDC On Test Case Fail
68
69 Create Privilege priv-user
70 Initialize OpenBMC 60 1 ${LDAP_USER} ${LDAP_USER_PASSWORD}
71 Read Attribute /xyz/openbmc_project/inventory/system AssetTag
72 Delete Defined LDAP Group And Privilege ${GROUP_NAME}
Sivas SRRdc10cc82018-10-30 10:53:32 -050073
74
George Keishingf1331672018-01-18 05:19:02 -060075Verify Root Password Update
76 [Documentation] Update system "root" user password and verify.
77 [Tags] Verify_Root_Password_Update
78
79 Delete All Sessions
80
81 Initialize OpenBMC
82 Update Root Password ${test_password}
83
84 # Time for user manager to sync.
85 Sleep 5 s
86
87 Delete All Sessions
88
89 # SSH Login to BMC with new "root" password.
90 SSHLibrary.Open Connection ${OPENBMC_HOST}
91 Login ${OPENBMC_USERNAME} ${test_password}
92
93 # REST Login to BMC with new "root" password.
George Keishingcf3df712018-10-29 09:12:58 -050094 Initialize OpenBMC REST_PASSWORD=${test_password}
George Keishingf1331672018-01-18 05:19:02 -060095
96 ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate
97 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
98 ... msg=Verify of new root password failed, RC=${resp.status_code}.
99
100
101*** Keywords ***
102
103Test Teardown Execution
104 [Documentation] Do test teardown task.
105
106 # REST Login to BMC with new "root" password.
George Keishingcf3df712018-10-29 09:12:58 -0500107 Initialize OpenBMC REST_PASSWORD=${test_password}
George Keishingf1331672018-01-18 05:19:02 -0600108 Update Root Password
109 Sleep 5 s
110 Delete All Sessions
111
112 # SSH Login to BMC with user default "root" password.
113 SSHLibrary.Open Connection ${OPENBMC_HOST}
114 Login ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
115
116 # REST Login to BMC with user default "root" password.
117 Initialize OpenBMC
118
119 FFDC On Test Case Fail
120 Close All Connections
Sivas SRRdc10cc82018-10-30 10:53:32 -0500121
122
123Create Group And Privilege
124 [Documentation] Create group and privilege for users.
125 [Arguments] ${user_group} ${user_privilege}
126
127 # Description of argument(s):
128 # user_group User group string.
129 # user_privilege User privilge string like priv-admin, priv-user.
130
131 @{ldap_parm_list}= Create List
132 ... ${user_group} ${user_privilege}
133
134 ${data}= Create Dictionary data=@{ldap_parm_list}
135
136 ${resp}= OpenBMC Post Request
137 ... ${BMC_USER_URI}ldap/action/Create data=${data}
138 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
139 ... msg=Updating the new root password failed, RC=${resp.status_code}.
Sivas SRR1d3e4be2018-11-20 07:35:50 -0600140
141
142Create Privilege
143 [Documentation] Create privilege as priv-admin.
144 [Arguments] ${user_privilege}
145
146 Create Group And Privilege ${GROUP_NAME} ${user_privilege}
147 ${bmc_user_uris}= Read Properties ${BMC_USER_URI}ldap/enumerate
148 ${bmc_user_uris}= Convert To String ${bmc_user_uris}
149 Should Contain ${bmc_user_uris} ${user_privilege}
150 ... msg=Could not create ${user_privilege} privilege.
151
152
153
154Verify Root Password Update
155 [Documentation] Update system "root" user password and verify.
156 [Tags] Verify_Root_Password_Update
157
158 Delete All Sessions
159
160 Initialize OpenBMC
161 Update Root Password ${test_password}
162
163 # Time for user manager to sync.
164 Sleep 5 s
165
166 Delete All Sessions
167
168 # SSH Login to BMC with new "root" password.
169 SSHLibrary.Open Connection ${OPENBMC_HOST}
170 Login ${OPENBMC_USERNAME} ${test_password}
171
172 # REST Login to BMC with new "root" password.
173 Initialize OpenBMC REST_PASSWORD=${test_password}
174
175 ${resp}= Get Request openbmc ${BMC_USER_URI}enumerate
176 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
177 ... msg=Verify of new root password failed, RC=${resp.status_code}.