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/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.