/** Returns the service chain request that this service chain is realizing * @return see above */ public WServiceChainRequest getServiceChainRequest () { return new WServiceChainRequest(r.getDemand()); }
/** Returns the associated lightpath request * @return see above */ public WLightpathRequest getLightpathRequest () { return new WLightpathRequest(r.getDemand()); }
SortedSet<Link> getIntraLayerUpPropagationIncludingMe () { final SortedSet<Link> res = new TreeSet<> (); res.add(this); for (Demand d : Sets.union(this.cacheHbH_frs.keySet() , cache_traversingRoutes.keySet().stream().map(r->r.getDemand()).collect(Collectors.toSet()))) if (d.isCoupledInSameLayer()) { final Link upCoupledLink = d.getCoupledLink(); if (!res.contains(upCoupledLink)) { final SortedSet<Link> upperLinks = upCoupledLink.getIntraLayerUpPropagationIncludingMe(); res.addAll(upperLinks); } } return res; }
/** Returns the set of lightpaths that traverse this fiber * @return see above */ public SortedSet<WLightpathRequest> getTraversingLpRequestsInAtLeastOneLp () { return e.getTraversingRoutes().stream().map(r->new WLightpathRequest(r.getDemand())).collect(Collectors.toCollection(TreeSet::new)); }
private TBFToFromCarriedTraffic(Route route, boolean onlyThisLayer) { super(route.getNetPlan()); this.initialElement = route; this.onlyThisLayer = onlyThisLayer; this.initialFR = null; this.auxLayerInNodes = null; final Set<Link> linksAllLayers = new HashSet<>(); final Set<Demand> demandsAllLayers = new HashSet<>(); final Set<MulticastDemand> mDemandsAllLayers = new HashSet<>(); demandsAllLayers.add(route.getDemand()); linksAllLayers.addAll(route.getSeqLinks()); if (!onlyThisLayer) updatePropagationDownWards(linksAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); if (!onlyThisLayer) updatePropagationUpWards(demandsAllLayers, mDemandsAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); final Set<NetworkLayer> layersToKeepAllElements = onlyThisLayer ? Sets.difference(new HashSet<>(netPlan.getNetworkLayers()), Sets.newHashSet(route.getLayer())) : new HashSet<>(); updateAllButLinksDemandsMDemandsUsingExistingInfo(linksAllLayers, demandsAllLayers, mDemandsAllLayers, layersToKeepAllElements); }
/** Gets the links in same layer that (1) are intra coupled, (2) its traffic flows down to me [I may be coupled or not] * * @return List of links */ SortedSet<Link> getSameLayerCoupledLinksHierarchicallyLowerCouldPutTrafficHere () { final SortedSet<Link> res = new TreeSet<> (); for (Route r : cache_traversingRoutes.keySet()) if (r.getDemand().isCoupledInSameLayer()) { res.add(r.getDemand().getCoupledLink()); res.addAll(r.getDemand().getCoupledLink().getSameLayerCoupledLinksHierarchicallyUpperCouldPutTrafficHere()); } for (Demand d : this.getDemandsWithNonZeroForwardingRules()) if (d.isCoupledInSameLayer()) { res.add(d.getCoupledLink()); res.addAll(d.getCoupledLink().getSameLayerCoupledLinksHierarchicallyUpperCouldPutTrafficHere()); } return res; }
/** Gets the links in same layer that (1) are intra coupled, (2) its traffic flows down to me [I may be coupled or not] * * @return List of links */ SortedSet<Link> getSameLayerCoupledLinksHierarchicallyUpperCouldPutTrafficHere () { final SortedSet<Link> res = new TreeSet<> (); for (Route r : cache_traversingRoutes.keySet()) if (r.getDemand().isCoupledInSameLayer()) { res.add(r.getDemand().getCoupledLink()); res.addAll(r.getDemand().getCoupledLink().getSameLayerCoupledLinksHierarchicallyUpperCouldPutTrafficHere()); } for (Demand d : this.getDemandsWithNonZeroForwardingRules()) if (d.isCoupledInSameLayer()) { res.add(d.getCoupledLink()); res.addAll(d.getCoupledLink().getSameLayerCoupledLinksHierarchicallyUpperCouldPutTrafficHere()); } return res; }
public double getOccupiedCapacityFromDemand (Demand d) { if (d.isSourceRouting()) { double res = 0; for (Route travRoute : cache_traversingRoutes.keySet()) if (travRoute.getDemand().equals(d)) res += travRoute.getOccupiedCapacity(this); return res; } else { final Pair<Double,Double> normalizedRespectoToDemandCarriedAndCarried = cacheHbH_normCarriedOccupiedPerTraversingDemandCurrentState.get(d); if (normalizedRespectoToDemandCarriedAndCarried == null) return 0; return normalizedRespectoToDemandCarriedAndCarried.getSecond(); } }
private TBFToFromCarriedTraffic(Resource resource, NetworkLayer layer, boolean onlyThisLayer) { super(resource.getNetPlan()); this.initialElement = resource; this.onlyThisLayer = onlyThisLayer; this.initialFR = null; this.auxLayerInNodes = layer; final Set<Link> linksAllLayers = new HashSet<>(); final Set<Demand> demandsAllLayers = new HashSet<>(); final Set<MulticastDemand> mDemandsAllLayers = new HashSet<>(); // if the resource is not used => does not appear anywhere for (Route r : resource.getTraversingRoutes()) { if (r.getLayer() != layer) continue; linksAllLayers.addAll(r.getSeqLinks()); demandsAllLayers.add(r.getDemand()); } if (!onlyThisLayer) updatePropagationDownWards(linksAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); if (!onlyThisLayer) updatePropagationUpWards(demandsAllLayers, mDemandsAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); final Set<NetworkLayer> layersToKeepAllElements = onlyThisLayer ? Sets.difference(new HashSet<>(netPlan.getNetworkLayers()), Sets.newHashSet(layer)) : new HashSet<>(); updateAllButLinksDemandsMDemandsUsingExistingInfo(linksAllLayers, demandsAllLayers, mDemandsAllLayers, layersToKeepAllElements); if (!this.vResources.get(layer).contains(resource)) this.vResources.get(layer).add(resource); // add the resource if not there }
SortedSet<Link> linksSoFar = resBackup.get(r.getDemand()); if (linksSoFar == null) { linksSoFar = new TreeSet<> (); resBackup.put(r.getDemand(), linksSoFar); } linksSoFar.add(e); SortedSet<Link> linksSoFar = resPrimary.get(r.getDemand()); if (linksSoFar == null) { linksSoFar = new TreeSet<> (); resPrimary.put(r.getDemand(), linksSoFar); } linksSoFar.add(e);
final Demand d = route.getDemand(); SortedMap<Link,Double> xdeMapThisDemand = xdeMap.get(d); if (xdeMapThisDemand == null) { xdeMapThisDemand = new TreeMap<> (); xdeMap.put(d, xdeMapThisDemand); }
if (demands.contains(r.getDemand()))
private List<Triple<String,String,String>> getRouteInfoTables (Route r) { final DecimalFormat df = new DecimalFormat("###.##"); final NetPlan np = r.getNetPlan(); final List<Triple<String,String,String>> res = new ArrayList <> (); res.add(Triple.of("Route index/id" , "Route " + r.getIndex() + " (id " + r.getId() + ")", "route" + r.getId())); res.add(Triple.of("Layer" , "" + getLayerName(r.getLayer()) , "layer" + r.getLayer().getId())); res.add(Triple.of("Route demand index/id" , "" + r.getDemand().getIndex() + " (id " + r.getDemand().getId() + ")" , "demand" + r.getDemand().getId())); res.add(Triple.of("Demand offered traffic" , "" + df.format(r.getDemand().getOfferedTraffic()) + " " + np.getDemandTrafficUnitsName(r.getLayer()) , "")); res.add(Triple.of("Demand carried traffic" , "" + df.format(r.getDemand().getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(r.getLayer()) , "")); res.add(Triple.of("Route carried traffic" , "" + df.format(r.getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(r.getLayer()), "")); res.add(Triple.of("Is up?" , "" + np.isUp(r.getPath()), "")); res.add(Triple.of("Worst link utilization" , "" + df.format(r.getSeqLinks().stream().mapToDouble(e->e.getUtilization()).max().orElse(0)), "")); if (r.isServiceChain()) res.add(Triple.of("Worst resource utilization" , "" + df.format(r.getSeqResourcesTraversed().stream().mapToDouble(e->e.getUtilization()).max().orElse(0)), "")); res.add(Triple.of("Is service chain?" , "" + r.getDemand().isServiceChainRequest(), "")); res.add(Triple.of("Route length (km)" , "" + df.format(r.getLengthInKm()) + " km", "")); res.add(Triple.of("Route length (ms)" , "" + df.format(r.getPropagationDelayInMiliseconds()) + " ms", "")); res.add(Triple.of("Is backup route?" , "" + r.isBackupRoute(), "")); for (Route pr : r.getRoutesIAmBackup()) res.add(Triple.of("-- Primary route" , "Route " + pr.getIndex() , "route" + pr.getId())); res.add(Triple.of("Has backup routes?" , "" + r.hasBackupRoutes(), "")); for (Route br : r.getBackupRoutes()) res.add(Triple.of("-- Backup route" , "Route " + br.getIndex() , "route" + br.getId())); return res; } private List<Triple<String,String,String>> getMulticastTreeInfoTables (MulticastTree t)
@Override public List<AjtColumnInfo<Route>> getNonBasicUserDefinedColumnsVisibleOrNot() { final NetPlan np = callback.getDesign(); final NetworkLayer layer = this.getTableNetworkLayer(); final List<AjtColumnInfo<Route>> res = new LinkedList<> (); res.add(new AjtColumnInfo<Route>(this , Demand.class, null , "Demand", "Associated demand", null , d->d.getDemand() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Node.class, null , "A", "Ingress node", null , d->d.getIngressNode() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Node.class, null , "B", "Egress node", null , d->d.getEgressNode() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Boolean.class, null , "Is up?", "The route is considered up if it is not traversing failed links or nodes", null , d->!d.isDown() , AGTYPE.COUNTTRUE, r->r.getCarriedTrafficInNoFailureState() > 0 && r.isDown()? Color.RED : null)); res.add(new AjtColumnInfo<Route>(this , Boolean.class, null , "Trav. 0-cap links?", "Indicates if the route is traversing links with zero capacity", null , d->!d.isTraversingZeroCapLinks() , AGTYPE.COUNTTRUE, r->r.getCarriedTrafficInNoFailureState() > 0 && r.isTraversingZeroCapLinks()? Color.RED : null)); res.add(new AjtColumnInfo<Route>(this , Demand.class, null , "Bidirectional pair", "If the route is bidirectional, provides its bidirectional pair", null , d->d.getBidirectionalPair() , AGTYPE.NOAGGREGATION, null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "Main routes", "If this is a backup route, shows the routes I am backing up", null , d->d.getRoutesIAmBackup(), AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "Backup routes", "If this is a main route, shows the its back up routes", null , d->d.getBackupRoutes(), AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "Carried traffic (" + layer.getDemandTrafficUnits() + ")", "Carried traffic by the route", (d,val)->d.setCarriedTraffic((Double) val , null), d->d.getCarriedTraffic() , AGTYPE.SUMDOUBLE , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "Occupied capacity (" + layer.getLinkCapacityUnits() + ")", "Occupied capacity in the traversed links. If the occupied capacity is different in different links, no information is shown", null , d->d.isOccupyingDifferentCapacitiesInDifferentLinksInNoFailureState()? "--" : d.getSeqOccupiedCapacitiesIfNotFailing().get(0) , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "# links", "Number of traversed links", null , d->d.getSeqLinks() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "# resources", "Number of traversed resources", null , d->d.getSeqResourcesTraversed() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "Length (km)", "Length of the route, considering also the length of the lower layer links traversed if any", null , d->d.getLengthInKm() , AGTYPE.MAXDOUBLE , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "E2e latency (ms)", "End-to-end latency considering links and resources traversed, and propagation time in lower layer links if any", null , d->d.getPropagationDelayInMiliseconds() , AGTYPE.MAXDOUBLE , d->{ final double m = d.getDemand().getMaximumAcceptableE2EWorstCaseLatencyInMs(); if (m >= 0) return null; return d.getPropagationDelayInMiliseconds () > m? Color.RED : null; })); return res; }
check_totalCarriedTraffic += carriedTraffic; check_cache_totalOccupiedCapacity += occupiedCapacity; final String qosType = r.getDemand().getQosType(); Pair<Double,Double> thisQosTypeInfoSoFar = res.get(qosType); if (thisQosTypeInfoSoFar == null) { thisQosTypeInfoSoFar = Pair.of(0.0, 0.0); res.put(qosType, thisQosTypeInfoSoFar); }
/** Given a path-based routing, returns the amount of traffic for each demand d traversing each link e. The link * occupation information is not used, only the route carried traffic (recall that a route carried traffic is zero if * it traverses a failed link/node) * @param E Number of links * @param D Number of demands * @param routes List of routes * @return Demand-link routing in the form x_de (amount of traffic from demand d, transmitted through link e) */ public static DoubleMatrix2D convert_xp2xde(int D , int E , List<Route> routes) { DoubleMatrix2D x_de = DoubleFactory2D.sparse.make(D, E, 0); if (routes.isEmpty()) return x_de; final NetworkLayer layer = routes.iterator().next().getLayer(); if (E != layer.getNetPlan().getNumberOfLinks(layer)) throw new Net2PlanException ("Wrong format"); if (D != layer.getNetPlan().getNumberOfDemands(layer)) throw new Net2PlanException ("Wrong format"); for (Route route : routes) { final int d = route.getDemand().getIndex(); for (Link link : route.getSeqLinks()) { final int e = link.getIndex(); x_de.setQuick(d, e, x_de.getQuick(d, e) + route.getCarriedTraffic()); } } return x_de; }
this.currentNetPlan.addRoutesFromCandidatePathList(currentNetPlan.computeUnicastCandidatePathList(currentNetPlan.getVectorLinkLengthInKm() , 1, -1, -1, -1, -1, -1, -1 , null)); for (Route r : currentNetPlan.getRoutes ()) r.setCarriedTraffic(r.getDemand().getOfferedTraffic() , r.getDemand().getOfferedTraffic());
DrawUtils.drawDownPropagationInterLayerLinks(vs, ipg.getLinksInGraph(), pickedRoute.isBackupRoute() ? VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_BACKUP : VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasUpperLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1) && pickedRoute.getDemand().isCoupled()) final InterLayerPropagationGraph ipg = new InterLayerPropagationGraph(null, new TreeSet<> (Arrays.asList(pickedRoute.getDemand().getCoupledLink())), null, true); DrawUtils.drawCollateralLinks(vs, ipg.getLinksInGraph(), VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); DrawUtils.drawDownPropagationInterLayerLinks(vs, ipg.getLinksInGraph(), VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED);
final Demand d = route.getDemand(); final double signalingReceptionTime = t + Math.max(0 , signaling_averageDelay.getDouble() + signaling_maxFluctuationInDelay.getDouble() * (rng.nextDouble() - 0.5)); this.scheduleEvent(new SimEvent (signalingReceptionTime , SimEvent.DestinationModule.EVENT_PROCESSOR , SIGNALING_RECEIVEDMESSAGE , Pair.of(d , infoToSignal)));
for (int rRest = 0 ; rRest < Rrest ; rRest ++) final int r = rChange [rRest]; final int dRest [] = IntUtils.find(dChange, netPlan.getRoute (r).getDemand().getIndex () , SearchType.ALL); if (dRest.length != 1) throw new RuntimeException ("Bad"); A_dRestrRest.set(dRest [0], rRest , 1.0);