Changes in vimconn_vmware.py: provided implementation for  get_image_list specification

Change-Id: Ia9ce852a1670bcdd6cbc67c4b941f2e1358dccfe
Signed-off-by: kate <akate@vmware.com>
diff --git a/vimconn_vmware.py b/vimconn_vmware.py
index 19382d6..bd427a9 100644
--- a/vimconn_vmware.py
+++ b/vimconn_vmware.py
@@ -1072,6 +1072,42 @@
 
         return self.get_catalogid(catalog_md5_name, vca.get_catalogs())
 
+    def get_image_list(self, filter_dict={}):
+        '''Obtain tenant images from VIM
+        Filter_dict can be:
+            name: image name
+            id: image uuid
+            checksum: image checksum
+            location: image path
+        Returns the image list of dictionaries:
+            [{<the fields at Filter_dict plus some VIM specific>}, ...]
+            List can be empty
+        '''
+        vca = self.connect()
+        if not vca:
+            raise vimconn.vimconnConnectionException("self.connect() is failed.")
+        try:
+            image_list = []
+            catalogs = vca.get_catalogs()
+            if len(catalogs) == 0:
+                return image_list
+            else:
+                for catalog in catalogs:
+                    catalog_uuid = catalog.get_id().split(":")[3]
+                    name = catalog.name
+                    filtered_dict = {}
+
+                    if ("name" not in filter_dict and "id" not in filter_dict) or \
+                       (filter_dict.get('id') == catalog_uuid or filter_dict.get('name') == name):
+                        filtered_dict ["name"] = name
+                        filtered_dict ["id"] = catalog_uuid
+                        image_list.append(filtered_dict)
+
+                self.logger.debug("List of already created catalog items: {}".format(image_list))
+                return image_list
+        except Exception as exp:
+            self.logger.error("Exception occured while retriving catalog items {}".format(exp))
+
     def get_vappid(self, vdc=None, vapp_name=None):
         """ Method takes vdc object and vApp name and returns vapp uuid or None