/** * <p>Adds a new multicast traffic demand.</p> * <p><b>Important</b>: Ingress node cannot be also an egress node.</p> * * @param ingressNode Ingress node * @param egressNodes Egress node * @param offeredTraffic Offered traffic of the demand. It must be greater or equal than zero * @param attributes SortedMap for user-defined attributes ({@code null} means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute value * @param optionalLayerParameter Network layer to which add the demand (optional) * @return The newly created multicast demand * @see com.net2plan.interfaces.networkDesign.MulticastDemand * @see com.net2plan.interfaces.networkDesign.Node */ public MulticastDemand addMulticastDemand(Node ingressNode, Set<Node> egressNodes, double offeredTraffic, Map<String, String> attributes, NetworkLayer... optionalLayerParameter) { return addMulticastDemand(null, ingressNode, egressNodes, offeredTraffic, attributes, optionalLayerParameter); }
public void execute() { Random rng = new Random(); NetPlan netPlan = callback.getDesign(); if (netPlan.hasMulticastDemands(getTableNetworkLayer())) { int result = JOptionPane.showConfirmDialog(null, "Remove all existing multicast demands before?", "", JOptionPane.YES_NO_CANCEL_OPTION); if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) return; if (result == JOptionPane.YES_OPTION) netPlan.removeAllMulticastDemands(); } if (netPlan.getNumberOfNodes() < 2) throw new Net2PlanException("At least two nodes are needed"); for (Node ingressNode : netPlan.getNodes()) { Set<Node> egressNodes = new HashSet<Node>(); for (Node n : netPlan.getNodes()) if ((n != ingressNode) && rng.nextBoolean()) egressNodes.add(n); if (egressNodes.isEmpty()) egressNodes.add(netPlan.getNode(ingressNode.getIndex() == 0 ? 1 : 0)); netPlan.addMulticastDemand(ingressNode, egressNodes, 0, null); } }
public void execute() { NetPlan netPlan = callback.getDesign(); if (netPlan.hasMulticastDemands(getTableNetworkLayer())) { int result = JOptionPane.showConfirmDialog(null, "Remove all existing multicast demands before?", "", JOptionPane.YES_NO_CANCEL_OPTION); if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) return; else if (result == JOptionPane.YES_OPTION) netPlan.removeAllMulticastDemands(); } if (netPlan.getNumberOfNodes() < 2) throw new Net2PlanException("At least two nodes are needed"); for (Node ingressNode : netPlan.getNodes()) { Set<Node> egressNodes = new HashSet<Node>(netPlan.getNodes()); egressNodes.remove(ingressNode); netPlan.addMulticastDemand(ingressNode, egressNodes, 0, null); } } }
egressNodes.add(node); netPlan.addMulticastDemand(netPlan.getNodeFromId(ingressNode), egressNodes, 0, null , layer); break;
this.addMulticastDemand(nodes.get(originDemand.ingressNode.index), newEgressNodes, originDemand.offeredTraffic, originDemand.attributes, newLayer);
MulticastDemand newDemand = netPlan.addMulticastDemand(mapOldId2Node.get(ingressNodeId), newEgressNodes , offeredTraffic, null , mapOldId2Layer.get(layerId)); mapOldId2MulticastDemand.put (demandId , newDemand);
for (MulticastDemand demand : demands.getMulticastDemands()) netPlan.addMulticastDemand(demand.getIngressNode(), demand.getEgressNodes(), demand.getOfferedTraffic(), demand.getAttributes(), layer);
private void parseMulticastDemand(NetPlan netPlan, long layerId) throws XMLStreamException { final long demandId = getLong ("id"); if (demandId >= netPlan.nextElementId.toLong()) throw new Net2PlanException ("A network element has an id higher than the nextElementId"); final long ingressNodeId = getLong ("ingressNodeId"); Set<Node> newEgressNodes = getNodeSetFromIds(netPlan , getListLong("egressNodeIds")); final double offeredTraffic = getDouble ("offeredTraffic"); final MulticastDemand newDemand = netPlan.addMulticastDemand(demandId , netPlan.getNodeFromId(ingressNodeId), newEgressNodes , offeredTraffic, null , netPlan.getNetworkLayerFromId(layerId)); readAndAddAttributesToEndAndPdForNodes(newDemand, "multicastDemand"); }
final Node this_ae = (Node)thatToThisTranslation.get(otherDemand.getIngressNode()); final SortedSet<Node> this_be = otherDemand.getEgressNodes().stream().map(x->(Node)thatToThisTranslation.get(x)).collect(Collectors.toCollection(TreeSet::new)); final MulticastDemand thisDemand = this.addMulticastDemand(this_ae, this_be, 0, null, thisLayer); thisDemand.setOfferedTraffic(otherDemand.getOfferedTraffic());
private void parseMulticastDemand(NetPlan netPlan, long layerId) throws XMLStreamException { final long demandId = getLong ("id"); if (demandId >= netPlan.nextElementId.toLong()) throw new Net2PlanException ("A network element has an id higher than the nextElementId"); final long ingressNodeId = getLong ("ingressNodeId"); SortedSet<Node> newEgressNodes = getNodeSetFromIds(netPlan , getListLong("egressNodeIds")); final double offeredTraffic = getDouble ("offeredTraffic"); double maximumAcceptableE2EWorstCaseLatencyInMs = -1; try { maximumAcceptableE2EWorstCaseLatencyInMs = getDouble ("maximumAcceptableE2EWorstCaseLatencyInMs"); } catch (Throwable e) {} double offeredTrafficGrowthFactorPerPeriodZeroIsNoGrowth = 0; try { offeredTrafficGrowthFactorPerPeriodZeroIsNoGrowth = getDouble ("offeredTrafficGrowthFactorPerPeriodZeroIsNoGrowth"); } catch (Throwable e) {} String qosType = ""; try { qosType = getString("qosType"); } catch (Throwable e) {} final MulticastDemand newDemand = netPlan.addMulticastDemand(demandId , netPlan.getNodeFromId(ingressNodeId), newEgressNodes , offeredTraffic, null , netPlan.getNetworkLayerFromId(layerId)); newDemand.setMaximumAcceptableE2EWorstCaseLatencyInMs(maximumAcceptableE2EWorstCaseLatencyInMs); newDemand.setOfferedTrafficPerPeriodGrowthFactor(offeredTrafficGrowthFactorPerPeriodZeroIsNoGrowth); newDemand.setQoSType(qosType); newDemand.setName(getStringOrDefault("name", "")); newDemand.setDescription(getStringOrDefault("description", "")); try { final List<String> rows = StringUtils.readEscapedString_asStringList (getString("monitoredOrForecastedTraffics") , new ArrayList<> ()); final TrafficSeries readTimeSerie = TrafficSeries.createFromStringList(rows); newDemand.setMonitoredOrForecastedOfferedTraffic(readTimeSerie); } catch (Exception e) {} readAndAddAttributesToEndAndPdForNodes(newDemand, "multicastDemand"); }
netPlan.addMulticastDemand(netPlan.getNode(demand.getIngressNode().getIndex()), egressNodesThisNetPlan, demand.getOfferedTraffic(), demand.getAttributes());