Esempio n. 1
0
    def __add_vlink_info(self, topology_tag, ep_src, ep_dst, link_type=None):
        # Virtual link differs w.r.t. a normal link
        # in that those have:
        # 1) ID (slice name and ID for virtual link)
        # 2) End-to-end SDN-SDN or SDN-TN link interfaces
        # 3) (TODO - Ideally) C-SDN link
	logger.debug("add_vlink_info: epsrc=%s, epdst=%s, type=%s" %
		     (ep_src, ep_dst, link_type))
        self.__add_link_info(topology_tag, ep_src, ep_dst, link_type)
        slice_name = MonitoringUtils.find_slice_name(self.__topologies)
        vlink_ids = MonitoringUtils.find_virtual_links(self.__topologies)
        ids_used = []
        max_vl_id = 0
        try:
            link_prefix = ":end_link_"
            for vlink_id in vlink_ids:
                idx = vlink_id.find(link_prefix) + len(link_prefix)
                ids_used.append(int(vlink_id[idx]))
            max_vl_id = max(ids_used)+1
        except:
            pass
        vlink_id = "%s%s%s" % (slice_name, link_prefix, max_vl_id)
        topology_tag.attrib["id"] = vlink_id
Esempio n. 2
0
    def __add_vlink_name(self, vlink_tag, index):
	# the vlink name should be composed of the slicename and a suffix
	slice_name = MonitoringUtils.find_slice_name(self.__topologies)
	vlink_id = "%s%s%s" % (slice_name, ":end_link_", index)
	logger.debug("vlink name: %s" % (vlink_id))
        vlink_tag.attrib["id"] = vlink_id