blob: 0c53a5f2a2037bf934df8d5316478da85ebd3a7e [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
8Test Teardown FFDC On Test Case Fail
9
10
11*** Variables ***
12
13${invalid_username} user%
14${invalid_password} abc123
15${root_userid} 1
16${operator_level_priv} 0x3
17
18
19*** Test Cases ***
20
21Verify IPMI User Creation With Valid Name And ID
22 [Documentation] Create user via IPMI and verify.
23 [Tags] Test_IPMI_User_Creation_With_Valid_Name_And_ID
24
25 ${random_username}= Generate Random String 8 [LETTERS]
26 ${random_userid}= Evaluate random.randint(1, 15) modules=random
27 IPMI Create User ${random_userid} ${random_username}
28
29
30Verify IPMI User Creation With Invalid Name
31 [Documentation] Verify error while creating IPMI user with invalid
32 ... name(e.g. user name with special charaters).
33 [Tags] Verify_IPMI_User_Creation_With_Invalid_Name
34
35 ${random_userid}= Evaluate random.randint(1, 15) modules=random
36 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
37 ... user set name ${random_userid} ${invalid_username}
38 Should Contain ${msg} Invalid data
39
40
41Verify IPMI User Creation With Invalid ID
42 [Documentation] Verify error while creating IPMI user with invalid
43 ... ID(i.e. any number greater than 15 or 0).
44 [Tags] Verify_IPMI_User_Creation_With_Invalid_ID
45
46 @{id_list}= Create List
47 ${random_invalid_id}= Evaluate random.randint(16, 1000) modules=random
48 Append To List ${id_list} ${random_invalid_id}
49 Append To List ${id_list} 0
50
51 :FOR ${id} IN @{id_list}
52 \ ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
53 \ ... user set name ${id} newuser
54 \ Should Contain ${msg} User ID is limited to range
55
56
57Verify Setting IPMI User With Invalid Password
58 [Documentation] Verify error while setting IPMI user with invalid
59 ... password.
60 [Tags] Verify_Setting_IPMI_User_With_Invalid_Password
61
62 # Create IPMI user.
63 ${random_username}= Generate Random String 8 [LETTERS]
64 ${random_userid}= Evaluate random.randint(1, 15) modules=random
65 IPMI Create User ${random_userid} ${random_username}
66
67 # Set invalid password for newly created user.
68 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
69 ... user set password ${random_userid} ${invalid_password}
70
71 Should Contain ${msg} Invalid data field in request
72
73
74Verify Setting IPMI Root User With New Name
75 [Documentation] Verify error while setting IPMI root user with new
76 ... name.
77 [Tags] Verify_Setting_IPMI_Root_User_With_New_Name
78
79 # Set invalid password for newly created user.
80 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
81 ... user set name ${root_userid} abcd
82
83 Should Contain ${msg} Set User Name command failed
84
85
Rahul Maheshwari404da0d2019-02-18 23:24:17 -060086Verify IPMI User Creation With Same Name
87 [Documentation] Verify error while creating two IPMI user with same name.
88 [Tags] Verify_IPMI_User_Creation_With_Same_Name
89
90 ${random_username}= Generate Random String 8 [LETTERS]
91 IPMI Create User 2 ${random_username}
92
93 # Set same username for another IPMI user.
94 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
95 ... user set name 3 ${random_username}
96 Should Contain ${msg} Invalid data field in request
97
98
99Verify Setting IPMI User With Null Password
100 [Documentation] Verify error while setting IPMI user with null
101 ... password.
102 [Tags] Verify_Setting_IPMI_User_With_Null_Password
103
104 # Create IPMI user.
105 ${random_username}= Generate Random String 8 [LETTERS]
106 ${random_userid}= Evaluate random.randint(1, 15) modules=random
107 IPMI Create User ${random_userid} ${random_username}
108
109 # Set null password for newly created user.
110 ${msg}= Run Keyword And Expect Error * Run IPMI Standard Command
111 ... user set password ${random_userid} ""
112
113 Should Contain ${msg} Invalid data field in request
114
115
Rahul Maheshwariddfc0cb2019-02-07 23:43:19 -0600116*** Keywords ***
117
118IPMI Create User
119 [Documentation] Create IPMI user with given userid and username.
120 [Arguments] ${userid} ${username}
121
122 # Description of argument(s):
123 # userid The user ID (e.g. "1", "2", etc.).
124 # username The user name (e.g. "root", "robert", etc.).
125
126 ${ipmi_cmd}= Catenate user set name ${userid} ${username}
127 ${resp}= Run IPMI Standard Command ${ipmi_cmd}
128 ${user_info}= Get User Info ${userid}
129 Should Be Equal ${user_info['user_name']} ${username}
130