new option for avoid reaching VIMS at new VNF

Change-Id: Ib27ca4c14a59b391cb73994055a51ab80713e6b5
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/nfvo.py b/nfvo.py
index ba670c7..84aec64 100644
--- a/nfvo.py
+++ b/nfvo.py
@@ -547,6 +547,7 @@
     # Step 1. Check the VNF descriptor
     check_vnf_descriptor(vnf_descriptor, vnf_descriptor_version=1)
     # Step 2. Check tenant exist
+    vims = {}
     if tenant_id != "any":
         check_tenant(mydb, tenant_id) 
         if "tenant_id" in vnf_descriptor["vnf"]:
@@ -556,9 +557,8 @@
         else:
             vnf_descriptor['vnf']['tenant_id'] = tenant_id
         # Step 3. Get the URL of the VIM from the nfvo_tenant and the datacenter
-        vims = get_vim(mydb, tenant_id)
-    else:
-        vims={}
+        if global_config["auto_push_VNF_to_VIMs"]:
+            vims = get_vim(mydb, tenant_id)
 
     # Step 4. Review the descriptor and add missing  fields
     #print vnf_descriptor
@@ -681,6 +681,7 @@
     # Step 1. Check the VNF descriptor
     check_vnf_descriptor(vnf_descriptor, vnf_descriptor_version=2)
     # Step 2. Check tenant exist
+    vims = {}
     if tenant_id != "any":
         check_tenant(mydb, tenant_id) 
         if "tenant_id" in vnf_descriptor["vnf"]:
@@ -690,9 +691,8 @@
         else:
             vnf_descriptor['vnf']['tenant_id'] = tenant_id
         # Step 3. Get the URL of the VIM from the nfvo_tenant and the datacenter
-        vims = get_vim(mydb, tenant_id)
-    else:
-        vims={}
+        if global_config["auto_push_VNF_to_VIMs"]:
+            vims = get_vim(mydb, tenant_id)
 
     # Step 4. Review the descriptor and add missing  fields
     #print vnf_descriptor
diff --git a/openmano_schemas.py b/openmano_schemas.py
index 7404022..1ea64f6 100644
--- a/openmano_schemas.py
+++ b/openmano_schemas.py
@@ -80,6 +80,7 @@
         "http_port": port_schema,
         "http_admin_port": port_schema,
         "http_host": nameshort_schema,
+        "auto_push_VNF_to_VIMs": {"type":"boolean"},
         "vnf_repository": path_schema,
         "db_host": nameshort_schema,
         "db_user": nameshort_schema,
diff --git a/openmanod.cfg b/openmanod.cfg
index 76e93d5..ebcee2b 100644
--- a/openmanod.cfg
+++ b/openmanod.cfg
@@ -48,8 +48,11 @@
 #other MANO parameters
 #  Folder where the VNF descriptors will be stored
 #  The folder will be created in the execution folder if it does not exist
-#vnf_repository: "./vnfrepo"   # Use an absolute path to avoid misunderstandings 
+#vnf_repository: "./vnfrepo"  # Use an absolute path to avoid misunderstandings
 
+#   Indicates if at VNF onboarding, flavors and images are loaded at all related VIMs,
+#   in order to speed up the later instantiation.
+auto_push_VNF_to_VIMs: False  # by default True
 
 #general logging parameters 
    #choose among: DEBUG, INFO, WARNING, ERROR, CRITICAL
diff --git a/openmanod.py b/openmanod.py
index 2eddb20..5ec3650 100755
--- a/openmanod.py
+++ b/openmanod.py
@@ -33,7 +33,7 @@
 '''
 __author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes"
 __date__ ="$26-aug-2014 11:09:29$"
-__version__="0.5.7-r517"
+__version__="0.5.8-r518"
 version_date="Jan 2017"
 database_version="0.19"      #expected database schema version
 
@@ -64,6 +64,7 @@
                      'http_console_host': None,
                      'log_level': 'DEBUG',
                      'log_socket_port': 9022,
+                     'auto_push_VNF_to_VIMs': True
                     }
     try:
         #Check config file exists