/** 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); }
private static Link getLink (Node a , Node b) { final NetPlan np = a.getNetPlan(); final SortedSet<Link> links = np.getNodePairLinks(a, b, false); if (links.size () != 1) throw new RuntimeException (); return links.iterator().next(); }
@Override public SortedSet<Link> getLinksAllLayers () { final NetPlan np = a.getNetPlan(); if (np == null || b.getNetPlan() == null || layer.getNetPlan() == null) return new TreeSet<> (); assert np == b.getNetPlan(); assert np == layer.getNetPlan(); final SortedSet<Link> res_ab = np.getNodePairLinks(a, b, false, layer); for (Link e : new ArrayList<> (res_ab)) if (e.isBidirectional()) res_ab.add(e.getBidirectionalPair()); return res_ab; } @Override
/** Sets the total hard disk size (in GBytes) available in the node for instantiation of VNFs * @param totalHdGB see above */ public void setTotalHdGB (double totalHdGB) { final Set<Resource> res = n.getResources(RESOURCETYPE_HD); if (res.size() > 1) throw new Net2PlanException ("Format error"); if (res.isEmpty()) res.add(n.getNetPlan().addResource(RESOURCETYPE_HD, RESOURCETYPE_HD, Optional.of(n), totalHdGB, "GB", new HashMap<> (), 0.0, null)); else res.iterator().next().setCapacity(totalHdGB, new HashMap<> ()); } /** Returns the current number of occupied CPUs by the instantiated VNFs
/** Sets the total RAM (in GBytes) available in the node for instantiation of VNFs * @param totalRamGB see above */ public void setTotalRamGB (double totalRamGB) { final Set<Resource> res = n.getResources(RESOURCETYPE_RAM); if (res.size() > 1) throw new Net2PlanException ("Format error"); if (res.isEmpty()) res.add(n.getNetPlan().addResource(RESOURCETYPE_RAM, RESOURCETYPE_RAM, Optional.of(n), totalRamGB, "GB", new HashMap<> (), 0.0, null)); else res.iterator().next().setCapacity(totalRamGB, new HashMap<> ()); } /** Returns the total hard disk size (in GBytes) available in the node for instantiation of VNFs
/** Sets the number of CPUs available in the node for instantiation of VNFs * @param totalNumCpus see above */ public void setTotalNumCpus (double totalNumCpus) { final Set<Resource> res = n.getResources(RESOURCETYPE_CPU); if (res.size() > 1) throw new Net2PlanException ("Format error"); if (res.isEmpty()) n.getNetPlan().addResource(RESOURCETYPE_CPU, RESOURCETYPE_CPU, Optional.of(n), totalNumCpus, RESOURCETYPE_CPU, new HashMap<> (), 0.0, null); else res.iterator().next().setCapacity(totalNumCpus, new HashMap<> ()); } /** Returns the total RAM (in GBytes) available in the node for instantiation of VNFs
void checkCachesConsistency () { super.checkCachesConsistency (); assert getNodes ().stream().allMatch(n->n.getNetPlan()== this.netPlan); assert getLinksAllLayers ().stream().allMatch(n->n.getNetPlan()== this.netPlan); if (isDynamicSrg()) { for (Link link : linksIfNonDynamic) if (!link.cache_nonDynamicSrgs.contains(this)) throw new RuntimeException ("Bad"); for (Node node : nodesIfNonDynamic) if (!node.cache_nodeNonDynamicSRGs.contains(this)) throw new RuntimeException ("Bad"); } }
Link getIncomingLinkFromAnycastOrigin () { return n.getNetPlan().getNodePairLinks(getNet().getAnycastOriginNode().getNe(), n, false, getIpNpLayer()).stream().findFirst().orElseThrow(()->new RuntimeException()); } Link getOutgoingLinkToAnycastDestination ()
Link getOutgoingLinkToAnycastDestination () { return n.getNetPlan().getNodePairLinks(n , getNet().getAnycastDestinationNode().getNe(), false, getIpNpLayer()).stream().findFirst().orElseThrow(()->new RuntimeException()); }
private TBFToFromCarriedTraffic(Node node, NetworkLayer layer, boolean onlyThisLayer) { super(node.getNetPlan()); this.initialElement = node; this.onlyThisLayer = onlyThisLayer; this.initialFR = null; this.auxLayerInNodes = layer; final Set<Link> linksAllLayers = new HashSet<>(); final Set<Demand> demandsAllLayers = new HashSet<>(); final Set<MulticastDemand> mDemandsAllLayers = new HashSet<>(); demandsAllLayers.addAll(node.getIncomingDemands(layer)); demandsAllLayers.addAll(node.getOutgoingDemands(layer)); linksAllLayers.addAll(node.getIncomingLinks(layer)); linksAllLayers.addAll(node.getOutgoingLinks(layer)); mDemandsAllLayers.addAll(node.getIncomingMulticastDemands(layer)); mDemandsAllLayers.addAll(node.getOutgoingMulticastDemands(layer)); if (!onlyThisLayer) updatePropagationDownWards(linksAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); if (!onlyThisLayer) updatePropagationUpWards(demandsAllLayers, mDemandsAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); final Set<NetworkLayer> layersToKeepAllElements = onlyThisLayer ? Sets.difference(new HashSet<>(netPlan.getNetworkLayers()), Sets.newHashSet(layer)) : new HashSet<>(); updateAllButLinksDemandsMDemandsUsingExistingInfo(linksAllLayers, demandsAllLayers, mDemandsAllLayers, layersToKeepAllElements); }
public String getToolTip() final NetPlan np = npNode.getNetPlan(); final String capUnits = np.getLinkCapacityUnitsName(layer); final String trafUnits = np.getDemandTrafficUnitsName(layer);
@Override public void actionPerformed(ActionEvent e) { originNode.getNetPlan().addLink(originNode , destinationNode , 0 , 0 , 200000 , null , layer); callback.getVisualizationState().recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges(); callback.addNetPlanChange(); } }
@Override public void actionPerformed(ActionEvent e) { originNode.getNetPlan().addLinkBidirectional(originNode , destinationNode , 0 , 0 , 200000 , null , layer); callback.getVisualizationState().recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges(); callback.addNetPlanChange(); }
private List<Triple<String,String,String>> getNodeInfoTables (Node n , NetworkLayer layer) { final DecimalFormat df = new DecimalFormat("###.##"); final NetPlan np = n.getNetPlan(); final List<Triple<String,String,String>> res = new ArrayList <> (); final String trafUnits = np.getDemandTrafficUnitsName(layer); res.add(Triple.of("Node index/id" , "Node " + n.getIndex() + " (id " + n.getId() + ")", "node" + n.getId())); res.add(Triple.of("Name" , n.getName().equals("")? "No name" : n.getName(), "")); res.add(Triple.of("Site", (n.getSiteName() != null) ? n.getSiteName() : "undefined","")); res.add(Triple.of("Coordinates (x,y)" , "(" + n.getXYPositionMap().getX() + "," + n.getXYPositionMap().getY() + ")" , "")); res.add(Triple.of("Is up?", "" + n.isUp() , "")); res.add(Triple.of("# Resources" , n.getResources().isEmpty() ? "none" : ""+n.getResources().size() , "")); for (Resource r : n.getResources()) res.add(Triple.of("- " + getResourceName(r) , "" , "resource" + r.getId())); res.add(Triple.of("Information at layer" , getLayerName(layer) , "")); res.add(Triple.of("# output links", "" + n.getOutgoingLinks(layer).size() , "")); res.add(Triple.of("# input links" , "" + n.getIncomingLinks(layer).size() , "")); res.add(Triple.of("Output traffic" , "" + df.format(n.getOutgoingLinks(layer).stream().mapToDouble(e->e.getCarriedTraffic()).sum()) + " " + trafUnits , "")); res.add(Triple.of("Input traffic" , df.format(n.getIncomingLinks(layer).stream().mapToDouble(e->e.getCarriedTraffic()).sum()) + " " + trafUnits , "")); res.add(Triple.of("# SRGs" , n.getSRGs().isEmpty() ? "none" : ""+n.getSRGs().size() , "")); for (SharedRiskGroup srg : n.getSRGs()) res.add(Triple.of("- Sh. risk group index/id" , "" + srg.getIndex() + " (id " + srg.getId() + ")" , "srg" + srg.getId())); return res; } private List<Triple<String,String,String>> getResourceInfoTables (Resource r)
if (bidirectional) linkToPick = node.getNetPlan().addLinkBidirectional(startVertex.getAssociatedNode(), node,0,0,200000,null).getFirst(); linkToPick = node.getNetPlan().addLink(startVertex.getAssociatedNode(), node,0,0,200000,null);
final int N = ingressNode.getNetPlan ().getNumberOfNodes(); DoubleMatrix2D eyeMinusQ_nn = new SparseCCDoubleMatrix2D (N,N); for (Entry<Link,Double> frInfo : frs.entrySet())
double maxE2EPropDelayInMs, double maxTreeCost, double maxTreeCostFactorRespectToMinimumCostTree, double maxTreeCostRespectToMinimumCostTree) final NetPlan np = originNode.getNetPlan(); if (layer == null) layer = np.getNetworkLayerDefault(); final List<Link> links = np.getLinks(layer);
public static SortedSet<Link> getMinimumCostMulticastTree(NetworkLayer layer, DoubleMatrix2D Aout_ne, DoubleMatrix2D Ain_ne, DoubleMatrix1D linkCost, Node originNode, Set<Node> destinationNodes, int maxCopyCapability, int maxE2ENumHops, double maxE2ELengthInKm, double maxE2EPropDelayInMs, String solverName, String solverLibraryName, double maxSolverTimeInSeconds, String... solverParam) if (layer == null) layer = originNode.getNetPlan().getNetworkLayerDefault(); final NetPlan np = layer.getNetPlan(); final List<Link> links = np.getLinks(layer);
final FigureNodeSequencePanel fig = new FigureNodeSequencePanel(callback , n , layerPickedElement , "Node " + n.getIndex()); this.add(fig , BorderLayout.WEST); this.add(createPanelInfo(getNodeInfoTables(n , n.getNetPlan().getNetworkLayerDefault()), n) , BorderLayout.CENTER);