+ self._vld = {}
+ self._ip_profile = {}
+
+ def handle_vld_properties(self, nodes, vnf_type_substitution_mapping):
+ def get_vld_props(specs):
+ vld_prop = {}
+ vld_prop['id'] = self.id
+ vld_prop['name'] = self.name
+ vld_prop['short-name'] = self.name
+ vld_prop['type'] = self.get_type()
+ vld_prop['ip_profile_ref'] = "{0}_{1}".format(self.nodetemplate.name, "ip")
+ if 'description' in specs:
+ vld_prop['description'] = specs['description']
+ if 'vendor' in specs:
+ vld_prop['vendor'] = specs['vendor']
+
+ index_count = 1
+ vld_connection_point_list = []
+ for node in nodes:
+ if node.type == "vnfd":
+ substitution_mapping_list = vnf_type_substitution_mapping[node.vnf_type];
+ for req_key, req_value in node._reqs.items():
+ for mapping in substitution_mapping_list:
+ if req_key in mapping:
+ # link the VLD to the connection point
+ node_vld = self.get_node_with_name(mapping[req_key][0], nodes)
+ if node:
+ #print()
+ prop = {}
+ prop['member-vnf-index-ref'] = node.get_member_vnf_index()
+ prop['vnfd-connection-point-ref'] = node_vld.cp_name
+ prop['vnfd-id-ref'] = node_vld.vnf._id
+ vld_connection_point_list.append(prop)
+ index_count += 1
+ if len(vld_connection_point_list) > 1:
+ vld_prop['vnfd-connection-point-ref'] = vld_connection_point_list
+ return vld_prop
+
+ def get_ip_profile_props(specs):
+ ip_profile_prop = {}
+ ip_profile_param = {}
+ if 'ip_profile_ref' in self._vld:
+ ip_profile_prop['name'] = self._vld['ip_profile_ref']
+
+ if 'description' in specs:
+ ip_profile_prop['description'] = specs['description']
+ if 'gateway_ip' in specs:
+ ip_profile_param['gateway-address'] = specs['gateway_ip']
+ if 'ip_version' in specs:
+ ip_profile_param['ip-version'] = 'ipv' + str(specs['ip_version'])
+ if 'ip_version' in specs:
+ ip_profile_param['subnet-address'] = specs['cidr']
+
+ ip_profile_prop['ip-profile-params'] = ip_profile_param
+ return ip_profile_prop