GPU inventory functional state test

Resolves  openbmc/openbmc-test-automation#1134

Change-Id: Ieb2de5920869c4917fd03be30d33c704193e26f7
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_inventory.robot b/tests/test_inventory.robot
index f9339e3..025eb2c 100644
--- a/tests/test_inventory.robot
+++ b/tests/test_inventory.robot
@@ -288,6 +288,31 @@
     \  Should Be True  ${present}
     ...  msg=${cpu_uri} is functional but "Present" is not set.
 
+
+Verify GPU Functional State
+    [Documentation]  Verify that "Functional" GPU property is set if "Present"
+    ...              GPU property is set
+    [Tags]  Verify_GPU_Functional_State
+
+    # Example of gv* endpoint data:
+    # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card4": {
+    #     "Functional": 1,
+    #     "Present": 1,
+    #     "PrettyName": ""
+    # },
+
+
+    ${gpu_list}=  Get Endpoint Paths  ${HOST_INVENTORY_URI}system  gv*
+    Should Not Be Empty  ${gpu_list}
+    :FOR  ${gpu_uri}  IN  @{gpu_list}
+    \  ${status}=  Run Keyword And Return Status
+    ...  Check URL Property If Functional  ${gpu_uri}
+    \  Continue For Loop If  '${status}' == '${False}'
+    \  ${present}=  Read Attribute  ${gpu_uri}  Present
+    \  Should Be True  ${present}
+    ...  msg=${gpu_uri} is functional but "Present" is not set.
+
+
 Check Air Or Water Cooled
     [Documentation]  Check if this system is Air or water cooled.
     [Tags]  Check_Air_Or_Water_Cooled