/** Indicates if this lightpath is up (does not traverse any failed fiber/node) * @return see above */ public boolean isUp () { return !r.isDown(); } /** Returns the number of optical slots occupied by the lightpath
/** Returns the route carried traffic at this moment. Recall that if the route is down (traverses a link or node that is down) its carried traffic is * automatically set to zero. To retrieve the route carried traffic if all the links and nodes where up, use getCarriedTrafficInNoFailureState * @return the current carried traffic */ public double getCarriedTraffic() { return isDown ()? 0.0 : currentCarriedTrafficIfNotFailing; }
/** Returns the capacity that is occupied in this resource, because of a traversing route. If the route is not traversing * the resource, zero is returned. If the route is down, the occupied capacity is zero * @param route the route * @return the occupied capacity */ public double getTraversingRouteOccupiedCapacity(Route route) { Double info = cache_traversingRoutesAndOccupiedCapacitiesIfNotFailingRoute.get(route); return (info == null) || (route.isDown())? 0.0 : info; }
/** Returns a map with one key per each traversing route, and associated to it the amount of capacity occupied in this resource * because of it. Recall that if a route is down, its occupied capacity in the traversed resources drops to zero, and * come backs to its previous value when the route becomes up again * @return the map */ public SortedMap<Route,Double> getTraversingRouteOccupiedCapacityMap() { SortedMap<Route,Double> res = new TreeMap<Route,Double> (cache_traversingRoutesAndOccupiedCapacitiesIfNotFailingRoute); for (Route r : res.keySet()) if (r.isDown()) res.put(r , 0.0); return res; }
void updateTotalOccupiedCapacity () { this.cache_totalOccupiedCapacity = 0; for (Entry<Resource,Double> entryUpperResource : capacityUpperResourcesOccupyInMe.entrySet()) cache_totalOccupiedCapacity += entryUpperResource.getValue(); for (Entry<Route,Double> entry : cache_traversingRoutesAndOccupiedCapacitiesIfNotFailingRoute.entrySet()) if (!entry.getKey().isDown()) cache_totalOccupiedCapacity += entry.getValue(); }
public AdvancedJTable_route(GUINetworkDesign callback , NetworkLayer layerThisTable) { super(callback, AJTableType.ROUTES , layerThisTable , true , r->r.isDown() && r.getCarriedTrafficInNoFailureState() > 0? Color.RED : null); }
/** Returns the route occupied capacity at this moment, at the particular link or resource. If no link or resource is provided, * the occupied capacity in the first traversed link or resource is assumed. Recall that a route can have loops, and traverse a link/resource more than once, * so the returned occupation is the sum of the occupations in each pass. * If the route is down (traverses a link or node that is down) its occupied capacity in links and resources is automatically set to zero. * To retrieve the route occupied link or resource capacity if all the links and nodes where up, * use getOccupiedCapacityInNoFailureState. * @param e one link or resource where to see the occupation (if not part of the route, zero is returned) * @return the current occupied capacity */ public double getOccupiedCapacity (NetworkElement ... e) { if (isDown ()) return 0.0; return getOccupiedCapacityInNoFailureState (e); }
/** * <p>Returns the demand-resource matrix, with as many rows as demands of the given layer, and as many columns as resources, * coordinate (d,r) is the resource capacity that demand d currently occupies in resource r (recall that failed routes do not occupy capacity * in the traversed resources). If no layer is provided, the default layer is assumed</p> * * @param optionalLayerParameter Network layer (optional) * @return The matrix */ public DoubleMatrix2D getMatrixDemand2ResourceOccupiedCapacity(NetworkLayer... optionalLayerParameter) { NetworkLayer layer = checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); DoubleMatrix2D x_dr = DoubleFactory2D.sparse.make(layer.demands.size(), resources.size()); for (Route r : layer.routes) if (!r.isDown()) for (Entry<NetworkElement, Double> e : r.cache_linkAndResourcesTraversedOccupiedCapIfnotFailMap.entrySet()) if (e.getKey() instanceof Resource) x_dr.set(r.demand.index, e.getKey().index, e.getValue()); return x_dr; }
final double val = travRoute.getValue(); if (r.cache_linkAndResourcesTraversedOccupiedCapIfnotFailMap.get(this) != val) throw new RuntimeException ("Bad"); if (!r.isDown()) accumOccupCap += val;
/** * <p>Returns a matrix with as many rows resources, and columns as routes in the given layer, and coordinate (res,rou) contains * the capacity occupied by route rou in resource res (note that if a route is down, its occupied capacity in a resource becomes zero). * If no layer is provided, default layer is assumed</p> * * @param optionalLayerParameter the layer (optional) * @return The matrix */ public DoubleMatrix2D getMatrixResource2RouteOccupation(NetworkLayer... optionalLayerParameter) { NetworkLayer layer = checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); final int RES = resources.size(); final int ROU = layer.routes.size(); DoubleMatrix2D delta_er = DoubleFactory2D.sparse.make(RES, ROU); for (Resource res : resources) for (Entry<Route, Double> rou : res.cache_traversingRoutesAndOccupiedCapacitiesIfNotFailingRoute.entrySet()) if (rou.getKey().layer.equals(layer)) delta_er.set(res.index, rou.getKey().index, rou.getKey().isDown() ? 0 : rou.getValue()); return delta_er; }
/** Returns the set of links in this layer that could potentially carry traffic of this demand, according to the routes/forwarding rules defined, * if the routes had carried traffic / (hop-by-hop) the demand had offered traffic different to zero. * The method returns a pair of sets (disjoint or not), first set with the set of links potentially carrying primary traffic and * second with links in backup routes. Potentially carrying traffic means that * (i) in source routing, down routes are not included, but all up routes are considered even if the carry zero traffic, * (ii) in hop-by-hop routing the links are computed even if the demand offered traffic is zero, * and all the links are considered primary. Naturally, forwarding rules of failed links apply as zero * @return see above */ public Pair<SortedSet<Link>,SortedSet<Link>> getLinksNoDownPropagationPotentiallyCarryingTraffic () { final SortedSet<Link> resPrimary = new TreeSet<> (); final SortedSet<Link> resBackup = new TreeSet<> (); if (routingType == RoutingType.HOP_BY_HOP_ROUTING) { for (Entry<Link,Pair<Double,Double>> entry : this.cacheHbH_normCarriedOccupiedPerLinkCurrentState.entrySet()) if (entry.getValue().getFirst() > Configuration.precisionFactor) resPrimary.add(entry.getKey()); } else { for (Route r : cache_routes) { if (r.isDown()) continue; for (Link e : r.getSeqLinks()) if (r.isBackupRoute()) resBackup.add(e); else resPrimary.add(e); } } return Pair.of(resPrimary,resBackup); }
private static String getSequenceOccupiedCapacities(Route r) { if (r.isDown()) return "0"; if (r.getSeqOccupiedCapacitiesIfNotFailing().equals(Collections.nCopies(r.getPath().size(), r.getOccupiedCapacity()))) return "" + r.getOccupiedCapacity(); return CollectionUtils.join(r.getSeqOccupiedCapacitiesIfNotFailing(), ", "); } }
if (shouldBeUp) for (Node n : cache_seqNodesRealPath) if (!n.isUp) { shouldBeUp = false; break; } if (!shouldBeUp != this.isDown()) System.out.println ("Route : " + this + ", should be up: " + shouldBeUp + ", isDown: " + isDown() + ", carried traffic: " + this.getCarriedTraffic() + ", carried all ok: " + currentCarriedTrafficIfNotFailing); for (Link e : cache_seqLinksRealPath) System.out.println ("Link e: " + e + ", isUp " + e.isUp);
if (r.isDown()) continue; for (Link e : r.getSeqLinks())
final boolean isThisRouteDown = this.isDown(); if (linkAndResourcesOccupationInformation == null) linkAndResourcesOccupationInformation = new ArrayList<Double> (this.currentLinksAndResourcesOccupationIfNotFailing); //Collections.nCopies(this.currentPath.size(), newCarriedTraffic);
@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; }
if (!backupRoute.isDown())
if (!backupRoute.isDown())