enumerate_request to support return_json arg

Added code to enumerate_request method to support a new return_json argument.
This new argument indicates whether the result should be returned as a json
string or as a dictionary.

Change-Id: I2707a669c91e616dba92a715229cf081989a9cea
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/bmc_redfish_utils.py b/lib/bmc_redfish_utils.py
index 1efc9d7..9df9cdf 100644
--- a/lib/bmc_redfish_utils.py
+++ b/lib/bmc_redfish_utils.py
@@ -162,17 +162,22 @@
             self.walk_nested_dict(self._rest_response_.dict)
         return list(sorted(self.__pending_enumeration))
 
-    def enumerate_request(self, resource_path):
+    def enumerate_request(self, resource_path, return_json=1):
         r"""
         Perform a GET enumerate request and return available resource paths.
 
         Description of argument(s):
-        resource_path  URI resource absolute path
-                      (e.g. "/redfish/v1/SessionService/Sessions").
+        resource_path               URI resource absolute path (e.g.
+                                    "/redfish/v1/SessionService/Sessions").
+        return_json                 Indicates whether the result should be
+                                    returned as a json string or as a
+                                    dictionary.
         """
 
         gp.qprint_executing(style=gp.func_line_style_short)
 
+        return_json = int(return_json)
+
         # Set quiet variable to keep subordinate get() calls quiet.
         quiet = 1
 
@@ -210,8 +215,11 @@
             resources_to_be_enumerated = \
                 tuple(self.__pending_enumeration - enumerated_resources)
 
-        return json.dumps(self.__result, sort_keys=True,
-                          indent=4, separators=(',', ': '))
+        if return_json:
+            return json.dumps(self.__result, sort_keys=True,
+                              indent=4, separators=(',', ': '))
+        else:
+            return self.__result
 
     def walk_nested_dict(self, data, url=''):
         r"""