def deploy_controller(self, sw, sw_to_ctrl_delays):
sw_to_ctrl_delays[sw] = 0
shortest_paths = nx.shortest_path(self.graph, target=sw, weight='delay')
shortest_path_lengths = nx.shortest_path_length(self.graph, target=sw, weight='delay')
log.info(shortest_paths)
for n in self.graph.nodes():
if n == sw:
continue
if n in shortest_path_lengths.keys():
sw_to_ctrl_delays[n] = shortest_path_lengths[n]
else:
sw_to_ctrl_delays[n] = 1
log.debug("sw to ctrl delays: %s" % str(sw_to_ctrl_delays))
评论列表
文章目录