/** * <p>Returns the multicast tree carried traffic. If the multicast tree is down, the carried traffic and occupied capacities are zero. * To retrieve the multicast tree carried traffic if all the links and nodes where up, use {@link #getCarriedTrafficInNoFailureState() getCarriedTrafficInNoFailureState()}.</p> * @return The carrief traffic by the multicast tree (see description above) */ public double getCarriedTraffic () { return isDown ()? 0.0 : carriedTrafficIfNotFailing; }
/** * <p>Returns the multicast tree current amount of capacity occupied in the traversed {@link com.net2plan.interfaces.networkDesign.Link Links}. If the multicast tree is down, the * occupied links capacities are zero. To retrieve the multicast tree occupied link capacity if all the links and nodes where up, use {@link #getOccupiedLinkCapacityInNoFailureState()}.</p> * @return The occupied link capacity */ public double getOccupiedLinkCapacity () { return isDown ()? 0.0 : occupiedLinkCapacityIfNotFailing; }
@Override void checkCachesConsistency () { super.checkCachesConsistency (); if (!layer.multicastTrees.contains(this)) throw new RuntimeException ("Bad"); if (!demand.cache_multicastTrees.contains(this)) throw new RuntimeException ("Bad"); if (linkSet == null) throw new RuntimeException ("Multicast tree " + this + ", linkSet == null"); if (initialSetLinksWhenWasCreated == null) throw new RuntimeException ("Multicast Tree " + this + ", initialSetLinksWhenWasCreated == null"); netPlan.checkInThisNetPlanAndLayer(linkSet , layer); for (Link link : linkSet) if (!link.cache_traversingTrees.contains(this)) throw new RuntimeException ("Bad"); for (Node node : cache_traversedNodes) if (!node.cache_nodeAssociatedulticastTrees.contains(this)) throw new RuntimeException ("Bad"); boolean shouldBeUp = true; for (Link e : linkSet) if (!e.isUp) { shouldBeUp = false; break; } if (shouldBeUp) for (Node n : cache_traversedNodes) if (!n.isUp) { shouldBeUp = false; break; } if (!shouldBeUp != this.isDown()) throw new RuntimeException("Bad"); if (shouldBeUp) { if (getCarriedTraffic() != carriedTrafficIfNotFailing) throw new RuntimeException ("Bad"); } else { if (getCarriedTraffic() != 0) throw new RuntimeException ("Bad"); } }
private List<Triple<String,String,String>> getMulticastTreeInfoTables (MulticastTree t) { final DecimalFormat df = new DecimalFormat("###.##"); final NetPlan np = t.getNetPlan(); final List<Triple<String,String,String>> res = new ArrayList <> (); res.add(Triple.of("Tree index/id" , "Tree " + t.getIndex() + " (id " + t.getId() + ")", "multicastTre" + t.getId())); res.add(Triple.of("Layer" , "" + getLayerName(t.getLayer()) , "layer" + t.getLayer().getId())); res.add(Triple.of("Tree demand" , "Multicast demand " + t.getMulticastDemand().getIndex() + " (id " + t.getMulticastDemand().getId() + ")" , "multicastDemand" + t.getMulticastDemand().getId())); res.add(Triple.of("M. Demand offered traffic" , "" + df.format(t.getMulticastDemand().getOfferedTraffic()) + " " + np.getDemandTrafficUnitsName(t.getLayer()) , "")); res.add(Triple.of("M. Demand carried traffic" , "" + df.format(t.getMulticastDemand().getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(t.getLayer()) , "")); res.add(Triple.of("Tree carried traffic" , "" + df.format(t.getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(t.getLayer()), "")); res.add(Triple.of("Is up?" , "" + !t.isDown(), "")); res.add(Triple.of("Worst link utilization" , "" + df.format(t.getLinkSet().stream().mapToDouble(e->e.getUtilization()).max().orElse(0)), "")); res.add(Triple.of("E2E num. hops (av / max)" , "" + df.format(t.getTreeAveragePathLengthInHops()) + " / " + df.format(t.getTreeMaximumPathLengthInHops()) , "")); res.add(Triple.of("E2E length in km (av / max)" , "" + df.format(t.getTreeAveragePathLengthInHops()) + " / " + df.format(t.getTreeMaximumPathLengthInKm()) + " km", "")); res.add(Triple.of("E2E length in ms (av / max)" , "" + df.format(t.getTreeAveragePropagationDelayInMs()) + " / " + df.format(t.getTreeMaximumPropagationDelayInMs()) + " ms", "")); return res; } private List<Triple<String,String,String>> getDemandInfoTables (Demand d)