blob: 72590a0968adf13e42849ac2d5c84602303a5531 [file] [log] [blame]
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -06001*** Settings ***
2Documentation Test suite for OpenBMC IPMI user management.
3
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Library ../lib/ipmi_utils.py
7
Rahul Maheshwarif646baa2019-02-20 12:29:35 -06008Test Teardown Test Teardown Execution
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -06009
10
11*** Variables ***
12
13${invalid_username} user%
14${invalid_password} abc123
15${root_userid} 1
16${operator_level_priv} 0x3
Rahul Maheshwaric19f8382019-02-20 08:19:22 -060017${valid_password} 0penBmc1
18${max_password_length} 20
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060019
20
21*** Test Cases ***
22
23Verify IPMI User Creation With Valid Name And ID
24 [Documentation] Create user via IPMI and verify.
25 [Tags] Test_IPMI_User_Creation_With_Valid_Name_And_ID
26
27 ${random_username}= Generate Random String 8 [LETTERS]
Rahul Maheshwari976a1702019-02-21 01:47:58 -060028 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060029 IPMI Create User ${random_userid} ${random_username}
30
31
32Verify IPMI User Creation With Invalid Name
33 [Documentation] Verify error while creating IPMI user with invalid
George Keishingc2a6f092019-02-20 12:26:54 -060034 ... name(e.g. user name with special characters).
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060035 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
36
Rahul Maheshwari976a1702019-02-21 01:47:58 -060037 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060038 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
39 ... user set name ${random_userid} ${invalid_username}
40 Should Contain ${msg} Invalid data
41
42
43Verify IPMI User Creation With Invalid ID
44 [Documentation] Verify error while creating IPMI user with invalid
45 ... ID(i.e. any number greater than 15 or 0).
46 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
47
48 @{id_list}= Create List
49 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
50 Append To List ${id_list} ${random_invalid_id}
51 Append To List ${id_list} 0
52
53 :FOR ${id} IN @{id_list}
54 \ ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
55 \ ... user set name ${id} newuser
56 \ Should Contain ${msg} User ID is limited to range
57
58
59Verify Setting IPMI User With Invalid Password
60 [Documentation] Verify error while setting IPMI user with invalid
61 ... password.
62 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
63
64 # Create IPMI user.
65 ${random_username}= Generate Random String 8 [LETTERS]
Rahul Maheshwari976a1702019-02-21 01:47:58 -060066 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -060067 IPMI Create User ${random_userid} ${random_username}
68
69 # Set invalid password for newly created user.
70 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
71 ... user set password ${random_userid} ${invalid_password}
72
73 Should Contain ${msg} Invalid data field in request
74
75
76Verify Setting IPMI Root User With New Name
77 [Documentation] Verify error while setting IPMI root user with new
78 ... name.
79 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
80
81 # Set invalid password for newly created user.
82 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
83 ... user set name ${root_userid} abcd
84
85 Should Contain ${msg} Set User Name command failed
86
87
Rahul Maheshwaric19f8382019-02-20 08:19:22 -060088Verify IPMI User Password Via Test Command
89 [Documentation] Verify IPMI user password using test command.
90 [Tags] Verify_IPMI_User_Password_Via_Test_Command
91
92 # Create IPMI user.
93 ${random_username}= Generate Random String 8 [LETTERS]
94 ${random_userid}= Evaluate random.randint(2, 15) modules=random
95 IPMI Create User ${random_userid} ${random_username}
96
97 # Set valid password for newly created user.
98 Run IPMI Standard Command
99 ... user set password ${random_userid} ${valid_password}
100
101 # Verify newly set password using test command.
102 ${msg}= Run IPMI Standard Command
103 ... user test ${random_userid} ${max_password_length} ${valid_password}
104
105 Should Contain ${msg} Success
106
107
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600108Verify IPMI User Creation With Same Name
109 [Documentation] Verify error while creating two IPMI user with same name.
110 [Tags] Verify_IPMI_User_Creation_With_Same_Name
111
112 ${random_username}= Generate Random String 8 [LETTERS]
113 IPMI Create User 2 ${random_username}
114
115 # Set same username for another IPMI user.
116 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
117 ... user set name 3 ${random_username}
118 Should Contain ${msg} Invalid data field in request
119
120
121Verify Setting IPMI User With Null Password
122 [Documentation] Verify error while setting IPMI user with null
123 ... password.
124 [Tags] Verify_Setting_IPMI_User_With_Null_Password
125
126 # Create IPMI user.
127 ${random_username}= Generate Random String 8 [LETTERS]
Rahul Maheshwari976a1702019-02-21 01:47:58 -0600128 ${random_userid}= Evaluate random.randint(2, 15) modules=random
Rahul Maheshwari404da0d2019-02-18 23:24:17 -0600129 IPMI Create User ${random_userid} ${random_username}
130
131 # Set null password for newly created user.
132 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
133 ... user set password ${random_userid} ""
134
135 Should Contain ${msg} Invalid data field in request
136
137
Rahul Maheshwari645a1132019-02-18 03:29:27 -0600138Verify IPMI User Deletion
139 [Documentation] Delete user via IPMI and verify.
140 [Tags] Verify_IPMI_User_Deletion
141
142 ${random_username}= Generate Random String 8 [LETTERS]
143 ${random_userid}= Evaluate random.randint(2, 15) modules=random
144 IPMI Create User ${random_userid} ${random_username}
145
146 # Delete IPMI User and verify
147 Run IPMI Standard Command user set name ${random_userid} ""
148 Should Be Equal ${user_info['user_name']} ${EMPTY}
149
150
Rahul Maheshwaric19f8382019-02-20 08:19:22 -0600151
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600152*** Keywords ***
153
154IPMI Create User
155 [Documentation] Create IPMI user with given userid and username.
156 [Arguments] ${userid} ${username}
157
158 # Description of argument(s):
159 # userid The user ID (e.g. "1", "2", etc.).
160 # username The user name (e.g. "root", "robert", etc.).
161
162 ${ipmi_cmd}= Catenate user set name ${userid} ${username}
163 ${resp}= Run IPMI Standard Command ${ipmi_cmd}
164 ${user_info}= Get User Info ${userid}
165 Should Be Equal ${user_info['user_name']} ${username}
166
Rahul Maheshwarif646baa2019-02-20 12:29:35 -0600167
168Delete All Non Root IPMI User
169 [Documentation] Delete all non-root IPMI user.
170
171 :FOR ${userid} IN RANGE 2 16
172 \ ${user_info}= Get User Info ${userid}
173 \ Run Keyword If "${user_info['user_name']}" != ""
174 ... Run IPMI Standard Command user set name ${userid} ""
175
176
177Test Teardown Execution
178 [Documentation] Do the test teardown execution.
179
180 FFDC On Test Case Fail
181 Delete All Non Root IPMI User
182