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"))
#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"))
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
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:
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"
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",
#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