Refactoring the case "Test FRU Info At Power On"
Modularize the way to provide target FRU components which
want to verify.
Example:
robot -v OPENBMC_HOST:x.x.x.x -v CHANNEL_NUMBER:2
-v OPENBMC_MODEL:./data/projectA.py tests/ipmi/test_fru.robot
Content in projectA.py is as follows:
"""
FRU_COMPONENT_NAME = [
"cpu",
"dimm",
]
ipmi_rest_fru_field_map = {
"cpu": {
"board_mfg_date": "BuildDate",
"board_mfg": "Manufacturer",
"board_product": "PrettyName",
"board_serial": "SerialNumber",
"board_part_number": "PartNumber"
},
"dimm": {
"product_manufacturer": "Manufacturer",
"product_name": "PrettyName",
"product_part_number": "Model",
"product_version": "Version",
"product_serial": "SerialNumber"
},
}
"""
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
Change-Id: I69c921750129167c5904574223032f7abad92fa6
diff --git a/data/model.py b/data/model.py
index 18065b1..27a744a 100755
--- a/data/model.py
+++ b/data/model.py
@@ -57,3 +57,23 @@
def call_keyword(keyword):
return BuiltIn().run_keyword(keyword)
+
+
+def get_FRU_component_name_list(module_name):
+ name_list = []
+ m = imp.load_source('module.name', module_name)
+
+ for name in m.FRU_COMPONENT_NAME:
+ name_list.append(name)
+ print(name)
+
+ return name_list
+
+
+def get_ipmi_rest_fru_field_map(module_name):
+
+ m = imp.load_source('module.name', module_name)
+
+ ipmi_rest_fru_field_map = dict.copy(m.ipmi_rest_fru_field_map)
+
+ return ipmi_rest_fru_field_map
diff --git a/tests/ipmi/test_fru.robot b/tests/ipmi/test_fru.robot
index 49dfd9d..6c69cde 100644
--- a/tests/ipmi/test_fru.robot
+++ b/tests/ipmi/test_fru.robot
@@ -6,8 +6,7 @@
Resource ../../lib/openbmc_ffdc.robot
Resource ../../lib/boot_utils.robot
Library ../../lib/ipmi_utils.py
-
-Variables ../data/ipmi_rest_fru_field_map.py
+Library ../../data/model.py
Test Teardown Test Teardown Execution
Suite Setup Suite Setup Execution
@@ -18,16 +17,15 @@
Test FRU Info At Power On
[Documentation] Verify FRU info via IPMI and REST at power on.
[Tags] Test_FRU_Info_At_Power_On
- [Template] Verify FRU Info
- # component_name
- cpu
- dimm
- fan
- bmc
- system
- powersupply
- gv100card
+ ${component_name_list}= Get FRU Component Name List ${OPENBMC_MODEL}
+ &{ipmi_rest_fru_field_map}= Get Ipmi Rest Fru Field Map ${OPENBMC_MODEL}
+ Set Global Variable ${ipmi_rest_fru_field_map}
+ Rprint Vars ipmi_rest_fru_field_map component_name_list
+
+ FOR ${component_name} IN @{component_name_list}
+ Verify FRU Info ${component_name}
+ END
*** Keywords ***