1*** Settings ***
2
3Documentation    Module to test IPMI management controller ID functionality.
4Resource         ../lib/ipmi_client.robot
5Resource         ../lib/openbmc_ffdc.robot
6Variables        ../data/ipmi_raw_cmd_table.py
7
8Test Teardown    FFDC On Test Case Fail
9
10Force Tags       IPMI_MC_ID
11
12*** Variables ***
13
14${new_mc_id}=  HOST
15
16
17*** Test Cases ***
18
19Verify Get And Set Management Controller ID String
20    [Documentation]  Verify get and set management controller ID string.
21    [Tags]  Verify_Get_And_Set_Management_Controller_ID_String
22    # Get the value of the managemment controller ID string.
23    # Example:
24    # Get Management Controller Identifier String: witherspoon
25
26    ${cmd_output}=  Wait Until Keyword Succeeds  15 sec  5 sec
27    ...  Run IPMI Standard Command  dcmi get_mc_id_string
28
29    # Extract management controller ID from cmd_output.
30    ${initial_mc_id}=  Fetch From Right  ${cmd_output}  :${SPACE}
31
32    # Set the management controller ID string to other value.
33    # Example:
34    # Set Management Controller Identifier String Command: HOST
35
36    Set Management Controller ID String  ${new_mc_id}
37
38    # Get the management controller ID and verify.
39    Get Management Controller ID String And Verify  ${new_mc_id}
40
41    # Set the value back to the initial value and verify.
42    Set Management Controller ID String  ${initial_mc_id}
43
44    # Get the management controller ID and verify.
45    Get Management Controller ID String And Verify  ${initial_mc_id}
46
47
48Test Management Controller ID String Status via IPMI
49    [Documentation]  Test management controller ID string status via IPMI.
50    [Tags]  Test_Management_Controller_ID_String_Status_via_IPMI
51    # Disable management controller ID string status via IPMI and verify.
52    Run IPMI Standard Command  dcmi set_conf_param dhcp_config 0x00
53    Verify Management Controller ID String Status  disable
54
55    # Enable management controller ID string status via IPMI and verify.
56    Run IPMI Standard Command  dcmi set_conf_param dhcp_config 0x01
57    Verify Management Controller ID String Status  enable
58
59
60Test Management Controller ID String Status via Raw IPMI
61    [Documentation]  Test management controller ID string status via IPMI.
62    [Tags]  Test_Management_Controller_ID_String_Status_via_Raw_IPMI
63    # Disable management controller ID string status via raw IPMI and verify.
64    Run IPMI Standard Command  raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]}
65    Verify Management Controller ID String Status  disable
66
67    # Enable management controller ID string status via raw IPMI and verify.
68    Run IPMI Standard Command  raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]}
69    Verify Management Controller ID String Status  enable
70
71
72*** Keywords ***
73
74Set Management Controller ID String
75    [Documentation]  Set the management controller ID string.
76    [Arguments]  ${string}
77
78    # Description of argument(s):
79    # string  Management Controller ID String to be set
80
81    ${set_mc_id_string}=  Run IPMI Standard Command
82    ...  dcmi set_mc_id_string ${string}
83
84
85Get Management Controller ID String And Verify
86    [Documentation]  Get the management controller ID string.
87    [Arguments]  ${string}
88
89    # Description of argument(s):
90    # string  Management Controller ID string
91
92    ${get_mc_id}=  Run IPMI Standard Command  dcmi get_mc_id_string
93    Should Contain  ${get_mc_id}  ${string}
94    ...  msg=Command failed: get_mc_id.
95
96
97Verify Management Controller ID String Status
98    [Documentation]  Verify management controller ID string status via IPMI.
99    [Arguments]  ${status}
100
101    # Example of dcmi get_conf_param command output:
102    # DHCP Discovery method   :
103    #           Management Controller ID String is disabled
104    #           Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled
105    #   Initial timeout interval        : 4 seconds
106    #   Server contact timeout interval : 120 seconds
107    #   Server contact retry interval   : 64 seconds
108
109    ${resp}=  Run IPMI Standard Command  dcmi get_conf_param
110    ${resp}=  Get Lines Containing String  ${resp}
111    ...  Management Controller ID String  case_insensitive=True
112    Should Contain  ${resp}  ${status}
113    ...  msg=Management controller ID string is not ${status}
114