/** Returns the total carried in the links of te given layer entering the node. * If no layer is provided, the default layer is assumed * @param optionalLayerParameter Network layer (optional) * @return see above */ public double getIncomingLinksTraffic (NetworkLayer ... optionalLayerParameter) { checkAttachedToNetPlanObject(); NetworkLayer layer = netPlan.checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); double accum = 0; for (Link e : cache_nodeIncomingLinks) if (e.layer.equals (layer)) accum += e.getCarriedTraffic(); return accum; }
/** Returns the total capacity in the links of te given layer entering the node. * If no layer is provided, the default layer is assumed * @param optionalLayerParameter Network layer (optional) * @return see above */ public double getOutgoingLinksCapacity (NetworkLayer ... optionalLayerParameter) { checkAttachedToNetPlanObject(); NetworkLayer layer = netPlan.checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); double accum = 0; for (Link e : cache_nodeOutgoingLinks) if (e.layer.equals (layer)) accum += e.capacity; return accum; }
/** Sets the population of the node (must be non-negative) * @param population the population */ public void setPopulation (double population) { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); if (population < 0) throw new Net2PlanException ("Node population must be non-negative"); this.population = population; this.name = name == null? "" : name; }
@Override public void saveDemandSetToFile(NetPlan netPlan, File file) { for (NetworkLayer layer : netPlan.getNetworkLayers ()) if (!layer.equals(netPlan.getNetworkLayerDefault())) netPlan.removeNetworkLayer (layer); netPlan.removeAllLinks(); netPlan.removeAllUnicastRoutingInformation(); netPlan.removeAllSRGs(); netPlan.saveToFile(file); }
private double getMinimumNonZeroTrafficOrCapacityValue (NetPlan netPlan) { double res = Double.MAX_VALUE; for (Demand d : netPlan.getDemands ()) if (d.getOfferedTraffic() > 0) res = Math.min (res , d.getOfferedTraffic()); for (Link e : netPlan.getLinks ()) if (e.getCapacity() > 0) res = Math.min (res , e.getCapacity()); if (res == Double.MAX_VALUE) throw new Net2PlanException ("Too large offered traffics and link capacities"); return res; } }
public WNet (NetPlan np) { super (np); this.np = np; if(np.getNumberOfNodes() < 2 || np.getNumberOfLayers() != 2) throw new Net2PlanException("Incorrect number of nodes or layers"); } private final NetPlan np;
public BasicStroke getStroke() { if (npLink == null) return edgeStrokeIfNotActiveLayer; // interlayer link return npLink.getNetPlan().getNetworkLayerDefault() == npLink.getLayer()? edgeStrokeIfActiveLayer : edgeStrokeIfNotActiveLayer; }
/** * <p>Sets nodes and links associated to the SRG as down (in case they are not yet). The network state is updated with the affected routes, * segments, trees and hop-by-hop routing associated to the new nodes/links down </p> */ public void setAsDown () { checkAttachedToNetPlanObject(); netPlan.setLinksAndNodesFailureState (null , getLinksAllLayers() , null , getNodes ()); }
public void setDynamicImplementation (DynamicSrgImplementation impl) { if (!isDynamicSrg()) throw new Net2PlanException ("The SRG is not dynamic"); this.dynamicSrgImplementation = impl; }
/** * <p>Checks whether this element (demand, node, route...) was not already removed from the {@code NetPlan} object. When negative, an exception will be thrown.</p> * @param np NetPlan object */ public final void checkAttachedToNetPlanObject (NetPlan np) { np.checkInThisNetPlan(this); if (np != this.netPlan) throw new Net2PlanException ("The element " + this + " is not associated to the given NetPlan object"); }
/** * Constructor. * * @param netPlan Network design * @since 0.3.0 */ public ForwardingRuleComparator(NetPlan netPlan) { this(netPlan, netPlan.getNetworkLayerDefault ().getId()); }
/** <p>Returns the link propagation delay in miliseconds.</p> * @return The propagation delay in miliseconds */ public double getPropagationDelayInMs() { if (coupledLowerOrThisLayerDemand != null) return coupledLowerOrThisLayerDemand.getWorstCasePropagationTimeInMs(); if (coupledLowerLayerMulticastDemand != null) return coupledLowerLayerMulticastDemand.getWorseCasePropagationTimeInMs(); return ((propagationSpeedInKmPerSecond == Double.MAX_VALUE) || (propagationSpeedInKmPerSecond <= 0))? 0 : 1000 * lengthInKm / propagationSpeedInKmPerSecond; }
/** * <p>Returns the sum of the {@link com.net2plan.interfaces.networkDesign.Link Links} length in kms of the tree.</p> * @return The tree total length in km */ public double getTreeTotalLengthInKm () { checkAttachedToNetPlanObject(); double accum = 0; for (Link e : getLinkSet()) accum += e.getLengthInKm(); return accum; }
/** Returns true if the path in the RSA is down (traverses a node/link that is down) * @return see above */ public boolean isDown () { final NetPlan np = ingressNode.getNetPlan(); return !np.isUp(seqLinks); }
/** Returns the total carried in the links of te given layer entering the node. * If no layer is provided, the default layer is assumed * @param optionalLayerParameter Network layer (optional) * @return see above */ public double getOutgoingLinksTraffic (NetworkLayer ... optionalLayerParameter) { checkAttachedToNetPlanObject(); NetworkLayer layer = netPlan.checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); double accum = 0; for (Link e : cache_nodeOutgoingLinks) if (e.layer.equals (layer)) accum += e.getCarriedTraffic(); return accum; }
/** Returns the total capacity in the links of te given layer entering the node. * If no layer is provided, the default layer is assumed * @param optionalLayerParameter Network layer (optional) * @return see above */ public double getIncomingLinksCapacity (NetworkLayer ... optionalLayerParameter) { checkAttachedToNetPlanObject(); NetworkLayer layer = netPlan.checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); double accum = 0; for (Link e : cache_nodeIncomingLinks) if (e.layer.equals (layer)) accum += e.capacity; return accum; }
/** * <p>Returns the total multicast offered traffic initiated in the node, counting the multicast demands at the given layer. * If no layer is provided, the default layer is assumed.</p> * @param optionalLayerParameter Network layer (optional) * @return The total multicast offered traffic initiated in the node */ public double getIngressOfferedMulticastTraffic (NetworkLayer ... optionalLayerParameter) { checkAttachedToNetPlanObject(); NetworkLayer layer = netPlan.checkInThisNetPlanOptionalLayerParameter(optionalLayerParameter); double accum = 0; for (MulticastDemand d : cache_nodeOutgoingMulticastDemands) if (d.layer.equals (layer)) accum += d.offeredTraffic; return accum; }