public string getExternalPorts(int src, int trg, int connectN, int requieredCapacity) { string rtn = ""; RoutingGraph ownTopology = RoutingGraph.MapTopology(manager.Topology, ConnectionController.VirtualPaths, requieredCapacity); SetupStore ss = new SetupStore(src, trg, ownTopology, connectN, requieredCapacity); int iter = 1; do { if (ss.ownTopology.EdgeCount != 0) { ss = new SetupStore(src, trg, ownTopology, connectN, requieredCapacity); if (this.findBestPath(ss) && this.askLRMs(ss)) //if true -> creating list vcivpi { rtn += getLastLink(ss) + "#"; int size = ss.path.Count; ownTopology.RemoveEdge(ss.path[size - 1]); } else { return(null); } } }while(isExternalLink(ss, trg)); return(rtn); }
private RoutingGraph.Node IDtoNode(int id, RoutingGraph ownTopology) { return(ownTopology.Vertices.ToList().Find(delegate(RoutingGraph.Node no) { return no.Id == id; })); }
public NetworkConnection getPathViaExternalLink(int src, int trg, int connectN, int requieredCapacity, string link) { RoutingGraph ownTopology = RoutingGraph.MapTopology(manager.Topology, ConnectionController.VirtualPaths, requieredCapacity); List <RoutingGraph.Link> toRemove = new List <RoutingGraph.Link>(); string slot = link.Split(':')[1]; foreach (var edge in ownTopology.Edges) { if (edge.tLink.Name != link.Split(':')[0] && edge.tLink.Name.Contains("External")) { toRemove.Add(edge); } } foreach (var rm in toRemove) { ownTopology.RemoveEdge(rm); } SetupStore ss = new SetupStore(src, trg, ownTopology, connectN, requieredCapacity); if (ss.ownTopology.EdgeCount != 0) { if (this.findBestPath(ss) && this.askLRMs(ss, slot)) //if true -> creating list vcivpi { return(this.parseToNetworConnection(ss)); } else { return(null); } } return(null); }
/* * public RoutingGraph(bool allowParallelEdges, int vertexCapacity) * : base(allowParallelEdges, vertexCapacity) { }*/ public static RoutingGraph MapTopology(Topology topology, Dictionary <int, STM> vpaths, int minCapacity) { RoutingGraph graph = new RoutingGraph(); Dictionary <Topology.Node, Node> vertices = new Dictionary <Topology.Node, Node>(); foreach (Topology.Node node in topology.Vertices) { Node n = new Node(node); graph.AddVertex(n); vertices.Add(node, n); } foreach (Topology.Link link in topology.Edges) { if (link.Capacity >= minCapacity) { graph.AddEdge(new Link(vertices[link.Source], vertices[link.Target], link)); } } foreach (STM vpath in vpaths.Values) { if (vpath.Capacity >= minCapacity) { graph.AddEdge(new Link(vertices[vpath.Source], vertices[vpath.Target], vpath)); } } return(graph); }
public SetupStore(int source, int target, RoutingGraph ownTopology, int connectN, int requieredCapacity) { this.source = source; this.target = target; this.ownTopology = ownTopology; this.connectN = connectN; path = new List <RoutingGraph.Link>(); vcivpiList = new List <string>(); this.requieredCapacity = requieredCapacity; }
public NetworkConnection assignRoute(int src, int trg, int connectN, int requieredCapacity) { RoutingGraph ownTopology = RoutingGraph.MapTopology(manager.Topology, ConnectionController.VirtualPaths, requieredCapacity); SetupStore ss = new SetupStore(src, trg, ownTopology, connectN, requieredCapacity); if (ss.ownTopology.EdgeCount != 0) { if (this.findBestPath(ss) && this.askLRMs(ss)) //if true -> creating list vcivpi { return(this.parseToNetworConnection(ss)); } else { return(null); } } return(null); }