Verify if all the sub URIs under a given URI are accessible or not

Resolves openbmc/openbmc-test-automation#1164

Change-Id: I8cc168ef93222ab84ac79a4827e9b9e2ff94787d
Signed-off-by: manasarm <manashsarma@in.ibm.com>
diff --git a/tests/test_rest_interfaces.robot b/tests/test_rest_interfaces.robot
index d650c8a..a8b88eb 100644
--- a/tests/test_rest_interfaces.robot
+++ b/tests/test_rest_interfaces.robot
@@ -342,8 +342,31 @@
     [Template]  Execute Delete And Check Response
 
 
+Verify All REST Objects Are Accessible
+    [Documentation]  Verify all the REST objects are accessible using "GET".
+    [Tags]           Verify_All_REST_Objects_Are_Accessible
+
+    ${uri_list}=  Get Sub URI List  ${OPENBMC_BASE_URI}
+    ${error_uri_list}=  Create List
+    :FOR  ${uri}  IN  @{uri_list}
+    \  ${resp}=  Openbmc Get Request  ${uri}  quiet=${1}
+    \  Run keyword if  '${resp.status_code}' != '${HTTP_OK}'
+    \  ...  Append To List  ${error_uri_list}  ${uri} : ${resp.status_code}
+    Should Be Empty  ${error_uri_list}
+
 *** Keywords ***
 
+Get Sub URI List
+    [Documentation]  Return list of sub URIs inside the URI sent by caller.
+    [Arguments]      ${uri}
+    # Description of argument(s):
+    # uri  The URI for which all the sub URIs are returned.
+    # Example:
+    # "/xyz/openbmc_project/"
+    ${resp}=  Openbmc Get Request  ${uri}list  quiet=${1}
+    ${sub_uris}=  Collections.Get From Dictionary  ${resp.json()}  data
+    [Return]  ${sub_uris}
+
 Execute Get And Check Response
     [Documentation]  Request "Get" url path and expect REST response code.
     [Arguments]  ${expected_response_code}  ${url_path}