mydb.delete_row(FROM="datacenters_images", WHERE={"datacenter_vim_id": vim["id"], "vim_id":item["uuid"]})
elif item["what"]=="flavor":
vim.delete_flavor(item["uuid"])
- mydb.delete_row(FROM="datacenters_flavors", WHERE={"datacenter_id": vim["id"], "vim_id":item["uuid"]})
+ mydb.delete_row(FROM="datacenters_flavors", WHERE={"datacenter_vim_id": vim["id"], "vim_id":item["uuid"]})
elif item["what"]=="network":
vim.delete_network(item["uuid"])
elif item["what"]=="vm":
try:
myvnfd = vnfd_catalog.vnfd()
try:
- pybindJSONDecoder.load_ietf_json(vnf_descriptor, None, None, obj=myvnfd)
+ pybindJSONDecoder.load_ietf_json(vnf_descriptor, None, None, obj=myvnfd, path_helper=True)
except Exception as e:
raise NfvoException("Error. Invalid VNF descriptor format " + str(e), HTTP_Bad_Request)
db_vnfs = []
# 0.1 parse cloud-config parameters
cloud_config = unify_cloud_config(instance_dict.get("cloud-config"), scenarioDict.get("cloud-config"))
- # We add the RO key to cloud_config
- if tenant[0].get('RO_pub_key'):
- RO_key = {"key-pairs": [tenant[0]['RO_pub_key']]}
- cloud_config = unify_cloud_config(cloud_config, RO_key)
# 0.2 merge instance information into scenario
# Ideally, the operation should be as simple as: update(scenarioDict,instance_dict)
# myvim.new_vminstance(self,vimURI,tenant_id,name,description,image_id,flavor_id,net_dict)
sce_vnf_list = sorted(scenarioDict['vnfs'], key=lambda k: k['name'])
for sce_vnf in sce_vnf_list:
+ ssh_access = None
+ if sce_vnf.get('mgmt_access'):
+ ssh_access = sce_vnf['mgmt_access'].get('config-access', {}).get('ssh-access')
vnf_availability_zones = []
for vm in sce_vnf['vms']:
vm_av = vm.get('availability_zone')
# print "networks", yaml.safe_dump(myVMDict['networks'], indent=4, default_flow_style=False)
# print "interfaces", yaml.safe_dump(vm['interfaces'], indent=4, default_flow_style=False)
# print ">>>>>>>>>>>>>>>>>>>>>>>>>>>"
+
+ # We add the RO key to cloud_config if vnf will need ssh access
+ cloud_config_vm = cloud_config
+ if ssh_access and ssh_access['required'] and ssh_access['default-user'] and tenant[0].get('RO_pub_key'):
+ RO_key = {"key-pairs": [tenant[0]['RO_pub_key']]}
+ cloud_config_vm = unify_cloud_config(cloud_config_vm, RO_key)
if vm.get("boot_data"):
- cloud_config_vm = unify_cloud_config(vm["boot_data"], cloud_config)
- else:
- cloud_config_vm = cloud_config
+ cloud_config_vm = unify_cloud_config(vm["boot_data"], cloud_config_vm)
+
if myVMDict.get('availability_zone'):
av_index = vnf_availability_zones.index(myVMDict['availability_zone'])
else:
except (IOError, ImportError):
# if module_info and module_info[0]:
# file.close(module_info[0])
- raise NfvoException("Incorrect datacenter type '{}'. Plugin '{}'.py not installed".format(datacenter_type, module), HTTP_Bad_Request)
+ raise NfvoException("Incorrect datacenter type '{}'. Plugin '{}.py' not installed".format(datacenter_type, module), HTTP_Bad_Request)
datacenter_id = mydb.new_row("datacenters", datacenter_descriptor, add_uuid=True, confidential_data=True)
return datacenter_id