George Keishing | e7e9171 | 2021-09-03 11:28:44 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Rahul Maheshwari | 4d48857 | 2019-12-10 23:53:05 -0600 | [diff] [blame] | 2 | |
| 3 | r""" |
| 4 | PLDM functions. |
| 5 | """ |
| 6 | |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 7 | import json |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 8 | import random |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 9 | import re |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 10 | import string |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 11 | |
| 12 | import bmc_ssh_utils as bsu |
| 13 | import func_args as fa |
| 14 | import var_funcs as vf |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 15 | from robot.api import logger |
Rahul Maheshwari | 4d48857 | 2019-12-10 23:53:05 -0600 | [diff] [blame] | 16 | |
| 17 | |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 18 | def pldmtool(option_string, **bsu_options): |
Rahul Maheshwari | 4d48857 | 2019-12-10 23:53:05 -0600 | [diff] [blame] | 19 | r""" |
| 20 | Run pldmtool on the BMC with the caller's option string and return the result. |
| 21 | |
| 22 | Example: |
| 23 | |
| 24 | ${pldm_results}= Pldmtool base GetPLDMTypes |
| 25 | Rprint Vars pldm_results |
| 26 | |
| 27 | pldm_results: |
Sridevi Ramesh | 961050b | 2020-11-12 11:04:30 -0600 | [diff] [blame] | 28 | pldmtool base GetPLDMVersion -t 0 |
| 29 | { |
| 30 | "Response": "1.0.0" |
| 31 | } |
| 32 | |
Rahul Maheshwari | 4d48857 | 2019-12-10 23:53:05 -0600 | [diff] [blame] | 33 | Description of argument(s): |
George Keishing | b9080fc | 2023-02-17 12:31:31 -0600 | [diff] [blame] | 34 | option_string A string of options which are to be processed by the |
| 35 | pldmtool command. |
| 36 | parse_results Parse the pldmtool results and return a dictionary |
| 37 | rather than the raw |
| 38 | pldmtool output. |
| 39 | bsu_options Options to be passed directly to bmc_execute_command. |
| 40 | See its prolog for details. |
Rahul Maheshwari | 4d48857 | 2019-12-10 23:53:05 -0600 | [diff] [blame] | 41 | """ |
| 42 | |
George Keishing | b9080fc | 2023-02-17 12:31:31 -0600 | [diff] [blame] | 43 | # This allows callers to specify arguments in python style |
| 44 | # (e.g. print_out=1 vs. print_out=${1}). |
Rahul Maheshwari | 4d48857 | 2019-12-10 23:53:05 -0600 | [diff] [blame] | 45 | bsu_options = fa.args_to_objects(bsu_options) |
| 46 | |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 47 | stdout, stderr, rc = bsu.bmc_execute_command( |
| 48 | "pldmtool " + option_string, **bsu_options |
| 49 | ) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 50 | if stderr: |
| 51 | return stderr |
| 52 | try: |
| 53 | return json.loads(stdout) |
| 54 | except ValueError: |
| 55 | return stdout |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 56 | |
| 57 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 58 | def GetBIOSEnumAttributeOptionalValues(attr_val_table_data): |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 59 | """ |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 60 | From pldmtool GetBIOSTable of type AttributeValueTable get the dict of |
| 61 | attribute handle and its optional values for BIOS Enumeration type. |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 62 | |
| 63 | Description of argument(s): |
| 64 | attr_val_table_data pldmtool output from GetBIOSTable table type AttributeValueTable |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 65 | e.g. |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 66 | [{ |
| 67 | "AttributeHandle": 20, |
| 68 | "AttributeNameHandle": "23(pvm-pcie-error-inject)", |
| 69 | "AttributeType": "BIOSEnumeration", |
| 70 | "NumberOfPossibleValues": 2, |
| 71 | "PossibleValueStringHandle[0]": "3(Disabled)", |
| 72 | "PossibleValueStringHandle[1]": "4(Enabled)", |
| 73 | "NumberOfDefaultValues": 1, |
| 74 | "DefaultValueStringHandleIndex[0]": 1, |
| 75 | "StringHandle": "4(Enabled)" |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 76 | }] |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 77 | @return Dictionary of BIOS attribute and its value. |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 78 | e.g. {'pvm_pcie_error_inject': ['Disabled', 'Enabled']} |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 79 | """ |
| 80 | |
| 81 | attr_val_data_dict = {} |
| 82 | for item in attr_val_table_data: |
| 83 | for attr in item: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 84 | if attr == "NumberOfPossibleValues": |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 85 | value_list = [] |
| 86 | for i in range(0, int(item[attr])): |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 87 | attr_values = item[ |
| 88 | "PossibleValueStringHandle[" + str(i) + "]" |
| 89 | ] |
| 90 | value = re.search(r"\((.*?)\)", attr_values).group(1) |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 91 | if value: |
| 92 | # Example: |
| 93 | # value = '"Power Off"' |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 94 | if " " in value: |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 95 | value = '"' + value + '"' |
| 96 | value_list.append(value) |
| 97 | else: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 98 | value_list.append("") |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 99 | |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 100 | attr_handle = re.findall( |
| 101 | r"\(.*?\)", item["AttributeNameHandle"] |
| 102 | ) |
Sridevi Ramesh | 5753745 | 2021-01-18 03:25:05 -0600 | [diff] [blame] | 103 | attr_val_data_dict[attr_handle[0][1:-1]] = value_list |
| 104 | return attr_val_data_dict |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 105 | |
| 106 | |
| 107 | def GetBIOSStrAndIntAttributeHandles(attr_type, attr_val_table_data): |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 108 | """ |
| 109 | From pldmtool GetBIOSTable of type AttributeValueTable get the dict of |
| 110 | attribute handle and its values based on the attribute type. |
| 111 | |
| 112 | Description of argument(s): |
| 113 | attr_type "BIOSInteger" or "BIOSString". |
| 114 | attr_val_table_data pldmtool output from GetBIOSTable table type AttributeValueTable. |
| 115 | |
| 116 | @return Dict of BIOS attribute and its value based on attribute type. |
| 117 | |
| 118 | """ |
| 119 | attr_val_int_dict = {} |
| 120 | attr_val_str_dict = {} |
| 121 | for item in attr_val_table_data: |
| 122 | value_dict = {} |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 123 | attr_handle = re.findall(r"\(.*?\)", item["AttributeNameHandle"]) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 124 | # Example: |
| 125 | # {'vmi_if0_ipv4_prefix_length': {'UpperBound': 32, 'LowerBound': 0} |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 126 | if item["AttributeType"] == "BIOSInteger": |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 127 | value_dict["LowerBound"] = item["LowerBound"] |
| 128 | value_dict["UpperBound"] = item["UpperBound"] |
| 129 | attr_val_int_dict[attr_handle[0][1:-1]] = value_dict |
| 130 | # Example: |
| 131 | # {'vmi_if1_ipv4_ipaddr': {'MaximumStringLength': 15, 'MinimumStringLength': 7}} |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 132 | elif item["AttributeType"] == "BIOSString": |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 133 | value_dict["MinimumStringLength"] = item["MinimumStringLength"] |
| 134 | value_dict["MaximumStringLength"] = item["MaximumStringLength"] |
| 135 | attr_val_str_dict[attr_handle[0][1:-1]] = value_dict |
| 136 | |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 137 | if attr_type == "BIOSInteger": |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 138 | return attr_val_int_dict |
George Keishing | b9080fc | 2023-02-17 12:31:31 -0600 | [diff] [blame] | 139 | if attr_type == "BIOSString": |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 140 | return attr_val_str_dict |
| 141 | |
George Keishing | b9080fc | 2023-02-17 12:31:31 -0600 | [diff] [blame] | 142 | return None |
| 143 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 144 | |
| 145 | def GetRandomBIOSIntAndStrValues(attr_name, count): |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 146 | """ |
| 147 | Get random integer or string values for BIOS attribute values based on the count. |
| 148 | |
| 149 | Description of argument(s): |
| 150 | attr_name Attribute name of BIOS attribute type Integer or string. |
| 151 | count Max length for BIOS attribute type Integer or string. |
| 152 | |
| 153 | @return Random attribute value based on BIOS attribute type Integer |
| 154 | or string. |
| 155 | |
| 156 | """ |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 157 | attr_random_value = "" |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 158 | |
| 159 | # Example |
| 160 | # 12.13.14.15 |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 161 | if "gateway" in attr_name: |
| 162 | attr_random_value = ".".join( |
| 163 | map(str, (random.randint(0, 255) for _ in range(4))) |
| 164 | ) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 165 | # Example |
| 166 | # 11.11.11.11 |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 167 | elif "ipaddr" in attr_name: |
| 168 | attr_random_value = ".".join( |
| 169 | map(str, (random.randint(0, 255) for _ in range(4))) |
| 170 | ) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 171 | # Example |
| 172 | # E5YWEDWJJ |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 173 | elif "name" in attr_name: |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 174 | data = string.ascii_uppercase + string.digits |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 175 | attr_random_value = "".join( |
| 176 | random.choice(data) for _ in range(int(count)) |
| 177 | ) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 178 | |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 179 | elif "mfg_flags" in attr_name: |
Sridevi Ramesh | 74291d4 | 2021-04-28 07:52:35 -0500 | [diff] [blame] | 180 | data = string.ascii_uppercase + string.digits |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 181 | attr_random_value = "".join( |
| 182 | random.choice(data) for _ in range(int(count)) |
| 183 | ) |
Sridevi Ramesh | 74291d4 | 2021-04-28 07:52:35 -0500 | [diff] [blame] | 184 | |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 185 | elif "hb_lid_ids" in attr_name: |
Sridevi Ramesh | 48615cd | 2021-06-15 07:21:22 -0500 | [diff] [blame] | 186 | attr_random_value = str(random.randint(0, int(count))) |
| 187 | |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 188 | else: |
| 189 | attr_random_value = random.randint(0, int(count)) |
| 190 | return attr_random_value |
| 191 | |
| 192 | |
| 193 | def GetBIOSAttrOriginalValues(attr_val_table_data): |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 194 | """ |
| 195 | From pldmtool GetBIOSTable of type AttributeValueTable get the dict of |
| 196 | attribute handle and its values. |
| 197 | |
| 198 | Description of argument(s): |
| 199 | attr_val_table_data pldmtool output from GetBIOSTable table type AttributeValueTable. |
| 200 | |
| 201 | @return Dict of BIOS attribute and its value. |
| 202 | |
| 203 | """ |
| 204 | attr_val_data_dict = {} |
| 205 | for item in attr_val_table_data: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 206 | attr_handle = re.findall(r"\(.*?\)", item["AttributeNameHandle"]) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 207 | attr_name = attr_handle[0][1:-1] |
| 208 | |
| 209 | command = "bios GetBIOSAttributeCurrentValueByHandle -a " + attr_name |
| 210 | value = pldmtool(command) |
| 211 | attr_val_data_dict[attr_name] = value["CurrentValue"] |
| 212 | if not value["CurrentValue"]: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 213 | if "name" in attr_name: |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 214 | attr_val_data_dict[attr_name] = '""' |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 215 | elif "hb_lid_ids" in attr_name: |
Sridevi Ramesh | 48615cd | 2021-06-15 07:21:22 -0500 | [diff] [blame] | 216 | attr_val_data_dict[attr_name] = '""' |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 217 | |
| 218 | return attr_val_data_dict |
| 219 | |
| 220 | |
| 221 | def GetBIOSAttrDefaultValues(attr_val_table_data): |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 222 | """ |
| 223 | From pldmtool GetBIOSTable of type AttributeValueTable get the dict of |
| 224 | attribute handle and its default attribute values. |
| 225 | |
| 226 | Description of argument(s): |
| 227 | attr_val_table_data pldmtool output from GetBIOSTable table type AttributeValueTable. |
| 228 | |
| 229 | @return Dict of BIOS attribute and its default attribute value. |
| 230 | |
| 231 | """ |
| 232 | attr_val_data_dict = {} |
| 233 | for item in attr_val_table_data: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 234 | attr_handle = re.findall(r"\(.*?\)", item["AttributeNameHandle"]) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 235 | attr_name = attr_handle[0][1:-1] |
| 236 | |
| 237 | if "DefaultString" in item: |
| 238 | attr_val_data_dict[attr_name] = item["DefaultString"] |
| 239 | if not item["DefaultString"]: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 240 | if "name" in attr_name: |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 241 | attr_val_data_dict[attr_name] = '""' |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 242 | elif "hb_lid_ids" in attr_name: |
Sridevi Ramesh | 48615cd | 2021-06-15 07:21:22 -0500 | [diff] [blame] | 243 | attr_val_data_dict[attr_name] = '""' |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 244 | elif "DefaultValue" in item: |
| 245 | attr_val_data_dict[attr_name] = item["DefaultValue"] |
| 246 | elif "StringHandle" in item: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 247 | attr_default_value = re.findall(r"\(.*?\)", item["StringHandle"]) |
Sridevi Ramesh | 2ab3d38 | 2021-03-29 04:16:01 -0500 | [diff] [blame] | 248 | attr_val_data_dict[attr_name] = attr_default_value[0][1:-1] |
| 249 | |
| 250 | return attr_val_data_dict |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 251 | |
| 252 | |
| 253 | def GetNewValuesForAllBIOSAttrs(attr_table_data): |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 254 | """ |
| 255 | Get a new set of values for all attributes in Attribute Table. |
| 256 | |
| 257 | Description of argument(s): |
| 258 | attr_table_data pldmtool output from GetBIOSTable table type AttributeValueTable. |
| 259 | |
| 260 | @return Dict of BIOS attribute and new attribute value. |
| 261 | |
| 262 | """ |
| 263 | existing_data = GetBIOSAttrOriginalValues(attr_table_data) |
| 264 | logger.info(existing_data) |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 265 | string_attr_data = GetBIOSStrAndIntAttributeHandles( |
| 266 | "BIOSString", attr_table_data |
| 267 | ) |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 268 | logger.info(string_attr_data) |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 269 | int_attr_data = GetBIOSStrAndIntAttributeHandles( |
| 270 | "BIOSInteger", attr_table_data |
| 271 | ) |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 272 | logger.info(int_attr_data) |
| 273 | enum_attr_data = GetBIOSEnumAttributeOptionalValues(attr_table_data) |
| 274 | logger.info(enum_attr_data) |
| 275 | |
| 276 | attr_random_data = {} |
| 277 | temp_list = enum_attr_data.copy() |
| 278 | for attr in enum_attr_data: |
| 279 | try: |
| 280 | temp_list[attr].remove(existing_data[attr]) |
| 281 | except ValueError: |
| 282 | try: |
| 283 | # The data values have a double quote in them. |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 284 | data = '"' + str(existing_data[attr]) + '"' |
| 285 | temp_list[attr].remove(data) |
| 286 | except ValueError: |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 287 | logger.info( |
| 288 | "Unable to remove the existing value " |
| 289 | + str(data) |
| 290 | + " from list " |
| 291 | + str(temp_list[attr]) |
| 292 | ) |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 293 | valid_values = temp_list[attr][:] |
| 294 | value = random.choice(valid_values) |
| 295 | attr_random_data[attr] = value.strip('"') |
| 296 | logger.info("Values generated for enumeration type attributes") |
| 297 | |
| 298 | for attr in string_attr_data: |
| 299 | # Iterating to make sure we have a different value |
| 300 | # other than the existing value. |
| 301 | for iter in range(5): |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 302 | random_val = GetRandomBIOSIntAndStrValues( |
| 303 | attr, string_attr_data[attr]["MaximumStringLength"] |
| 304 | ) |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 305 | if random_val != existing_data[attr]: |
| 306 | break |
| 307 | attr_random_data[attr] = random_val.strip('"') |
| 308 | logger.info("Values generated for string type attributes") |
| 309 | |
| 310 | for attr in int_attr_data: |
| 311 | for iter in range(5): |
Patrick Williams | 20f3871 | 2022-12-08 06:18:26 -0600 | [diff] [blame] | 312 | random_val = GetRandomBIOSIntAndStrValues( |
| 313 | attr, int_attr_data[attr]["UpperBound"] |
| 314 | ) |
Anusha Dathatri | ba3cb8c | 2021-05-25 21:22:02 -0500 | [diff] [blame] | 315 | if random_val != existing_data[attr]: |
| 316 | break |
| 317 | attr_random_data[attr] = random_val |
| 318 | logger.info("Values generated for integer type attributes") |
| 319 | |
| 320 | return attr_random_data |