Merge "v0.4.61 fixed 37 Deploying multisite get properly the information from sites...
[osm/RO.git] / vimconn.py
index b06f04e..cd529de 100644 (file)
@@ -82,7 +82,7 @@ class vimconnector():
     These plugins must implement a vimconnector class derived from this 
     and all these methods
     ''' 
-    def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level="ERROR", config={}):
+    def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None, config={}):
         self.id        = uuid
         self.name      = name
         self.url       = url
@@ -92,8 +92,9 @@ class vimconnector():
         self.user      = user
         self.passwd    = passwd
         self.config    = config
-        self.logger = logging.getLogger('mano.vim')
-        self.logger.setLevel( getattr(logging, log_level) )
+        self.logger = logging.getLogger('openmano.vim')
+        if log_level:
+            self.logger.setLevel( getattr(logging, log_level) )
         if not self.url_admin:  #try to use normal url 
             self.url_admin = self.url
     
@@ -160,9 +161,11 @@ class vimconnector():
         '''
         raise vimconnNotImplemented( "Should have implemented this" )
 
-    def new_network(self,net_name, net_type, shared=False):
+    def new_network(self,net_name, net_type, ip_profile=None, shared=False):
         '''Adds a tenant network to VIM
-            net_type can be 'bridge','data'.'ptp'.  TODO: this need to be revised 
+            net_name is the name
+            net_type can be 'bridge','data'.'ptp'.  TODO: this need to be revised
+            ip_profile is a dict containing the IP parameters of the network 
             shared is a boolean
         Returns the network identifier'''
         raise vimconnNotImplemented( "Should have implemented this" )
@@ -261,15 +264,23 @@ class vimconnector():
         raise vimconnNotImplemented( "Should have implemented this" )
 
     def get_image_id_from_path(self, path):
-        '''Get the image id from image path in the VIM database'''
-        '''Returns:
-             0,"Image not found"   if there are no images with that path
-             1,image-id            if there is one image with that path
-             <0,message            if there was an error (Image not found, error contacting VIM, more than 1 image with that path, etc.) 
-        '''
+        '''Get the image id from image path in the VIM database. Returns the image_id'''
         raise vimconnNotImplemented( "Should have implemented this" )
         
-    def new_vminstance(self,name,description,start,image_id,flavor_id,net_list):
+    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
+        '''
+        raise vimconnNotImplemented( "Should have implemented this" )
+
+    def new_vminstance(self,name,description,start,image_id,flavor_id,net_list,cloud_config=None):
         '''Adds a VM instance to VIM
         Params:
             start: indicates if VM must start or boot in pause mode. Ignored
@@ -283,6 +294,10 @@ class vimconnector():
                 use: 'data', 'bridge',  'mgmt'
                 type: 'virtual', 'PF', 'VF', 'VFnotShared'
                 vim_id: filled/added by this function
+                cloud_config: can be a text script to be passed directly to cloud-init,
+                    or an object to inject users and ssh keys with format:
+                        key-pairs: [] list of keys to install to the default user
+                        users: [{ name, key-pairs: []}] list of users to add with their key-pair 
                 #TODO ip, security groups
         Returns >=0, the instance identifier
                 <0, error_text