minor changes
authortierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 5 Sep 2016 10:11:11 +0000 (12:11 +0200)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 5 Sep 2016 10:11:11 +0000 (12:11 +0200)
Change-Id: If54fb9866928b5f8b7c40b5ec3dadd311520641a
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
httpserver.py
nfvo.py
nfvo_db.py
test/test_vimconn.sh

index 9d1f204..83ed06f 100644 (file)
@@ -746,9 +746,9 @@ def http_post_vnfs(tenant_id):
     r = utils.remove_extra_items(http_content, used_schema)
     if r is not None: print "http_post_vnfs: Warning: remove extra items ", r
     try:
-        if http_content.get("schema_version") == None:
+        if used_schema == vnfd_schema_v01:
             vnf_id = nfvo.new_vnf(mydb,tenant_id,http_content)
-        elif http_content.get("schema_version") == "0.2":
+        elif used_schema == vnfd_schema_v02:
             vnf_id = nfvo.new_vnf_v02(mydb,tenant_id,http_content)
         else:
             logger.warning('Unexpected schema_version: %s', http_content.get("schema_version"))
@@ -849,11 +849,11 @@ def http_post_scenarios(tenant_id):
     #if r is not None: print "http_post_scenarios: Warning: remove extra items ", r
     #print "http_post_scenarios input: ",  http_content
     try:
-        if http_content.get("schema_version") == None:
+        if used_schema == nsd_schema_v01:
             scenario_id = nfvo.new_scenario(mydb, tenant_id, http_content)
-        elif str(http_content.get("schema_version")) == "2":
+        elif used_schema == nsd_schema_v02:
             scenario_id = nfvo.new_scenario_v02(mydb, tenant_id, http_content)
-        elif http_content.get("schema_version") == "0.3":
+        elif used_schema == nsd_schema_v03:
             scenario_id = nfvo.new_scenario_v03(mydb, tenant_id, http_content)
         else:
             logger.warning('Unexpected schema_version: %s', http_content.get("schema_version"))
diff --git a/nfvo.py b/nfvo.py
index ce3a07d..98c4bbd 100644 (file)
--- a/nfvo.py
+++ b/nfvo.py
@@ -1629,7 +1629,7 @@ def update(d, u):
 
 def create_instance(mydb, tenant_id, instance_dict):
     #print "Checking that nfvo_tenant_id exists and getting the VIM URI and the VIM tenant_id"
-    logger.debug("Creating instance...")
+    #logger.debug("Creating instance...")
     scenario = instance_dict["scenario"]
     
     #find main datacenter
@@ -1655,7 +1655,7 @@ def create_instance(mydb, tenant_id, instance_dict):
     auxNetDict = {}   #Auxiliar dictionary. First key:'scenario' or sce_vnf uuid. Second Key: uuid of the net/sce_net. Value: vim_net_id
     auxNetDict['scenario'] = {}
     
-    logger.debug("scenario dict: {}".format(yaml.safe_dump(scenarioDict, indent=4, default_flow_style=False)))  #TODO remove 
+    logger.debug("Creating instance from scenario-dict:\n%s", yaml.safe_dump(scenarioDict, indent=4, default_flow_style=False))  #TODO remove 
     instance_name = instance_dict["name"]
     instance_description = instance_dict.get("description")
     try:
@@ -1734,8 +1734,8 @@ def create_instance(mydb, tenant_id, instance_dict):
                                 if interface['vnf_interface'] == vnf_interface['external_name']:
                                     vnf_interface['ip_address']=interface['ip_address']
 
-        logger.debug("Merged dictionary")
-        logger.debug("ScenarioDict:\n{}".format(yaml.safe_dump(scenarioDict,default_flow_style=False, width=256)))
+        #logger.debug("Merged dictionary")
+        logger.debug("Creating instance scenario-dict MERGED:\n%s", yaml.safe_dump(scenarioDict, indent=4, default_flow_style=False))
 
         
     #1. Creating new nets (sce_nets) in the VIM"
index a729aa2..19c45e4 100644 (file)
@@ -32,7 +32,7 @@ import MySQLdb as mdb
 import json
 import yaml
 import time
-import sys, os
+#import sys, os
 
 tables_with_createdat_field=["datacenters","instance_nets","instance_scenarios","instance_vms","instance_vnfs",
                            "interfaces","nets","nfvo_tenants","scenarios","sce_interfaces","sce_nets",
index 7b96d86..aedf20a 100755 (executable)
@@ -287,7 +287,7 @@ then
 
     #Testing IP parameters in networks
     printf "%-50s" "Deploying scenario 'complex4' with IP parameters in networks:"
-    result=`openmano instance-scenario-create --scenario complex4 --name complex4-instance $DIRmano/instance-scenarios/examples/instance-creation-complex4.yaml`
+    result=`openmano instance-scenario-create $DIRmano/instance-scenarios/examples/instance-creation-complex4.yaml "$key_param1" "$key_param2"`
     instance=`echo $result |gawk '{print $1}'`
     ! is_valid_uuid $instance && echo FAIL && echo "    $result" && $_exit 1
     echo $instance