From: lombardof Date: Thu, 10 May 2018 09:49:32 +0000 (+0200) Subject: vim account creation with additional config param; fix Bug 489 X-Git-Tag: v4.0.0~6 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=1a6af28f66d2686ad53368095c9143279bf54ec3;p=osm%2FLW-UI.git vim account creation with additional config param; fix Bug 489 Change-Id: Ia58e3821acb78f265a25636e216221df34f3f030 Signed-off-by: lombardof --- diff --git a/instancehandler/views.py b/instancehandler/views.py index 86d00d5..534579a 100644 --- a/instancehandler/views.py +++ b/instancehandler/views.py @@ -40,28 +40,29 @@ def create(request, project_id=None): "nsdId": request.POST.get('nsdId', ''), "vimAccountId": request.POST.get('vimAccountId', ''), } - if 'ssh_key' in request.POST: + if 'ssh_key' in request.POST and request.POST.get('ssh_key') != '': ns_data["ssh-authorized-key"] = [request.POST.get('ssh_key')] if 'config' in request.POST: ns_config = yaml.load(request.POST.get('config')) - if "vim-network-name" in ns_config: - ns_config["vld"] = ns_config.pop("vim-network-name") - if "vld" in ns_config: - for vld in ns_config["vld"]: - if vld.get("vim-network-name"): - if isinstance(vld["vim-network-name"], dict): - vim_network_name_dict = {} - for vim_account, vim_net in vld["vim-network-name"].items(): - vim_network_name_dict[ns_data["vimAccountId"]] = vim_net - vld["vim-network-name"] = vim_network_name_dict - ns_data["vld"] = ns_config["vld"] - if "vnf" in ns_config: - for vnf in ns_config["vnf"]: - if vnf.get("vim_account"): - vnf["vimAccountId"] = ns_data["vimAccountId"] - - ns_data["vnf"] = ns_config["vnf"] + if isinstance(ns_config, dict): + if "vim-network-name" in ns_config: + ns_config["vld"] = ns_config.pop("vim-network-name") + if "vld" in ns_config: + for vld in ns_config["vld"]: + if vld.get("vim-network-name"): + if isinstance(vld["vim-network-name"], dict): + vim_network_name_dict = {} + for vim_account, vim_net in vld["vim-network-name"].items(): + vim_network_name_dict[ns_data["vimAccountId"]] = vim_net + vld["vim-network-name"] = vim_network_name_dict + ns_data["vld"] = ns_config["vld"] + if "vnf" in ns_config: + for vnf in ns_config["vnf"]: + if vnf.get("vim_account"): + vnf["vimAccountId"] = ns_data["vimAccountId"] + + ns_data["vnf"] = ns_config["vnf"] print ns_data client = Client() result = client.ns_create(ns_data) diff --git a/vimhandler/template/config/aws.html b/vimhandler/template/config/aws.html index 911e927..5bf7f0a 100644 --- a/vimhandler/template/config/aws.html +++ b/vimhandler/template/config/aws.html @@ -1,76 +1,71 @@ -