FRU present validation test

Added:
   - CPU present
   - DIMM present

Resolves openbmc/openbmc-test-automation#398

Change-Id: Icc65c36b8a6efd5c979ab852ffce58f0a7b1ec85
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_inventory.robot b/tests/test_inventory.robot
index b70bc54..ccd71b7 100644
--- a/tests/test_inventory.robot
+++ b/tests/test_inventory.robot
@@ -51,6 +51,58 @@
     ...  ${properties["data"]["SerialNumber"]}  000000000000
     ...  msg=motherboard serial number invalid.
 
+Verify CPU Present
+    [Documentation]  Check if the FRU "Present" is set for CPU's.
+    [Tags]  Verify_CPU_Present
+    # System inventory cpu list:
+    # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
+    # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
+    # Example:
+    #    "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
+    #    "FieldReplaceable": 1,
+    #    "BuildDate": "",
+    #    "Cached": 0,
+    #    "SerialNumber": "YA3933741574",
+    #    "Version": "10",
+    #    "Model": "",
+    #    "PrettyName": "PROCESSOR MODULE",
+    #    "PartNumber": "01HL322",
+    #    "Present": 1,
+    #    "Manufacturer": "IBM"
+    # },
+    # The CPU properties "Present" should be boolean 1.
+
+    ${cpu_list}=  Get Endpoint Paths  ${HOST_INVENTORY_URI}system  cpu
+    :FOR  ${cpu_uri}  IN  @{cpu_list}
+    \  ${present}=  Read Attribute  ${cpu_uri}  Present
+    \  Should Be True  ${present}
+
+
+Verify DIMM Present
+    [Documentation]  Check if the FRU "Present" is set for DIMM's.
+    [Tags]  Verify_DIMM_Present
+    # Example:
+    #   "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
+    #    "FieldReplaceable": 1,
+    #    "BuildDate": "",
+    #    "Cached": 0,
+    #    "SerialNumber": "0x0300cf4f",
+    #    "Version": "0x00",
+    #    "Model": "M393A1G40EB1-CRC    ",
+    #    "PrettyName": "0x0c",
+    #    "PartNumber": "",
+    #    "Present": 1,
+    #    "Manufacturer": "0xce80"
+    # },
+
+    # The DIMM properties "Present" should be boolean 1.
+
+    ${dimm_list}=  Get Endpoint Paths  ${HOST_INVENTORY_URI}system  dimm
+    :FOR  ${dimm_uri}  IN  @{dimm_list}
+    \  ${present}=  Read Attribute  ${dimm_uri}  Present
+    \  Should Be True  ${present}
+
+
 *** Keywords ***
 
 Test Suite Setup