Пример #1
0
 def merge_paths(self, used_paths):
     # TODO: Need to rethink if apps have min. bandwidth requirement
     for paths in used_paths:
         path = paths[1]
         for i in range(len(path) - 1):
             l = self.links[Link.get_id(path[i], path[i + 1])]
             l.set_bandwidth(l.get_bandwidth() - self.bandwidth / 10)
Пример #2
0
 def merge_paths(self, used_paths):
     # TODO: Need to rethink if apps have min. bandwidth requirement
     for paths in used_paths:
         path = paths[1]
         for i in range(len(path) - 1):
             l = self.links[Link.get_id(path[i], path[i + 1])]
             l.set_bandwidth(l.get_bandwidth() - self.bandwidth / 10)
Пример #3
0
    def get_link(self, node1, node2):
        ret = None
        link_id = Link.get_id(node1.get_id(), node2.get_id())

        if link_id in self.links:
            ret = self.links[link_id]

        return ret
Пример #4
0
    def get_link(self, node1, node2):
        ret = None
        link_id = Link.get_id(node1.get_id(), node2.get_id())

        if link_id in self.links:
            ret = self.links[link_id]

        return ret
Пример #5
0
    def set_flow(self, chosen_paths):
        self.flows = {}
        # print "chosen_paths: ", chosen_paths

        # Create Flow Objects
        for cp in self.comm_pattern:
            fl = Flow(cp[0], cp[1], cp[2])
            self.flows[fl.get_end_points()] = fl

        for p in chosen_paths:
            path = p[1]

            link_list = []
            for i in range(len(path)-1):
                l = self.links[Link.get_id(path[i], path[i+1])]
                link_list.append(l)

            fl = self.flows[Flow.get_id(path[0], path[-1])]
            fl.set_path(link_list)

        for link in self.get_links().values():
            link.adjust_flow_bandwidths()
Пример #6
0
    def set_flow(self, chosen_paths):
        self.flows = {}
        # print "chosen_paths: ", chosen_paths

        # Create Flow Objects
        for cp in self.comm_pattern:
            fl = Flow(cp[0], cp[1], cp[2])
            self.flows[fl.get_end_points()] = fl

        for p in chosen_paths:
            path = p[1]

            link_list = []
            for i in range(len(path) - 1):
                l = self.links[Link.get_id(path[i], path[i + 1])]
                link_list.append(l)

            fl = self.flows[Flow.get_id(path[0], path[-1])]
            fl.set_path(link_list)

        for link in self.get_links().values():
            link.adjust_flow_bandwidths()