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
11*** Test Cases ***
12Verify Get PLDM Types
13    [Documentation]  Verify supported PLDM types.
14    [Tags]  Verify_Get_PLDM_Types
15
16    ${pldm_output}=  Pldmtool  base GetPLDMTypes
17    ${count}=  Get Length  ${pldm_output}
18    ${cmd_list}=  Create List
19    FOR  ${i}  IN RANGE  ${count}
20      ${cmd}=  Catenate  ${pldm_output}[${i}][PLDM Type Code](${pldm_output}[${i}][PLDM Type])
21      Append To List  ${cmd_list}  ${cmd}
22    END
23    Valid List  cmd_list  required_values=${PLDM_SUPPORTED_TYPES}
24
25Verify Get PLDM Version For Base
26    [Documentation]  Verify supported PLDM version for base type.
27    [Tags]  Verify_Get_PLDM_Version_For_Base
28
29    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'base'
30    ${pldm_output}=  Pldmtool  ${pldm_cmd}
31    Valid Value  pldm_output['Response']  ['${VERSION_BASE['STRING']}']
32
33Verify Get PLDM Version For Platform
34    [Documentation]  Verify supported PLDM version for platform type.
35    [Tags]  Verify_Get_PLDM_Version_For_Platform
36
37    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'platform'
38    ${pldm_output}=  Pldmtool  ${pldm_cmd}
39    Valid Value  pldm_output['Response']  ['${VERSION_PLATFORM['STRING']}']
40
41
42Verify Get PLDM Version For BIOS
43    [Documentation]  Verify supported PLDM version for BIOS type.
44    [Tags]  Verify_Get_PLDM_Version_For_BIOS
45
46    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'bios'
47    ${pldm_output}=  Pldmtool  ${pldm_cmd}
48    Valid Value  pldm_output['Response']  ['${VERSION_BIOS['STRING']}']
49
50
51Verify Get PLDM Version For FRU
52    [Documentation]  Verify supported PLDM version for FRU type.
53    [Tags]  Verify_Get_PLDM_Version_For_FRU
54
55    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'fru'
56    ${pldm_output}=  Pldmtool  ${pldm_cmd}
57    Valid Value  pldm_output['Response']  ['${VERSION_FRU['STRING']}']
58
59
60Verify Get PLDM Version For OEM
61    [Documentation]  Verify supported PLDM version for oem-ibm type.
62    [Tags]  Verify_Get_PLDM_Version_For_OEM
63
64    ${pldm_cmd}=  Evaluate  $CMD_GETPLDMVERSION % 'oem-ibm'
65    ${pldm_output}=  Pldmtool  ${pldm_cmd}
66    Valid Value  pldm_output['Response']  ['${VERSION_OEM['STRING']}']
67
68
69Verify GetTID
70    [Documentation]  Verify GetTID (Terminus ID) response message.
71    [Tags]  Verify_GetTID
72
73    # Example output:
74    # {
75    #     'Response' : 1
76    # }
77
78    ${pldm_output}=  Pldmtool  base GetTID
79    Valid Value  pldm_output['Response']  [1]
80
81Verify GetPLDMCommands
82    [Documentation]  Verify GetPLDMCommands response message.
83    [Tags]  Verify_GetPLDMCommands
84    [Template]  Verify GetPLDMCommands For PLDM Type
85
86    # pldm_type    # expected_pldm_cmds
87
88    '0'            ${PLDM_BASE_CMDS}
89    '2'            ${PLDM_PLATFORM_CMDS}
90    '3'            ${PLDM_BIOS_CMDS}
91    '4'            ${PLDM_FRU_CMDS}
92    '63'           ${PLDM_OEM_CMDS}
93
94*** keywords ***
95
96Verify GetPLDMCommands For PLDM Type
97    [Documentation]  Verify GetPLDMCommands for given input pldm type with expected pldm cmds.
98    [Arguments]  ${pldm_type}  ${expected_pldm_cmds}
99
100    # Description of argument(s):
101    # pldm_type             pldm type (e.g. '0', '2', '3', '4', '63').
102    #                      '0' -> base, '2' -> platform, '3' -> 'bios', '4' -> 'fru'
103    #                      '63' -> oem-ibm.
104    # expected_pldm_cmds    expected pldm commands for given pldm type.
105
106    # Example output:
107    # Supported Commands : 2(GetTID) 3(GetPLDMVersion) 4(GetPLDMTypes) 5(GetPLDMCommands)
108
109    ${pldm_output}=  Pldmtool  base GetPLDMCommands -t ${pldm_type}
110    ${count}=  Get Length  ${pldm_output}
111    ${cmd_list}=  Create List
112    FOR  ${i}  IN RANGE  ${count}
113      ${cmd}=  Catenate  ${pldm_output}[${i}][PLDM Command Code](${pldm_output}[${i}][PLDM Command])
114      Append To List  ${cmd_list}  ${cmd}
115    END
116    Valid List  cmd_list  required_values=${expected_pldm_cmds}
117