xref: /openbmc/openbmc-test-automation/pldm/test_pldm_base.robot (revision 069b266e40a93fda3992c888062745b1ac920473)
1*** Settings ***
2
3Documentation    Module to test PLDM base commands.
4Library          ../lib/pldm_utils.py
5Variables        ../data/pldm_variables.py
6Resource         ../lib/openbmc_ffdc.robot
7
8Test Setup       Printn
9Test Teardown    FFDC On Test Case Fail
10
11Test Tags       Pldm_Base
12
13*** Test Cases ***
14
15Verify Get PLDM Types
16    [Documentation]  Verify supported PLDM types.
17    [Tags]  Verify_Get_PLDM_Types
18
19    ${pldm_output}=  Pldmtool  base GetPLDMTypes
20    ${count}=  Get Length  ${pldm_output}
21    ${cmd_list}=  Create List
22    FOR  ${i}  IN RANGE  ${count}
23      ${cmd}=  Catenate  ${pldm_output}[${i}][PLDM Type Code](${pldm_output}[${i}][PLDM Type])
24      Append To List  ${cmd_list}  ${cmd}
25    END
26    Valid List  cmd_list  required_values=${PLDM_SUPPORTED_TYPES}
27
28Verify Get PLDM Version For Base
29    [Documentation]  Verify supported PLDM version for base type.
30    [Tags]  Verify_Get_PLDM_Version_For_Base
31
32    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'base'
33    ${pldm_output}=  Pldmtool  ${pldm_cmd}
34    Valid Value  pldm_output['Response']  ['${VERSION_BASE['STRING']}']
35
36Verify Get PLDM Version For Platform
37    [Documentation]  Verify supported PLDM version for platform type.
38    [Tags]  Verify_Get_PLDM_Version_For_Platform
39
40    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'platform'
41    ${pldm_output}=  Pldmtool  ${pldm_cmd}
42    Valid Value  pldm_output['Response']  ['${VERSION_PLATFORM['STRING']}']
43
44
45Verify Get PLDM Version For BIOS
46    [Documentation]  Verify supported PLDM version for BIOS type.
47    [Tags]  Verify_Get_PLDM_Version_For_BIOS
48
49    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'bios'
50    ${pldm_output}=  Pldmtool  ${pldm_cmd}
51    Valid Value  pldm_output['Response']  ['${VERSION_BIOS['STRING']}']
52
53
54Verify Get PLDM Version For FRU
55    [Documentation]  Verify supported PLDM version for FRU type.
56    [Tags]  Verify_Get_PLDM_Version_For_FRU
57
58    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'fru'
59    ${pldm_output}=  Pldmtool  ${pldm_cmd}
60    Valid Value  pldm_output['Response']  ['${VERSION_FRU['STRING']}']
61
62
63Verify Get PLDM Version For OEM
64    [Documentation]  Verify supported PLDM version for oem-ibm type.
65    [Tags]  Verify_Get_PLDM_Version_For_OEM
66
67    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'oem-ibm'
68    ${pldm_output}=  Pldmtool  ${pldm_cmd}
69    Valid Value  pldm_output['Response']  ['${VERSION_OEM['STRING']}']
70
71
72Verify GetTID
73    [Documentation]  Verify GetTID (Terminus ID) response message.
74    [Tags]  Verify_GetTID
75
76    # Example output:
77    # {
78    #     'Response' : 1
79    # }
80
81    ${pldm_output}=  Pldmtool  base GetTID
82    Valid Value  pldm_output['Response']  [1]
83
84Verify GetPLDMCommands
85    [Documentation]  Verify GetPLDMCommands response message.
86    [Tags]  Verify_GetPLDMCommands
87    [Template]  Verify GetPLDMCommands For PLDM Type
88
89    # pldm_type    # expected_pldm_cmds
90
91    '0'            ${PLDM_BASE_CMDS}
92    '2'            ${PLDM_PLATFORM_CMDS}
93    '3'            ${PLDM_BIOS_CMDS}
94    '4'            ${PLDM_FRU_CMDS}
95    '63'           ${PLDM_OEM_CMDS}
96
97
98Verify Verbose Flag For PLDM Subsystem Commands
99    [Documentation]  Verify verbose flag for PLDM subsystem commands.
100    [Tags]  Verify_Verbose_Flag_For_PLDM_Subsystem_Commands
101
102    ${pldm_output}=  Pldmtool  base GetPLDMTypes -v
103    Should Contain  ${pldm_output}  pldmtool: Tx:
104    Should Contain  ${pldm_output}  pldmtool: Rx:
105
106    ${pldm_output}=  Pldmtool  bios GetDateTime -v
107    Should Contain  ${pldm_output}  pldmtool: Tx:
108    Should Contain  ${pldm_output}  pldmtool: Rx:
109
110
111Verify Response For PLDM Raw Commands
112    [Documentation]  Verify response for PLDM raw commands.
113    [Tags]  Verify_Response_For_PLDM_Raw_Commands
114
115    # Example output format:
116    # pldmtool raw -d 0x80 0x00 0x04
117    # pldmtool: Tx: 80 00 04
118    # pldmtool: Rx: 00 00 04 00 1d 00 00 00 00 00 00 80
119
120    ${pldm_output}=  Pldmtool  ${PLDM_GET_PLDM_TYPES_RAW_CMD}
121    Should Contain  ${pldm_output}  ${PLDM_GET_PLDM_TYPES_RAW_CMD_OUTPUT}
122
123
124Verify Verbose Flag For PLDM Raw Command
125    [Documentation]  Verify PLDM raw command with verbose flag,
126    [Tags]  Verify_Verbose_Flag_For_PLDM_Raw_Command
127
128    # Example output format:
129    # pldmtool raw -d 0x80 0x00 0x04 -v
130    # pldmtool: Tx: 80 00 04
131    # pldmtool: Rx: 00 00 04 00 1d 00 00 00 00 00 00 80
132
133    ${pldm_output}=  Pldmtool  ${PLDM_GET_PLDM_TYPES_RAW_CMD} -v
134    Should Contain  ${pldm_output}  ${PLDM_GET_PLDM_TYPES_RAW_CMD_OUTPUT}
135
136
137Verify Verbose Flag For Incorrect PLDM Raw Command
138    [Documentation]  Verify incorrect PLDM raw command with verbose flag,
139    [Tags]  Verify_Verbose_Flag_For_Incorrect_PLDM_Raw_Command
140
141    # Example output format:
142    # pldmtool raw -d 0x80 0x00 0x00 -v
143    # pldmtool: Tx: 80 00 04
144    # pldmtool: Rx: 00 00 00 05
145
146    ${pldm_output}=  Pldmtool  ${PLDM_RAW_CMD_INVALID} -v
147    Should Contain  ${pldm_output}  ${PLDM_RAW_CMD_INVALID_OUTPUT}
148
149
150*** keywords ***
151
152Verify GetPLDMCommands For PLDM Type
153    [Documentation]  Verify GetPLDMCommands for given input pldm type with expected pldm cmds.
154    [Arguments]  ${pldm_type}  ${expected_pldm_cmds}
155
156    # Description of argument(s):
157    # pldm_type             pldm type (e.g. '0', '2', '3', '4', '63').
158    #                      '0' -> base, '2' -> platform, '3' -> 'bios', '4' -> 'fru'
159    #                      '63' -> oem-ibm.
160    # expected_pldm_cmds    expected pldm commands for given pldm type.
161
162    # Example output:
163    # Supported Commands : 2(GetTID) 3(GetPLDMVersion) 4(GetPLDMTypes) 5(GetPLDMCommands)
164
165    ${pldm_output}=  Pldmtool  base GetPLDMCommands -t ${pldm_type}
166    ${count}=  Get Length  ${pldm_output}
167    ${cmd_list}=  Create List
168    FOR  ${i}  IN RANGE  ${count}
169      ${cmd}=  Catenate  ${pldm_output}[${i}][PLDM Command Code](${pldm_output}[${i}][PLDM Command])
170      Append To List  ${cmd_list}  ${cmd}
171    END
172    Valid List  cmd_list  required_values=${expected_pldm_cmds}
173