1*** Settings ***
2Documentation    Test IPMI and Redfish combinations for user management.
3
4Resource         ../../lib/resource.robot
5Resource         ../../lib/bmc_redfish_resource.robot
6Resource         ../../lib/openbmc_ffdc.robot
7Resource         ../../lib/ipmi_client.robot
8
9Test Setup       Test Setup Execution
10Test Teardown    Test Teardown Execution
11
12
13*** Variables ***
14
15${valid_password}       0penBmc1
16
17
18** Test Cases **
19
20Create Admin Redfish User And Verify Login Via IPMI
21    [Documentation]  Create user using redfish and verify via IPMI.
22    [Tags]  Create_Admin_Redfish_User_And_Verify_Login_Via_IPMI
23
24    ${random_username}=  Generate Random String  8  [LETTERS]
25    Set Test Variable  ${random_username}
26
27    ${payload}=  Create Dictionary
28    ...  UserName=${random_username}  Password=${valid_password}
29    ...  RoleId=Administrator  Enabled=${True}
30    Redfish.Post  /redfish/v1/AccountService/Accounts  body=&{payload}
31    ...  valid_status_codes=[${HTTP_CREATED}]
32
33    Verify IPMI Username And Password  ${random_username}  ${valid_password}
34
35
36*** Keywords ***
37
38Test Setup Execution
39    [Documentation]  Do test case setup tasks.
40
41    Redfish.Login
42
43
44Test Teardown Execution
45    [Documentation]  Do the post test teardown.
46
47    FFDC On Test Case Fail
48    # Delete the test user.
49    Run Keyword And Ignore Error
50    ...  Redfish.Delete  /redfish/v1/AccountService/Accounts/${random_username}
51
52    Redfish.Logout
53