MulticastDemand extends NetworkElement implements IMonitorizableElement { public SortedSet<Link> coupleToNewLinksCreated (NetworkLayer newLinkLayer) { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); newLinkLayer.checkAttachedToNetPlanObject(this.netPlan); if (this.layer.equals (newLinkLayer)) throw new Net2PlanException ("Cannot couple a link and a demand in the same layer"); if (isCoupled()) throw new Net2PlanException ("The multicast demand is already coupled"); SortedSet<Link> newLinks = new TreeSet<Link> (); try { for (Node egressNode : egressNodes) { Link newLink = netPlan.addLink(ingressNode , egressNode , carriedTraffic , netPlan.getNodePairEuclideanDistance(ingressNode , egressNode) , 200000 , null , newLinkLayer); newLinks.add (newLink); } couple (newLinks); } catch (Exception e) { for (Link link : newLinks) link.remove (); throw e; } if (ErrorHandling.isDebugEnabled()) netPlan.checkCachesConsistency(); return newLinks; } MulticastDemand(NetPlan netPlan , long id , int index , NetworkLayer layer , Node ingressNode , Set<Node> egressNodes , double offeredTraffic , AttributeMap attributes); void setMaximumAcceptableE2EWorstCaseLatencyInMs(double maxLatencyMs); double getMaximumAcceptableE2EWorstCaseLatencyInMs(); void setQoSType(String newQosType); String getQosType(); void setOfferedTrafficPerPeriodGrowthFactor(double growthFactor); double getOfferedTrafficPerPeriodGrowthFactor(); NetworkLayer getLayer(); double getWorseCasePropagationTimeInMs(); double getWorstCaseLengthInKm(); boolean isTraversingOversubscribedLinks(); Node getIngressNode(); SortedSet<Node> getEgressNodes(); double getOfferedTraffic(); double getCarriedTraffic(); double getBlockedTraffic(); Pair<SortedSet<MulticastTree>,Double> computeMinimumCostMulticastTrees(double [] costs); boolean isBifurcated(); boolean isBlocked(); SortedSet<MulticastTree> getMulticastTrees(); boolean isAllTreesReachingAllEgressNodes(); void couple(Set<Link> links); SortedSet<Link> coupleToNewLinksCreated(NetworkLayer newLinkLayer); SortedSet<Link> getCoupledLinks(); boolean isCoupled(); void decouple(); void remove(); void setOfferedTraffic(double offeredTraffic); String toString(); SortedMap<Link, Double> getTraversedLinksAndCarriedTraffic(final boolean normalizedToOfferedTraffic); SortedSet<Link> getLinksNoDownPropagationPotentiallyCarryingTraffic(Node egressNode); TrafficSeries getMonitoredOrForecastedOfferedTraffic(); void setMonitoredOrForecastedOfferedTraffic(TrafficSeries newTimeSeries); @Override TrafficSeries getMonitoredOrForecastedCarriedTraffic(); @Override void setMonitoredOrForecastedCarriedTraffic(TrafficSeries newTimeSeries); @Override double getCurrentTrafficToAddMonitSample(); @Override boolean isPossibleToSetCurrentTrafficAsGivenMonitSample(); @Override void setCurrentTrafficToGivenMonitSample(double traffic); @Override Optional<TrafficPredictor> getTrafficPredictor(); @Override void setTrafficPredictor(TrafficPredictor tp); @Override void removeTrafficPredictor();  }
@Test public void testCoupleToNewLinksCreated() { NetworkLayer upperUpperLayer = np.addLayer("" , "" , "upperTrafficUnits" , "Mbps" , null , null); SortedSet<Link> uuLinks = upperMd123.coupleToNewLinksCreated(upperUpperLayer); assertEquals(uuLinks.size() , 2); for (Link e : uuLinks) { assertEquals(e.isCoupled() , true); assertEquals(e.getCapacity() , upperMd123.getCarriedTraffic() , 0); assertEquals(e.getCoupledMulticastDemand() , upperMd123); } }