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