def create_or_use_flavor(mydb, vims, flavor_dict, rollback_list, only_create_at_vim=False, return_on_error = None):
- temp_flavor_dict= {'disk':flavor_dict.get('disk',1),
+ temp_flavor_dict= {'disk':flavor_dict.get('disk',0),
'ram':flavor_dict.get('ram'),
'vcpus':flavor_dict.get('vcpus'),
}
if cp.get("id-ref") == iface.get("internal-connection-point-ref"):
db_interface["net_id"] = net_id2uuid[vld.get("id")]
for cp_descriptor in vnfd_descriptor["connection-point"]:
- if cp_descriptor["name"] == db_interface["external_name"]:
+ if cp_descriptor["name"] == db_interface["internal_name"]:
break
if str(cp_descriptor.get("port-security-enabled")).lower() == "false":
db_interface["port_security"] = 0
break
except KeyError:
raise NfvoException("Error. Invalid VNF descriptor at 'vnfd[{vnf}]':'vdu[{vdu}]':"
- "'interface[{iface}]':'vdu-internal-connection-point-ref':'{cp}' is not"
+ "'interface[{iface}]':'internal-connection-point-ref':'{cp}' is not"
" referenced by any internal-vld".format(
vnf=vnfd_id, vdu=vdu_id, iface=iface["name"],
- cp=iface.get("vdu-internal-connection-point-ref")),
+ cp=iface.get("internal-connection-point-ref")),
HTTP_Bad_Request)
if iface.get("position") is not None:
db_interface["created_at"] = int(iface.get("position")) - 1000
"name": get_str(vdu, "name", 250) + "-flv",
"vcpus": int(vdu["vm-flavor"].get("vcpu-count", 1)),
"ram": int(vdu["vm-flavor"].get("memory-mb", 1)),
- "disk": int(vdu["vm-flavor"].get("storage-gb", 1)),
+ "disk": int(vdu["vm-flavor"].get("storage-gb", 0)),
}
# TODO revise the case of several numa-node-policy node
extended = {}
extended_text = yaml.safe_dump(extended, default_flow_style=True, width=256)
db_flavor["extended"] = extended_text
# look if flavor exist
- temp_flavor_dict = {'disk': db_flavor.get('disk', 1),
+ temp_flavor_dict = {'disk': db_flavor.get('disk', 0),
'ram': db_flavor.get('ram'),
'vcpus': db_flavor.get('vcpus'),
'extended': db_flavor.get('extended')
myflavorDict["description"] = VNFCitem["description"]
myflavorDict["ram"] = vnfc.get("ram", 0)
myflavorDict["vcpus"] = vnfc.get("vcpus", 0)
- myflavorDict["disk"] = vnfc.get("disk", 1)
+ myflavorDict["disk"] = vnfc.get("disk", 0)
myflavorDict["extended"] = {}
devices = vnfc.get("devices")
myflavorDict["description"] = VNFCitem["description"]
myflavorDict["ram"] = vnfc.get("ram", 0)
myflavorDict["vcpus"] = vnfc.get("vcpus", 0)
- myflavorDict["disk"] = vnfc.get("disk", 1)
+ myflavorDict["disk"] = vnfc.get("disk", 0)
myflavorDict["extended"] = {}
devices = vnfc.get("devices")
#If the datacenter has a SDN controller defined and the network is of dataplane type, then create the sdn network
if get_sdn_controller_id(mydb, datacenter) != None and (net_type == 'data' or net_type == 'ptp'):
+ #obtain datacenter_tenant_id
+ datacenter_tenant_id = mydb.get_rows(SELECT=('uuid',),
+ FROM='datacenter_tenants',
+ WHERE={'datacenter_id': datacenter})[0]['uuid']
try:
sdn_network = {}
sdn_network['vlan'] = net_vlan
sdn_network['type'] = net_type
sdn_network['name'] = net_name
+ sdn_network['region'] = datacenter_tenant_id
ovim_content = ovim.new_network(sdn_network)
except ovimException as e:
- self.logger.error("ovimException creating SDN network={} ".format(
+ logger.error("ovimException creating SDN network={} ".format(
sdn_network) + str(e), exc_info=True)
raise NfvoException("ovimException creating SDN network={} ".format(sdn_network) + str(e),
HTTP_Internal_Server_Error)
# Save entry in in dabase mano_db in table instance_nets to stablish a dictionary vim_net_id <->sdn_net_id
# use instance_scenario_id=None to distinguish from real instaces of nets
- correspondence = {'instance_scenario_id': None, 'sdn_net_id': ovim_content, 'vim_net_id': content}
- #obtain datacenter_tenant_id
- correspondence['datacenter_tenant_id'] = mydb.get_rows(SELECT=('uuid',), FROM='datacenter_tenants', WHERE={'datacenter_id': datacenter})[0]['uuid']
-
+ correspondence = {'instance_scenario_id': None,
+ 'sdn_net_id': ovim_content,
+ 'vim_net_id': content,
+ 'datacenter_tenant_id': datacenter_tenant_id
+ }
try:
mydb.new_row('instance_nets', correspondence, add_uuid=True)
except db_base_Exception as e:
- raise NfvoException("Error saving correspondence for VIM/SDN dataplane networks{}: ".format(correspondence) +
- str(e), HTTP_Internal_Server_Error)
+ raise NfvoException("Error saving correspondence for VIM/SDN dataplane networks{}: {}".format(
+ correspondence, e), HTTP_Internal_Server_Error)
elif item=="tenants":
tenant = descriptor["tenant"]
content = myvim.new_tenant(tenant["name"], tenant.get("description"))