X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=common%2Fpython%2Frift%2Fmano%2Ftosca_translator%2Frwmano%2Ftosca%2Ftosca_forwarding_path.py;h=12b7062bb0a01bbc9f100d5bbbbe5e67e1537890;hb=a94a81cc5320aee3cbe05bbdbf3b6f0b244fb19f;hp=4e39236323c7ab783b8123dd3aed2994692321eb;hpb=d04550842ce8c7eeac9cb6234ba5a931d14d42ba;p=osm%2FSO.git diff --git a/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_forwarding_path.py b/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_forwarding_path.py index 4e392363..12b7062b 100644 --- a/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_forwarding_path.py +++ b/common/python/rift/mano/tosca_translator/rwmano/tosca/tosca_forwarding_path.py @@ -18,6 +18,7 @@ class ToscaForwardingPath(ManoResource): self.properties = {} def handle_forwarding_path_dependencies(self, nodes, vnf_type_to_capability_substitution_mapping): + def get_classifier(specs): classifier_prop = {} classifier_prop['name'] = 'VNFFG -' + str(self.name) @@ -60,23 +61,27 @@ class ToscaForwardingPath(ManoResource): fp_connection_point = [] vnf_index = 1 order_index = 1 + visited_cps = [] for rsp_item in specs['path']: vnf_node_name = rsp_item['forwarder'] conn_forwarder = rsp_item['capability'] - vnf_node = self.get_node_with_name(vnf_node_name, nodes) + vnf_node = self.get_node_with_name(vnf_node_name, nodes) + for subs_mapping in vnf_type_to_capability_substitution_mapping[vnf_node.vnf_type]: prop = {} if conn_forwarder in subs_mapping: fp_connection_point.append(subs_mapping[conn_forwarder]) cp_node_name = subs_mapping[conn_forwarder] cp_node = self.get_node_with_name(cp_node_name, nodes) - prop['vnfd_connection_point_ref'] = cp_node.cp_name - prop['vnfd_id_ref'] = vnf_node.id - prop['member_vnf_index_ref'] = vnf_index - prop['order'] = order_index - rsp['vnfd_connection_point_ref'].append(prop) - vnf_index = vnf_index + 1 - order_index = order_index + 1 + if cp_node.cp_name not in visited_cps: + prop['vnfd_connection_point_ref'] = cp_node.cp_name + prop['vnfd_id_ref'] = vnf_node.id + prop['member_vnf_index_ref'] = vnf_node.get_member_vnf_index() + prop['order'] = order_index + rsp['vnfd_connection_point_ref'].append(prop) + vnf_index = vnf_index + 1 + order_index = order_index + 1 + visited_cps.append(cp_node.cp_name) return rsp tosca_props = self.get_tosca_props()