Verify pldmtool platform GetPDR with PDR type FRURecordSetIdentifier
and PDREntityAssociation.
Resolves openbmc/openbmc-test-automation/issues/#2085
Change-Id: If3cfe2119262b904d5103d79c5952def3075c56a
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/data/pldm_variables.py b/data/pldm_variables.py
index 482e2b8..515806f 100755
--- a/data/pldm_variables.py
+++ b/data/pldm_variables.py
@@ -80,45 +80,51 @@
# GetPDR parsed response message for record handle.
# Dictionary value array holds the expected output for record handle 1, 2.
-# e.g. : 'nextrecordhandle': ['0', '2']
#
# Note :
# Record handle - 0 is default & has same behaviour as record handle 1
# Only record handle 0, 1, 2 are supported as of now.
-RESPONSE_DICT_GETPDR = {
- 'nextrecordhandle': ['0', '2', '3'],
+RESPONSE_DICT_GETPDR_SETSTATEEFFECTER = {
'responsecount': ['29', '30'],
- 'recordhandle': ['1', '2'],
'pdrheaderversion': ['1'],
'pdrtype': ['11'],
'recordchangenumber': ['0'],
'datalength': ['19', '20'],
'pldmterminushandle': ['0'],
- 'effecterid': ['1', '2'],
- 'entitytype': ['33', '45'],
+ 'effecterid': ['1', '2', '3'],
+ 'entitytype': ['33', '45', '31'],
'entityinstancenumber': ['0'],
'containerid': ['0'],
'effectersemanticid': ['0'],
'effecterinit': ['0'],
'effecterdescriptionpdr': ['false'],
'compositeeffectercount': ['1'],
- 'statesetid': ['196', '260'],
+ 'statesetid': ['196', '260', '129'],
'possiblestatessize': ['1', '2'],
- 'possiblestates': ['6', '0']}
+ 'possiblestates': ['6', '0', '64']}
-RESPONSE_DICT_GETBIOSTABLE_STRTABLE = {
- 'biosstringhandle': ['BIOSString'],
- '0': ['Allowed'],
- '1': ['Disabled'],
- '2': ['Enabled'],
- '3': ['Not Allowed'],
- '4': ['Perm'],
- '5': ['Temp'],
- '6': ['pvm-fw-boot-side'],
- '7': ['pvm-inband-code-update'],
- '8': ['pvm-os-boot-side'],
- '9': ['pvm-pcie-error-inject'],
- '10': ['pvm-surveillance'],
- '11': ['pvm-system-name'],
- '12': ['vmi-if-count']}
+RESPONSE_DICT_GETPDR_FRURECORDSETIDENTIFIER = {
+ 'responsecount': ['20'],
+ 'pdrheaderversion': ['1'],
+ 'pdrtype': ['20'],
+ 'recordchangenumber': ['0'],
+ 'datalength': ['10'],
+ 'pldmterminushandle': ['0'],
+ 'entitytype': ['System Board', 'Chassis front panel board (control panel)',
+ 'Management Controller', '208(OEM)', 'Power converter'],
+ 'containerid': ['0', '1']}
+
+RESPONSE_DICT_GETPDR_PDRENTITYASSOCIATION = {
+ 'pdrheaderversion': ['1'],
+ 'pdrtype': ['15'],
+ 'recordchangenumber': ['0'],
+ 'containerid': ['1'],
+ 'associationtype': ['Physical'],
+ 'containerentitytype': ['System Board'],
+}
+
+PLDM_PDR_TYPES = {
+ 'PLDM_STATE_EFFECTER_PDR': '11',
+ 'PLDM_PDR_FRU_RECORD_SET': '20',
+ 'PLDM_PDR_ENTITY_ASSOCIATION': '15'}
diff --git a/lib/pldm_utils.py b/lib/pldm_utils.py
index 13005b3..dd0a91f 100644
--- a/lib/pldm_utils.py
+++ b/lib/pldm_utils.py
@@ -64,6 +64,35 @@
# Date & Time :
# YYYY-MM-DD HH:MM:SS - 2020-02-24 06:44:16
return result['yyyy-mm-dd_hh'].split(' - ')[1]
+
+ # Simplfying dict output for GetPDR with type PDREntityAssociation.
+ # Example :
+
+ # pldmtool platform GetPDR -d 10
+ # Entity Association
+ # nextRecordHandle: 0
+ # responseCount: 56
+ # recordHandle: 10
+ # PDRHeaderVersion: 1
+ # PDRType: 15
+ # recordChangeNumber: 0
+ # dataLength: 46
+ # containerID: 1
+ # associationType: Physical
+ # containerEntityType: System Board
+ # containerEntityInstanceNumber: 1
+ # containerEntityContainerID: 0
+ # containedEntityCount: 6
+ # containedEntityType[1]: Chassis front panel board (control panel)
+ # containedEntityInstanceNumber[1]: 1
+ # containedEntityContainerID[1]: 1
+ # containedEntityType[2]: Chassis front panel board (control panel)
+ # containedEntityInstanceNumber[2]: 2
+ # containedEntityContainerID[2]: 1
+ elif 'containerentitycontainerid' in result:
+ dict_data1, dict_data2 = vf.split_dict_on_key('containerentitycontainerid', result)
+ return dict_data1
+
return result
return stdout
diff --git a/pldm/test_pldm_platform.robot b/pldm/test_pldm_platform.robot
index 3c1c0a3..d686531 100644
--- a/pldm/test_pldm_platform.robot
+++ b/pldm/test_pldm_platform.robot
@@ -13,17 +13,18 @@
Suite Teardown Pldmtool Platform Suite Cleanup
*** Test Cases ***
-
Verify GetPDR
[Documentation] Verify GetPDR (Platform Descpritor Record) response message.
[Tags] Verify_GetPDR
- [Template] Verify GetPDR For Record Handle
- # RecordHandle
- '0'
- '1'
- '2'
-
+ ${record_handle}= Set Variable ${1}
+ # Note: Record handle count is unknown and it is dynamic in nature.
+ # Assuming there are 100 record handle.
+ FOR ${i} IN RANGE 100
+ ${next_record_handle}= Run Keyword Verify GetPDR For Record Handle ${record_handle}
+ Exit For Loop If ${next_record_handle} == 0
+ ${record_handle}= Set Variable ${next_record_handle}
+ END
Verify SetStateEffecterStates
[Documentation] Verify set state effecter states response message.
@@ -32,20 +33,23 @@
# EffecterHandle Count EffecterStates (effecterID effecterState)
- '1' '1' '1 1' # (effecterState -> 1 -> 'Boot Not Active')
- '1' '1' '1 2' # (effecterState -> 2 -> 'Boot Completed')
- '2' '1' '1 9' # (effecterState -> 9 -> 'System Power is in soft off mode')
+ '1' '1' '1 1' # (effecterState -> 1 -> 'Boot Not Active')
+ '1' '1' '1 2' # (effecterState -> 2 -> 'Boot Completed')
+ '2' '1' '1 9' # (effecterState -> 9 -> 'System Power is in soft off mode')
+ '3' '1' '1 6' # (effecterState -> 6 -> 'Graceful Restart Requested')
*** Keywords ***
Verify GetPDR For Record Handle
- [Documentation] Verify GetPDR (Platform Descpritor Record) for given input record handle.
+ [Documentation] Verify GetPDR (Platform Descpritor Record) for given input
+ ... record handle and return next record handle.
[Arguments] ${record_handle}
# Description of argument(s):
# ${record_handle} Record handle.
- # e.g. '1' is record handle 'Boot Progress'.
- # '2' is record handle 'System Power State'.
+ # e.g. '1' is record handle 'Boot Progress' (196).
+ # '2' is record handle 'System Power State (260)'.
+ # '3' is record handle 'Software Termination Status (129)'.
# pldm_output:
# [responseCount]: 29
@@ -70,8 +74,15 @@
${pldm_cmd}= Evaluate $CMD_GETPDR % ${record_handle}
${pldm_output}= Pldmtool ${pldm_cmd}
Rprint Vars pldm_output
- Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR}
+ Run Keyword If ${pldm_output['pdrtype']} == ${PLDM_PDR_TYPES['PLDM_STATE_EFFECTER_PDR']}
+ ... Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_SETSTATEEFFECTER}
+ ... ELSE IF ${pldm_output['pdrtype']} == ${PLDM_PDR_TYPES['PLDM_PDR_FRU_RECORD_SET']}
+ ... Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_FRURECORDSETIDENTIFIER}
+ ... ELSE IF ${pldm_output['pdrtype']} == ${PLDM_PDR_TYPES['PLDM_PDR_ENTITY_ASSOCIATION']}
+ ... Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_PDRENTITYASSOCIATION}
+ Should be equal as strings ${pldm_output['recordhandle']} ${record_handle}
+ [Return] ${pldm_output['nextrecordhandle']}
Verify SetStateEffecterStates For Effecter States
[Documentation] Verify set state effecter states for given input effecter states.
@@ -93,7 +104,6 @@
Rprint Vars pldm_output
Valid Value pldm_output['setstateeffecterstates'] ['SUCCESS']
-
Pldmtool Platform Suite Cleanup
[Documentation] Reset BMC at suite cleanup.