blob: 11cbacbc94bf90c576ed27b7d2a70c3bf6e59aad [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
86*** Keywords ***
87
88IPMI Create User
89 [Documentation] Create IPMI user with given userid and username.
90 [Arguments] ${userid} ${username}
91
92 # Description of argument(s):
93 # userid The user ID (e.g. "1", "2", etc.).
94 # username The user name (e.g. "root", "robert", etc.).
95
96 ${ipmi_cmd}= Catenate user set name ${userid} ${username}
97 ${resp}= Run IPMI Standard Command ${ipmi_cmd}
98 ${user_info}= Get User Info ${userid}
99 Should Be Equal ${user_info['user_name']} ${username}
100