NS instantiate error 17/71917/2
authormaopengzhang <zhang.maopeng1@zte.com.cn>
Tue, 6 Nov 2018 08:40:57 +0000 (16:40 +0800)
committermaopengzhang <zhang.maopeng1@zte.com.cn>
Tue, 6 Nov 2018 12:24:27 +0000 (20:24 +0800)
change nf_type to vnfm_info; change initiationParameters to networkName

Change-Id: I94e74af5ec69a17dfb88d999bb401e23f568bf9e
Issue-ID: VFC-1158
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
lcm/ns/biz/ns_instant.py
lcm/ns_vls/biz/create_vls.py
lcm/ns_vnfs/biz/create_vnfs.py

index d648ed2..1f72b32 100644 (file)
@@ -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)
 
index 06ef78b..3e941d1 100644 (file)
@@ -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),
index 4457333..5dcdb7b 100644 (file)
@@ -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):