From bd7b4ec216bb02acb57bb7b2040807bde20c869d Mon Sep 17 00:00:00 2001 From: maopengzhang Date: Tue, 6 Nov 2018 16:40:57 +0800 Subject: NS instantiate error change nf_type to vnfm_info; change initiationParameters to networkName Change-Id: I94e74af5ec69a17dfb88d999bb401e23f568bf9e Issue-ID: VFC-1158 Signed-off-by: maopengzhang --- lcm/ns/biz/ns_instant.py | 10 ++++++++-- lcm/ns_vls/biz/create_vls.py | 4 ++-- lcm/ns_vnfs/biz/create_vnfs.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lcm/ns/biz/ns_instant.py b/lcm/ns/biz/ns_instant.py index d648ed26..1f72b329 100644 --- a/lcm/ns/biz/ns_instant.py +++ b/lcm/ns/biz/ns_instant.py @@ -68,7 +68,7 @@ class InstantNSService(object): vim_id = self.req_data['additionalParamForNs']['location'] params_json = json.JSONEncoder().encode(self.req_data["additionalParamForNs"]) else: - params_json = {} + params_json = json.JSONEncoder().encode({}) location_constraints = [] if 'locationConstraints' in self.req_data: @@ -84,7 +84,13 @@ class InstantNSService(object): plan_dict = json.JSONDecoder().decode(dst_plan) for vnf in ignore_case_get(plan_dict, "vnfs"): vnfd_id = vnf['properties']['id'] - vnfm_type = vnf['properties'].get("nf_type", "undefined") + vnfm_type_temp = vnf['properties'].get("vnfm_info", "undefined") + logger.debug("vnfd_id: %s, vnfm_type : %s", vnfd_id, vnfm_type_temp) + if vnfm_type_temp != "undefined": + if isinstance(vnfm_type_temp, list): + vnfm_type = vnfm_type_temp[0] + if isinstance(vnfm_type_temp, str): + vnfm_type = vnfm_type_temp vimid = self.get_vnf_vim_id(vim_id, location_constraints, vnfd_id) vnfm_info = extsys.select_vnfm(vnfm_type=vnfm_type, vim_id=vimid) diff --git a/lcm/ns_vls/biz/create_vls.py b/lcm/ns_vls/biz/create_vls.py index 06ef78b4..3e941d1b 100644 --- a/lcm/ns_vls/biz/create_vls.py +++ b/lcm/ns_vls/biz/create_vls.py @@ -102,7 +102,7 @@ class CreateVls(object): "mtu": self.vl_profile.get("mtu", const.DEFAULT_MTU), "vlan_transparent": self.vl_profile.get("vlanTransparent", False), "subnet_list": [{ - "subnet_name": self.vl_profile.get("initiationParameters").get("name", ""), + "subnet_name": self.vl_profile.get("networkName"), # self.vl_profile.get("initiationParameters").get("name", ""), "cidr": self.vl_profile.get("cidr", "192.168.0.0/24"), "ip_version": self.vl_profile.get("ip_version", const.IPV4), "enable_dhcp": self.vl_profile.get("dhcpEnabled", False), @@ -159,7 +159,7 @@ class CreateVls(object): "resourceProviderType": "", "resourceProviderId": "", "subnet_list": [{ - "subnet_name": self.vl_profile.get("initiationParameters").get("name", ""), + "subnet_name": self.vl_profile.get("networkName", ""), # self.vl_profile.get("initiationParameters").get("name", ""), "cidr": self.vl_profile.get("cidr", "192.168.0.0/24"), "ip_version": self.vl_profile.get("ip_version", const.IPV4), "enable_dhcp": self.vl_profile.get("dhcpEnabled", False), diff --git a/lcm/ns_vnfs/biz/create_vnfs.py b/lcm/ns_vnfs/biz/create_vnfs.py index 44573335..5dcdb7b3 100644 --- a/lcm/ns_vnfs/biz/create_vnfs.py +++ b/lcm/ns_vnfs/biz/create_vnfs.py @@ -180,7 +180,7 @@ class CreateVnfs(Thread): def get_network_info_of_vl(self, vl_id): for vnf_info in self.nsd_model['vls']: if vnf_info['vl_id'] == vl_id: - return vnf_info['properties']['vl_profile']['networkName'], vnf_info['properties']['vl_profile']['initiationParameters']['name'] + return vnf_info['properties']['vl_profile']['networkName'], vnf_info['properties']['vl_profile']['networkName'] # ['initiationParameters']['name'] return '', '' def send_nf_init_request_to_vnfm(self): -- cgit 1.2.3-korg