public NetworkLayer getCanvasNetworkLayerAtVisualizationOrderNotRemovingNonVisible(int visualizationOrder) { if (visualizationOrder < 0) throw new RuntimeException(""); if (visualizationOrder >= this.getNetPlan().getNumberOfLayers()) throw new RuntimeException(""); return MapUtils.invertMap(visualizationSnapshot.getMapCanvasLayerVisualizationOrder()).get(visualizationOrder); }
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 List<NetworkLayer> getCanvasLayersInVisualizationOrder(boolean includeNonVisible) { Map<Integer, NetworkLayer> map = includeNonVisible ? MapUtils.invertMap(visualizationSnapshot.getMapCanvasLayerVisualizationOrder()) : cache_mapCanvasVisibleLayer2VisualizationOrderRemovingNonVisible.inverseBidiMap(); List<NetworkLayer> res = new ArrayList<>(); for (int vIndex = 0; vIndex < this.getNetPlan().getNumberOfLayers(); vIndex++) res.add(map.get(vIndex)); return res; }
private void updatePropagationUpWards(Collection<Demand> demandsToPropagateUp, Collection<MulticastDemand> mDemandsToPropagateUp, Set<Link> linksAllLayersToUpdate, Set<Demand> demandsAllLayersToUpdate, Set<MulticastDemand> mDemandsAllLayersToUpdate) { if (netPlan.getNumberOfLayers() > 1) { final Set<Pair<MulticastDemand, Node>> mDemandsAllEgressNodes = new HashSet<Pair<MulticastDemand, Node>>(); if (mDemandsToPropagateUp != null) for (MulticastDemand md : mDemandsToPropagateUp) for (Node n : md.getEgressNodes()) mDemandsAllEgressNodes.add(Pair.of(md, n)); final SortedSet<Link> initialUpperLinks = getUpCoupling(demandsToPropagateUp, mDemandsAllEgressNodes); if (initialUpperLinks.isEmpty()) return; final InterLayerPropagationGraph ipg = new InterLayerPropagationGraph(null, initialUpperLinks, null, true); linksAllLayersToUpdate.addAll(ipg.getLinksInGraph()); demandsAllLayersToUpdate.addAll(ipg.getDemandsInGraph()); mDemandsAllLayersToUpdate.addAll(ipg.getMulticastDemandFlowsInGraph().stream().map(p -> p.getFirst()).collect(Collectors.toSet())); } }
private void updatePropagationDownWards(Collection<Link> linksToPropagateDown, Set<Link> linksAllLayersToUpdate, Set<Demand> demandsAllLayersToUpdate, Set<MulticastDemand> mDemandsAllLayersToUpdate) { if (netPlan.getNumberOfLayers() > 1) { final Pair<SortedSet<Demand>, SortedSet<Pair<MulticastDemand, Node>>> downInfo = getDownCoupling(linksToPropagateDown); if (downInfo.getFirst().isEmpty() && downInfo.getSecond().isEmpty()) return; final InterLayerPropagationGraph ipg = new InterLayerPropagationGraph(downInfo.getFirst(), null, downInfo.getSecond(), false); linksAllLayersToUpdate.addAll(ipg.getLinksInGraph()); demandsAllLayersToUpdate.addAll(ipg.getDemandsInGraph()); mDemandsAllLayersToUpdate.addAll(ipg.getMulticastDemandFlowsInGraph().stream().map(p -> p.getFirst()).collect(Collectors.toSet())); } }
@Override public List<AjtRcMenu> getNonBasicRightClickMenusInfo() { final NetPlan np = callback.getDesign(); ; final List<AjtRcMenu> res = new ArrayList<> (); res.add(new AjtRcMenu("Add layer", e-> { np.addLayer("Layer " + np.getNumberOfLayers(), null, null, null, null, null); } , (a,b)->true, null)); res.add(new AjtRcMenu("Remove selected layers", e->getSelectedElements().forEach(dd->np.removeNetworkLayer((NetworkLayer) dd)) , (a,b)->b>0, null)); return res; } }
public double getCanvasDefaultVerticalDistanceForInterLayers() { if (this.getNetPlan().getNumberOfNodes() == 0) return 1.0; final int numVisibleLayers = getCanvasNumberOfVisibleLayers() == 0 ? this.getNetPlan().getNumberOfLayers() : getCanvasNumberOfVisibleLayers(); double minY = Double.MAX_VALUE; double maxY = -Double.MAX_VALUE; for (Node n : this.getNetPlan().getNodes()) { final double y = n.getXYPositionMap().getY(); minY = Math.min(minY, y); maxY = Math.max(maxY, y); } if ((maxY - minY < 1e-6)) return Math.abs(maxY) / (30 * numVisibleLayers); return (maxY - minY) / (30 * numVisibleLayers); }
public void updateNetPlanView(NetPlan currentState) { txt_numLayers.setText(Integer.toString(currentState.getNumberOfLayers())); txt_numNodes.setText(Integer.toString(currentState.getNumberOfNodes())); txt_numSRGs.setText(Integer.toString(currentState.getNumberOfSRGs()));
DrawUtils.drawCollateralLinks(vs, Sets.union(Sets.union(linksPrimary, linksBackup), linksMulticast), VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasLowerLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1) && pickedLink.isCoupled()) DrawUtils.drawDownPropagationInterLayerLinks(vs, ipg.getLinksInGraph(), VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasUpperLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1))
if ((ipLayer == wdmLayer) || (initialNetPlan.getNumberOfLayers() != 2)) throw new Net2PlanException ("Wrong layer Ids (or the design does not have two layers)");
@Override public void initialize(NetPlan initialNetPlan, Map<String, String> algorithmParameters, Map<String, String> simulationParameters, Map<String, String> net2planParameters) { /* Initialize all InputParameter objects defined in this object (this uses Java reflection) */ InputParameter.initializeAllInputParameterFieldsOfObject(this, algorithmParameters); this.ipLayer = initialNetPlan.getNetworkLayer("IP"); if (ipLayer == null) throw new Net2PlanException ("IP layer not found"); this.wdmLayer = initialNetPlan.getNetworkLayer("WDM"); if (wdmLayer == null) throw new Net2PlanException ("WDM layer not found"); if (initialNetPlan.getNumberOfLayers() != 2) throw new Net2PlanException ("The input design must have two layers"); this.ospfNetwork = new Online_evProc_ipOspf(); this.wdmNetwork = new Online_evProc_wdm(); Map<String,String> wdmParam = InputParameter.createMapFromInputParameters(new InputParameter [] { wdmNumFrequencySlotsPerFiber , wdmRwaType , wdmK , wdmRandomSeed , wdmTransponderTypesInfo , wdmMaxLightpathNumHops , wdmRemovePreviousLightpaths , wdmDefaultAndNewRouteRevoveryType } ); this.wdmNetwork.initialize(initialNetPlan , wdmParam , simulationParameters , net2planParameters); Map<String,String> ipParam = InputParameter.createMapFromInputParameters(new InputParameter [] { ipMaximumE2ELatencyMs } ); this.ospfNetwork.initialize(initialNetPlan , ipParam , simulationParameters , net2planParameters); Set<Link> ipLinksDownBecauseOfWDMLayer = new HashSet<Link> (); for (Link ipLink : initialNetPlan.getLinks (ipLayer)) if (ipLink.getCapacity() == 0) ipLinksDownBecauseOfWDMLayer.add (ipLink); SimEvent.NodesAndLinksChangeFailureState evIp = new SimEvent.NodesAndLinksChangeFailureState(null , null , null , ipLinksDownBecauseOfWDMLayer); ospfNetwork.processEvent(initialNetPlan , new SimEvent(0 , SimEvent.DestinationModule.EVENT_GENERATOR , -1 , evIp)); }
), VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasLowerLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1) && pickedLink.isCoupled()) DrawUtils.drawDownPropagationInterLayerLinks(vs, frPropagationLinks, VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasUpperLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1) && pickedDemand.isCoupled())
if (currentNetPlan.getNumberOfLayers() != 1) throw new Net2PlanException ("This algorithm works in single layer networks");
if (currentNetPlan.getNumberOfLayers() != 1) throw new Net2PlanException ("This algorithm works in single layer networks");
DrawUtils.drawCollateralLinks(vs, linksPrimary, pickedRoute.isBackupRoute() ? VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_BACKUP : VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasLowerLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1)) 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())
if (currentNetPlan.getNumberOfLayers() != 1) throw new Net2PlanException ("This algorithm works in single layer networks");
DrawUtils.drawCollateralLinks(vs, linksThisLayer, VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasLowerLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1)) DrawUtils.drawDownPropagationInterLayerLinks(vs, linksLowerLayers, VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasUpperLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1) && pickedDemand.isCoupled())
DrawUtils.drawCollateralLinks(vs, linksPrimary, VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasLowerLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1)) DrawUtils.drawDownPropagationInterLayerLinks(vs, ipg.getLinksInGraph(), VisualizationConstants.DEFAULT_REGGUILINK_EDGECOLOR_PICKED); if (vs.isShowInCanvasUpperLayerPropagation() && (vs.getNetPlan().getNumberOfLayers() > 1) && pickedTree.getMulticastDemand().isCoupled())
if (E == 0) throw new Net2PlanException ("The input design should have links"); if (currentNp.getNumberOfLayers() != 1) throw new Net2PlanException ("This algorithm works in single layer networks");
this.copyInitialNetPlan = currentNetPlan.copy(); if (currentNetPlan.getNumberOfLayers() != 1) throw new Net2PlanException ("This algorithm works in single layer networks"); this.N = currentNetPlan.getNumberOfNodes (); this.E = currentNetPlan.getNumberOfLinks ();