Automate testcase to verify BIOS attribute using pldmtool.
- Verify SetBIOSAttributeCurrentValue
- Verify GetBIOSAttributeCurrentValueByHandle
Change-Id: Ib9d6cbbcd2f34a9904b08fa72549822b54291be1
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/pldm/test_pldm_bios.robot b/pldm/test_pldm_bios.robot
index a5ef65d..0fc9aca 100644
--- a/pldm/test_pldm_bios.robot
+++ b/pldm/test_pldm_bios.robot
@@ -91,8 +91,7 @@
FOR ${key} IN @{keys}
Append To List ${string_list} ${pldm_output['${key}']}
END
- Log To Console ${string_list}
- Valid List string_list required_values=${RESPONSE_LIST_GETBIOSTABLE_STRTABLE}
+ Valid List string_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRTABLE}
Verify GetBIOSTable For AttributeTable
@@ -139,9 +138,57 @@
END
Valid List attr_val_list required_values=${RESPONSE_LIST_GETBIOSTABLE_ATTRVALTABLE}
+
+Verify SetBIOSAttributeCurrentValue
+
+ [Documentation] Verify SetBIOSAttributeCurrentValue with the
+ ... various BIOS attribute handle and its values.
+ [Tags] Verify_SetBIOSAttributeCurrentValue
+
+ # Example output:
+ #
+ # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_hostname -d BMC
+ # {
+ # "Response": "SUCCESS"
+ # }
+
+ ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
+ Log ${pldm_output}
+ ${attr_val_data}= GenerateBIOSAttrHandleValueDict ${pldm_output}
+ Log ${attr_val_data}
+ @{attr_handles}= Get Dictionary Keys ${attr_val_data}
+ FOR ${i} IN @{attr_handles}
+ @{attr_val_list}= Set Variable ${attr_val_data}[${i}]
+ Validate SetBIOSAttributeCurrentValue ${i} @{attr_val_list}
+ END
+
+Verify GetBIOSAttributeCurrentValueByHandle
+
+ [Documentation] Verify GetBIOSAttributeCurrentValueByHandle with the
+ ... various BIOS attribute handle and its values.
+ [Tags] Verify_GetBIOSAttributeCurrentValueByHandle
+
+ # Example output:
+ #
+ # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a pvm_fw_boot_side
+ # {
+ # "CurrentValue": "Temp"
+ # }
+
+ ${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
+ ${attr_val_data}= GenerateBIOSAttrHandleValueDict ${pldm_output}
+ @{attr_handles}= Get Dictionary Keys ${attr_val_data}
+ FOR ${i} IN @{attr_handles}
+ ${cur_attr}= Pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${i}
+ @{attr_val_list}= Set Variable ${attr_val_data}[${i}]
+ Run Keyword If '${cur_attr['CurrentValue']}' not in @{attr_val_list}
+ ... Fail Invalid GetBIOSAttributeCurrentValueByHandle value found.
+ END
+
*** Keywords ***
PLDM BIOS Suite Cleanup
+
[Documentation] Perform pldm BIOS suite cleanup.
${result}= Get Current Date UTC exclude_millis=True
@@ -149,3 +196,22 @@
${cmd_set_date_time}= Evaluate $CMD_SETDATETIME % '${current_date_time}'
${pldm_output}= Pldmtool ${cmd_set_date_time}
Valid Value pldm_output['Response'] ['SUCCESS']
+
+Validate SetBIOSAttributeCurrentValue
+
+ [Documentation] Set BIOS attribute with the available attribute handle
+ ... values and revert back to original attribute handle value.
+ [Arguments] ${attr_handle} @{attr_val_list}
+
+ # Description of argument(s):
+ # attr_handle BIOS attribute handle (e.g. pvm_system_power_off_policy).
+ # attr_val_list List of the attribute values for the given attribute handle
+ # (e.g. ['"Power Off"', '"Stay On"', 'Automatic']).
+
+ ${cur_attr}= Pldmtool bios GetBIOSAttributeCurrentValueByHandle -a ${attr_handle}
+ FOR ${j} IN @{attr_val_list}
+ ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attr_handle} -d ${j}
+ Valid Value pldm_resp['Response'] ['SUCCESS']
+ END
+ ${pldm_resp}= pldmtool bios SetBIOSAttributeCurrentValue -a ${attr_handle} -d ${cur_attr['CurrentValue']}
+ Valid Value pldm_resp['Response'] ['SUCCESS']