| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 |  | 
|  | 3 | Documentation    Module to test PLDM BIOS attribute types. | 
|  | 4 |  | 
|  | 5 | Library          Collections | 
|  | 6 | Library          String | 
|  | 7 | Library          ../lib/pldm_utils.py | 
|  | 8 | Variables        ../data/pldm_variables.py | 
|  | 9 | Resource         ../lib/openbmc_ffdc.robot | 
|  | 10 |  | 
|  | 11 | Test Setup       Printn | 
|  | 12 | Test Teardown    FFDC On Test Case Fail | 
|  | 13 | Suite Setup      PLDM BIOS Attribute Suite Setup | 
|  | 14 | Suite Teardown   PLDM BIOS Attribute Suite Cleanup | 
|  | 15 |  | 
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 16 | Test Tags       Pldm_Bios_Attributes | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 17 |  | 
|  | 18 | *** Variables *** | 
|  | 19 |  | 
|  | 20 | ${bios_original_data}       ${EMPTY} | 
| George Keishing | e18030c | 2022-07-20 13:37:01 -0500 | [diff] [blame] | 21 | ${attr_table_data}          ${EMPTY} | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 22 |  | 
|  | 23 |  | 
|  | 24 | *** Test Cases *** | 
|  | 25 |  | 
|  | 26 | Verify Get BIOS Attribute With Invalid Attribute Name | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 27 | [Documentation]  Verify get BIOS attribute with invalid attribute name. | 
|  | 28 | [Tags]  Verify_Get_BIOS_Attribute_With_Invalid_Attribute_Name | 
|  | 29 |  | 
|  | 30 | ${random_attr}=  Generate Random String  8  [LETTERS][NUMBERS] | 
|  | 31 | ${pldm_output}=  pldmtool  bios GetBIOSAttributeCurrentValueByHandle -a ${random_attr} | 
|  | 32 |  | 
|  | 33 | # Example output: | 
|  | 34 | # | 
|  | 35 | # pldmtool bios GetBIOSAttributeCurrentValueByHandle -a hjkhkj | 
|  | 36 | # Can not find the attribute hjkhkj | 
|  | 37 | # | 
|  | 38 |  | 
|  | 39 | Should Contain  ${pldm_output}  Can not find the attribute | 
|  | 40 |  | 
|  | 41 |  | 
|  | 42 | Verify Set BIOS Attribute With Invalid Attribute Name | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 43 | [Documentation]  Verify set BIOS attribute with invalid attribute name. | 
|  | 44 | [Tags]  Verify_Set_BIOS_Attribute_With_Invalid_Attribute_Name | 
|  | 45 |  | 
|  | 46 | ${random_str}=  Generate Random String  8  [LETTERS][NUMBERS] | 
|  | 47 | ${pldm_output}=  pldmtool  bios SetBIOSAttributeCurrentValue -a ${random_str} -d ${random_str} | 
|  | 48 |  | 
|  | 49 | # Example output: | 
|  | 50 | # | 
|  | 51 | # pldmtool bios SetBIOSAttributeCurrentValue -a hjkhkj -d 0 | 
|  | 52 | # Could not find attribute :hjkhkj | 
|  | 53 | # | 
|  | 54 |  | 
|  | 55 | Should Contain  ${pldm_output}  Could not find attribute | 
|  | 56 |  | 
|  | 57 |  | 
|  | 58 | Verify Set Invalid Optional Value For BIOS Enumeration Attribute Type | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 59 | [Documentation]  Verify set invalid optional value for BIOS enumeration attribute type. | 
|  | 60 | [Tags]  Verify_Set_Invalid_Optional_Value_For_BIOS_Enumeration_Attribute_Type | 
|  | 61 |  | 
|  | 62 | ${attr_val_data}=  GetBIOSEnumAttributeOptionalValues  ${attr_table_data} | 
|  | 63 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 64 | ${enum_attr}=  Evaluate  random.choice(${attr_handles})  modules=random | 
|  | 65 |  | 
|  | 66 | # Example output: | 
|  | 67 | # | 
|  | 68 | # pldmtool bios SetBIOSAttributeCurrentValue -a pvm_os_boot_side -d hhhhhj | 
|  | 69 | # Set Attribute Error: It's not a possible value | 
|  | 70 | # | 
|  | 71 |  | 
|  | 72 | ${pldm_output}=  pldmtool  bios SetBIOSAttributeCurrentValue -a ${enum_attr} -d 0 | 
|  | 73 | Should Contain  ${pldm_output}  Set Attribute Error | 
|  | 74 |  | 
|  | 75 |  | 
|  | 76 | Verify Set Out Of Range Integer Value For BIOS Integer Attribute Type | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 77 | [Documentation]  Verify set out of range integer value for BIOS integer attribute type. | 
|  | 78 | [Tags]  Verify_Set_Out_Of_Range_Integer_Value_For_BIOS_Integer_Attribute_Type | 
|  | 79 |  | 
|  | 80 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSInteger  ${attr_table_data} | 
|  | 81 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 82 | ${int_attr}=  Evaluate  random.choice(${attr_handles})  modules=random | 
|  | 83 | ${count}=  Evaluate  ${attr_val_data['${int_attr}']["UpperBound"]} + 5 | 
|  | 84 |  | 
|  | 85 | # Example output: | 
|  | 86 | # | 
|  | 87 | # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if_count -d 12 | 
|  | 88 | # Response Message Error: rc=0,cc=2 | 
|  | 89 | # | 
|  | 90 |  | 
|  | 91 | ${pldm_output}=  pldmtool  bios SetBIOSAttributeCurrentValue -a ${int_attr} -d ${count} | 
|  | 92 | Should Contain  ${pldm_output}  Response Message Error | 
|  | 93 |  | 
|  | 94 |  | 
|  | 95 | Verify Set Out Of Range String Value For BIOS String Attribute Type | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 96 | [Documentation]  Verify set out of range string value for BIOS string attribute type. | 
|  | 97 | [Tags]  Verify_Set_Out_Of_Range_String_Value_For_BIOS_String_Attribute_Type | 
|  | 98 |  | 
|  | 99 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSString  ${attr_table_data} | 
|  | 100 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 101 | ${str_attr}=  Evaluate  random.choice(${attr_handles})  modules=random | 
|  | 102 | ${count}=  Evaluate  ${attr_val_data['${str_attr}']["MaximumStringLength"]} + 5 | 
|  | 103 | ${random_value}=  Generate Random String  ${count}  [LETTERS][NUMBERS] | 
|  | 104 |  | 
|  | 105 | # Example output: | 
|  | 106 | # | 
|  | 107 | # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if0_ipv4_ipaddr -d 1234566788999 | 
|  | 108 | # Response Message Error: rc=0,cc=2 | 
|  | 109 | # | 
|  | 110 |  | 
|  | 111 | ${pldm_output}=  pldmtool  bios SetBIOSAttributeCurrentValue -a ${str_attr} -d ${random_value} | 
|  | 112 | Should Contain  ${pldm_output}  Response Message Error | 
|  | 113 |  | 
|  | 114 |  | 
|  | 115 | Verify Set BIOS String Attribute Type | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 116 | [Documentation]  Verify set BIOS string attribute type for various BIOS | 
|  | 117 | ...              attribute handle with random values with in the range. | 
|  | 118 | [Tags]  Verify_Set_BIOS_String_Attribute_Type | 
|  | 119 |  | 
|  | 120 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSString  ${attr_table_data} | 
|  | 121 |  | 
|  | 122 | # Example output: | 
|  | 123 | # | 
|  | 124 | # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_hostname -d BMC | 
|  | 125 | # { | 
|  | 126 | #     "Response": "SUCCESS" | 
|  | 127 | # } | 
|  | 128 |  | 
|  | 129 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 130 | FOR  ${i}  IN  @{attr_handles} | 
|  | 131 | ${random_value}=  GetRandomBIOSIntAndStrValues  ${i}  ${attr_val_data['${i}']["MaximumStringLength"]} | 
|  | 132 | ${attr_val_list}=  Create List | 
|  | 133 | Append To List  ${attr_val_list}  ${random_value} | 
|  | 134 | Validate Set BIOS Attributes With Optional Values  ${i}  @{attr_val_list} | 
|  | 135 | END | 
|  | 136 |  | 
|  | 137 |  | 
|  | 138 | Verify Set BIOS Integer Attribute Type | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 139 | [Documentation]  Verify set BIOS integer attribute type for various BIOS | 
|  | 140 | ...              attribute handle with random values with in the range. | 
|  | 141 | [Tags]  Verify_Set_BIOS_Integer_Attribute_Type | 
|  | 142 |  | 
|  | 143 | ${attr_val_data}=  GetBIOSStrAndIntAttributeHandles  BIOSInteger  ${attr_table_data} | 
|  | 144 |  | 
|  | 145 | # Example output: | 
|  | 146 | # | 
|  | 147 | # pldmtool bios SetBIOSAttributeCurrentValue -a vmi_if_count -d 1 | 
|  | 148 | # { | 
|  | 149 | #     "Response": "SUCCESS" | 
|  | 150 | # } | 
|  | 151 |  | 
|  | 152 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 153 |  | 
|  | 154 | FOR  ${i}  IN  @{attr_handles} | 
|  | 155 | ${random_value}=  GetRandomBIOSIntAndStrValues  ${i}  ${attr_val_data['${i}']["UpperBound"]} | 
|  | 156 | ${attr_val_list}=  Create List | 
|  | 157 | Append To List  ${attr_val_list}  ${random_value} | 
|  | 158 | Validate Set BIOS Attributes With Optional Values  ${i}  @{attr_val_list} | 
|  | 159 | END | 
|  | 160 |  | 
|  | 161 |  | 
|  | 162 | Verify Set BIOS Enumeration Attribute Type | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 163 | [Documentation]  Verify set BIOS enumeration attribute type for various BIOS | 
|  | 164 | ...              attribute handle with random values with in the range of | 
|  | 165 | ...              default optional values. | 
| George Keishing | b98036a | 2022-01-31 12:39:47 -0600 | [diff] [blame] | 166 | [Tags]  Verify_Set_BIOS_Enumeration_Attribute_Type | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 167 |  | 
|  | 168 | ${attr_val_data}=  GetBIOSEnumAttributeOptionalValues  ${attr_table_data} | 
|  | 169 |  | 
|  | 170 | # Example output: | 
|  | 171 | # | 
|  | 172 | # pldmtool bios SetBIOSAttributeCurrentValue -a pvm_default_os_type -d AIX | 
|  | 173 | # { | 
|  | 174 | #     "Response": "SUCCESS" | 
|  | 175 | # } | 
|  | 176 |  | 
|  | 177 | @{attr_handles}=  Get Dictionary Keys  ${attr_val_data} | 
|  | 178 | FOR  ${i}  IN  @{attr_handles} | 
|  | 179 | @{attr_val_list}=  Set Variable  ${attr_val_data}[${i}] | 
|  | 180 | Validate Set BIOS Attributes With Optional Values  ${i}  @{attr_val_list} | 
|  | 181 | END | 
|  | 182 |  | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 183 | *** Keywords *** | 
|  | 184 |  | 
|  | 185 | PLDM BIOS Attribute Suite Setup | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 186 | [Documentation]  Perform PLDM BIOS attribute suite setup. | 
|  | 187 |  | 
|  | 188 | ${pldm_output}=  Pldmtool  bios GetBIOSTable --type AttributeTable | 
|  | 189 | Set Global Variable  ${attr_table_data}  ${pldm_output} | 
|  | 190 |  | 
|  | 191 | ${data}=  GetBIOSAttrOriginalValues  ${pldm_output} | 
|  | 192 | Set Global Variable  ${bios_original_data}  ${data} | 
|  | 193 |  | 
|  | 194 |  | 
|  | 195 | PLDM BIOS Attribute Suite Cleanup | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 196 | [Documentation]  Perform PLDM BIOS attribute suite cleanup. | 
|  | 197 |  | 
| George Keishing | e18030c | 2022-07-20 13:37:01 -0500 | [diff] [blame] | 198 | Run Keyword And Ignore Error | 
|  | 199 | ...  Validate Set All BIOS Attributes Values  ${bios_original_data} | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 200 |  | 
|  | 201 |  | 
|  | 202 | Validate Set BIOS Attributes With Optional Values | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 203 | [Documentation]  Set BIOS attribute with the available attribute handle | 
|  | 204 | ...              values and revert back to original attribute handle value. | 
|  | 205 | [Arguments]      ${attr_handle}  @{attr_val_list} | 
|  | 206 |  | 
|  | 207 | # Description of argument(s): | 
|  | 208 | # attr_handle    BIOS attribute handle (e.g. pvm_system_power_off_policy). | 
|  | 209 | # attr_val_list  List of the attribute values for the given attribute handle | 
|  | 210 | #                (e.g. ['"Power Off"', '"Stay On"', 'Automatic']). | 
|  | 211 |  | 
|  | 212 | FOR  ${j}  IN  @{attr_val_list} | 
|  | 213 | ${pldm_resp}=  pldmtool  bios SetBIOSAttributeCurrentValue -a ${attr_handle} -d ${j} | 
|  | 214 | Valid Value  pldm_resp['Response']  ['SUCCESS'] | 
|  | 215 |  | 
|  | 216 | # Compare BIOS attribute values after set operation. | 
|  | 217 | ${output}=  pldmtool  bios GetBIOSAttributeCurrentValueByHandle -a ${attr_handle} | 
|  | 218 | ${value1}=  Convert To String  ${output["CurrentValue"]} | 
|  | 219 | ${value2}=  Convert To String  ${j} | 
|  | 220 | ${value2}=  Replace String  ${value2}  "  ${EMPTY} | 
|  | 221 | Should Be Equal  ${value1.strip()}  ${value2.strip()} | 
|  | 222 |  | 
|  | 223 | END | 
|  | 224 |  | 
|  | 225 |  | 
|  | 226 | Validate Set All BIOS Attributes Values | 
| Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 227 | [Documentation]  Validate Set BIOS Attributes Values. | 
|  | 228 | [Arguments]      ${bios_attr_data} | 
|  | 229 |  | 
|  | 230 | # Description of argument(s): | 
|  | 231 | # bios_attr_data  Dictionary containing BIOS attribute name and values. | 
|  | 232 |  | 
|  | 233 | @{keys}=  Get Dictionary Keys  ${bios_attr_data} | 
|  | 234 |  | 
|  | 235 | FOR  ${key}  IN  @{keys} | 
|  | 236 | ${pldm_resp}=  pldmtool  bios SetBIOSAttributeCurrentValue -a ${key} -d ${bios_attr_data['${key}']} | 
|  | 237 | Valid Value  pldm_resp['Response']  ['SUCCESS'] | 
|  | 238 |  | 
|  | 239 | # Compare BIOS attribute values after set operation. | 
|  | 240 | ${output}=  pldmtool  bios GetBIOSAttributeCurrentValueByHandle -a ${key} | 
|  | 241 | ${value1}=  Convert To String  ${output["CurrentValue"]} | 
|  | 242 | ${value2}=  Convert To String  ${bios_attr_data['${key}']} | 
|  | 243 | ${value2}=  Replace String  ${value2}  "  ${EMPTY} | 
|  | 244 | Should Be Equal  ${value1.strip()}  ${value2.strip()} | 
|  | 245 | END |