Update test code based on latest robot directives
Changes:
- Non-local variable is not uppercase
- Variable with global scope defined outside
variables section
- Keyword name Should be equal as strings does
not follow case convention
- Exit For Loop If is deprecated since
Robot Framework version 5.*, use IF and BREAK instead
- Run Keyword If is deprecated since
Robot Framework version 5.*, use IF instead
Tested:
- NA
Change-Id: I41440993a37631307271fc05bca4ebb65ef6e205
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/pldm/test_pldm_bios.robot b/pldm/test_pldm_bios.robot
index 4778626..711f6e8 100755
--- a/pldm/test_pldm_bios.robot
+++ b/pldm/test_pldm_bios.robot
@@ -105,8 +105,9 @@
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.
+ IF '${cur_attr['CurrentValue']}' not in @{attr_val_list}
+ Fail Invalid GetBIOSAttributeCurrentValueByHandle value found.
+ END
END
diff --git a/pldm/test_pldm_platform.robot b/pldm/test_pldm_platform.robot
index 6453bfd..cb933bd 100644
--- a/pldm/test_pldm_platform.robot
+++ b/pldm/test_pldm_platform.robot
@@ -12,7 +12,7 @@
Test Teardown FFDC On Test Case Fail
Suite Teardown Pldmtool Platform Suite Cleanup
-Test Tags Pldm_Platform
+Test Tags Pldm_Platform
*** Test Cases ***
Verify GetPDR
@@ -24,7 +24,7 @@
# 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
+ IF ${next_record_handle} == 0 BREAK
${record_handle}= Set Variable ${next_record_handle}
END
@@ -77,30 +77,25 @@
${pldm_output}= Pldmtool ${pldm_cmd}
Rprint Vars pldm_output
- Run Keyword If '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_STATE_EFFECTER_PDR']}'
- ... Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_SETSTATEEFFECTER}
+ 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']}'
+ Log To Console "Found PDR Type - PLDM_ENTITY_ASSOCIATION_PDR"
+ ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_STATE_SENSOR_PDR']}'
+ Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_STATESENSORPDR}
+ ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_NUMERIC_EFFECTER_PDR']}'
+ Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_NUMERICEFFECTERPDR}
+ ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_TERMINUS_LOCATOR_PDR']}'
+ Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_TERMINUSLOCATORPDR}
+ ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_COMPACT_NUMERIC_SENSOR_PDR']}'
+ Log To Console "Found PDR Type - PLDM_COMPACT_NUMERIC_SENSOR_PDR'
+ ELSE
+ Fail msg="Unknown PDR Type is received"
+ END
- ... 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']}'
- ... Log To Console "Found PDR Type - PLDM_ENTITY_ASSOCIATION_PDR"
-
- ... ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_STATE_SENSOR_PDR']}'
- ... Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_STATESENSORPDR}
-
- ... ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_NUMERIC_EFFECTER_PDR']}'
- ... Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_NUMERICEFFECTERPDR}
-
- ... ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_TERMINUS_LOCATOR_PDR']}'
- ... Valid Dict pldm_output valid_values=${RESPONSE_DICT_GETPDR_TERMINUSLOCATORPDR}
-
- ... ELSE IF '${pldm_output['PDRType']}' == '${PLDM_PDR_TYPES['PLDM_COMPACT_NUMERIC_SENSOR_PDR']}'
- ... Log To Console "Found PDR Type - PLDM_COMPACT_NUMERIC_SENSOR_PDR'
-
- ... ELSE Fail msg="Unknown PDR Type is received"
-
- Should be equal as strings ${pldm_output['recordHandle']} ${record_handle}
+ Should Be Equal As Strings ${pldm_output['recordHandle']} ${record_handle}
RETURN ${pldm_output['nextRecordHandle']}
Verify SetStateEffecterStates For Effecter States
diff --git a/pldm/test_redfish_bios_attributes.robot b/pldm/test_redfish_bios_attributes.robot
index e86765f..03f9985 100755
--- a/pldm/test_redfish_bios_attributes.robot
+++ b/pldm/test_redfish_bios_attributes.robot
@@ -18,8 +18,8 @@
*** Variables ***
-${bios_original_data} ${EMPTY}
-${attr_table_data} ${EMPTY}
+${BIOS_ORIGINAL_DATA} ${EMPTY}
+${ATTR_TABLE_DATA} ${EMPTY}
*** Test Cases ***
@@ -39,7 +39,7 @@
... using Redfish.
[Tags] Redfish_Verify_Set_Invalid_Optional_Value_For_BIOS_Enumeration_Attribute_Type
- ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
+ ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${ATTR_TABLE_DATA}
@{attr_handles}= Get Dictionary Keys ${attr_val_data}
${enum_attr}= Evaluate random.choice(${attr_handles}) modules=random
@@ -52,7 +52,7 @@
... using Redfish.
[Tags] Redfish_Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type
- ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
+ ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${ATTR_TABLE_DATA}
@{attr_handles}= Get Dictionary Keys ${attr_val_data}
${int_attr}= Evaluate random.choice(${attr_handles}) modules=random
${count}= Evaluate ${attr_val_data['${int_attr}']["UpperBound"]} + 5
@@ -67,7 +67,7 @@
... using Redfish.
[Tags] Redfish_Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type
- ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
+ ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${ATTR_TABLE_DATA}
@{attr_handles}= Get Dictionary Keys ${attr_val_data}
${str_attr}= Evaluate random.choice(${attr_handles}) modules=random
${count}= Evaluate ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5
@@ -84,13 +84,13 @@
@{failed_attr_list}= Create List
- ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${attr_table_data}
+ ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSString ${ATTR_TABLE_DATA}
@{attr_handles}= Get Dictionary Keys ${attr_val_data}
FOR ${i} IN @{attr_handles}
${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["MaximumStringLength"]}
${status}= Run Keyword And Return Status
... Set BIOS Attribute Value And Verify ${i} ${random_value}
- Run Keyword If ${status} == ${False} Append To List ${failed_attr_list} ${i}
+ IF ${status} == ${False} Append To List ${failed_attr_list} ${i}
END
${fail_count}= Get Length ${failed_attr_list}
@@ -106,13 +106,13 @@
@{failed_attr_list}= Create List
- ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${attr_table_data}
+ ${attr_val_data}= GetBIOSStrAndIntAttributeHandles BIOSInteger ${ATTR_TABLE_DATA}
@{attr_handles}= Get Dictionary Keys ${attr_val_data}
FOR ${i} IN @{attr_handles}
${random_value}= GetRandomBIOSIntAndStrValues ${i} ${attr_val_data['${i}']["UpperBound"]}
${status}= Run Keyword And Return Status
... Set BIOS Attribute Value And Verify ${i} ${random_value}
- Run Keyword If ${status} == ${False} Append To List ${failed_attr_list} ${i}
+ IF ${status} == ${False} Append To List ${failed_attr_list} ${i}
END
${fail_count}= Get Length ${failed_attr_list}
@@ -128,7 +128,7 @@
@{failed_attr_list}= Create List
# Fetch BIOS attribute optional values from pldmtool getbiostable.
- ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${attr_table_data}
+ ${attr_val_data}= GetBIOSEnumAttributeOptionalValues ${ATTR_TABLE_DATA}
@{attr_handles}= Get Dictionary Keys ${attr_val_data}
# Example:
@@ -139,7 +139,7 @@
@{attr_val_list}= Set Variable ${attr_val_data}[${i}]
${status}= Run Keyword And Return Status
... Set Optional BIOS Attribute Values And Verify ${i} @{attr_val_list}
- Run Keyword If ${status} == ${False} Append To List ${failed_attr_list} ${i}
+ IF ${status} == ${False} Append To List ${failed_attr_list} ${i}
END
${fail_count}= Get Length ${failed_attr_list}
@@ -152,7 +152,7 @@
... using Redfish.
[Tags] Redfish_Verify_Restore_BIOS_Attribute_Values
- ${bios_default_data}= GetBIOSAttrDefaultValues ${attr_table_data}
+ ${bios_default_data}= GetBIOSAttrDefaultValues ${ATTR_TABLE_DATA}
@{attr_handles}= Get Dictionary Keys ${bios_default_data}
FOR ${i} IN @{attr_handles}
@@ -166,17 +166,17 @@
Redfish.Login
${pldm_output}= Pldmtool bios GetBIOSTable --type AttributeTable
- Set Global Variable ${attr_table_data} ${pldm_output}
+ Set Suite Variable ${ATTR_TABLE_DATA} ${pldm_output}
${data}= GetBIOSAttrOriginalValues ${pldm_output}
- Set Global Variable ${bios_original_data} ${data}
+ Set Suite Variable ${BIOS_ORIGINAL_DATA} ${data}
Redfish BIOS Suite Cleanup
[Documentation] Perform Redfish BIOS suite cleanup.
- @{attr_handles}= Get Dictionary Keys ${bios_original_data}
+ @{attr_handles}= Get Dictionary Keys ${BIOS_ORIGINAL_DATA}
FOR ${i} IN @{attr_handles}
- Set BIOS Attribute Value And Verify ${i} ${bios_original_data['${i}']}
+ Set BIOS Attribute Value And Verify ${i} ${BIOS_ORIGINAL_DATA['${i}']}
END
Redfish.Logout