POSSIBILITY OF SUCH DAMAGE";
+ revision 2024-02-05 {
+ description
+ "Add customer-name to path-computation-request input to check in controller-customization if the customer's
+ services need specific handling";
+ }
revision 2023-09-25 {
description
"Add pce-constraint-mode enum to be able to disinguish the way to manage node include constraints inside the
PCE module";
- }
+ }
revision 2022-08-08 {
description
"Implement the RPC path-computation-reroute-request (only for reroute purposes) that computes a service path of
an existing service in order to reroute it";
- }
+ }
revision 2022-06-15 {
description
"change fraction digits from 2 to 6 for accumulative-value leaf, from 2 to 6 to be compliant with Gnpy";
e.g., CLFI, CLCI, etc. This is reported against the service, but
may not get reflected in the service in the network.";
}
+ leaf customer-name {
+ type string;
+ description
+ "name of the customer that may be declared in controller-customization,
+ to define a specific way to handle constraints associated with this
+ customer.";
+ }
leaf resource-reserve {
type boolean;
mandatory true;
sed 's/8101/ODL_SHELL_PORT/' ../etc/org.apache.karaf.shell.cfg > org.apache.karaf.shell._template.cfg
sed -e 's/1099/ODL_RMI_REGISTRY_PORT/' -e 's/44444/ODL_RMI_SERVER_PORT/' ../etc/org.apache.karaf.management.cfg > org.apache.karaf.management._template.cfg
+sed 's/^#persistent=true/persistent=false/' ../system/org/opendaylight/controller/sal-clustering-config/*/sal-clustering-config-*-datastore.cfg > ../etc/org.opendaylight.controller.cluster.datastore.cfg
+
sed -i'_' -e '1 a\
\
. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh\
.getInstance(),
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.$YangModuleInfoImpl
.getInstance(),
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.$YangModuleInfoImpl
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.$YangModuleInfoImpl
.getInstance(),
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.$YangModuleInfoImpl
.getInstance(),
Network network = createNetwork(networkId);
InstanceIdentifier.Builder<Network> nwIID = InstanceIdentifier.builder(Networks.class).child(Network.class,
new NetworkKey(new NetworkId(networkId)));
- networkTransactionService.put(LogicalDatastoreType.CONFIGURATION, nwIID.build(), network);
+ networkTransactionService.merge(LogicalDatastoreType.CONFIGURATION, nwIID.build(), network);
this.networkTransactionService.commit().get(1, TimeUnit.SECONDS);
LOG.info("{} network layer created successfully.", networkId);
} catch (ExecutionException | TimeoutException | InterruptedException e) {
LOG.info("Spanloss TX is {}", spanLossTx);
// TODO: The span-loss limits should be obtained from optical specifications
- if (spanLossTx == null || spanLossTx.intValue() <= 0 || spanLossTx.intValue() > 27) {
- LOG.error("Power Value is null: spanLossTx null or out of openROADM range ]0,27] {}",
+ if (spanLossTx == null || spanLossTx.intValue() < 0 || spanLossTx.intValue() > 27) {
+ LOG.error("Power Value is null: spanLossTx null or out of openROADM range [0,27] {}",
spanLossTx);
return false;
}
*/
package org.opendaylight.transportpce.pce;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.transportpce.pce.constraints.OperatorConstraints;
import org.opendaylight.transportpce.pce.constraints.PceConstraints;
import org.opendaylight.transportpce.pce.constraints.PceConstraintsCalc;
import org.opendaylight.transportpce.pce.gnpy.GnpyException;
import org.opendaylight.transportpce.pce.graph.PceGraph;
import org.opendaylight.transportpce.pce.networkanalyzer.PceCalculation;
import org.opendaylight.transportpce.pce.networkanalyzer.PceResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PceConstraintMode;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.Endpoints;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescriptionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PceConstraintMode;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.Endpoints;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.HardConstraints;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.ZToADirection;
LOG.error("In pathComputationWithConstraints, nwAnalizer: result = {}", rc);
return;
}
+ OperatorConstraints opConstraints = new OperatorConstraints(networkTransaction);
LOG.info("PceGraph ...");
PceGraph graph = new PceGraph(nwAnalizer.getaendPceNode(), nwAnalizer.getzendPceNode(),
nwAnalizer.getAllPceNodes(), nwAnalizer.getAllPceLinks(), hardConstraints,
- rc, serviceType, networkTransaction, mode);
+ rc, serviceType, networkTransaction, mode, opConstraints.getBitMapConstraint(input.getCustomerName()));
graph.calcPath();
rc = graph.getReturnStructure();
if (!rc.getStatus()) {
--- /dev/null
+/*
+ * Copyright © 2024 Orange, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.pce.constraints;
+
+import java.util.BitSet;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.transportpce.common.fixedflex.GridConstant;
+import org.opendaylight.transportpce.common.fixedflex.GridUtils;
+import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev230526.FrequencyTHz;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.controller.customization.rev230526.controller.parameters.SpectrumFilling;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.controller.customization.rev230526.controller.parameters.spectrum.filling.SpectrumFillingRules;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.controller.customization.rev230526.controller.parameters.spectrum.filling.SpectrumFillingRulesKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ControllerBehaviourSettings;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/*
+ * Class to handle Operator Constraints associated with Specific Engineering rules
+ * as they are defined in the controller-behaviour-settings container of the service
+ * Data-Store.
+ *
+ */
+
+public class OperatorConstraints {
+
+ /* Logging. */
+ private static final Logger LOG = LoggerFactory.getLogger(OperatorConstraints.class);
+ private static final String SPECTRUM_LOG_MSG =
+ "Specific Spectrum filling Rules have been defined for {} the spectrum range {} - {}";
+ private NetworkTransactionService networkTransaction;
+
+ public OperatorConstraints(NetworkTransactionService networkTransaction) {
+
+ this.networkTransaction = networkTransaction;
+
+ }
+
+ public BitSet getBitMapConstraint(String customerName) {
+ BitSet referenceBitSet = new BitSet(GridConstant.EFFECTIVE_BITS);
+ referenceBitSet.set(0, GridConstant.EFFECTIVE_BITS, true);
+ InstanceIdentifier<SpectrumFilling> sfIID =
+ InstanceIdentifier
+ .builder(ControllerBehaviourSettings.class)
+ .child(SpectrumFilling.class)
+ .build();
+
+ try {
+ if (networkTransaction.read(LogicalDatastoreType.CONFIGURATION, sfIID).get().isPresent()) {
+ SpectrumFilling spectrumConstraint = networkTransaction
+ .read(LogicalDatastoreType.CONFIGURATION, sfIID)
+ .get().orElseThrow();
+ if (spectrumConstraint.getSpectrumFillingRules().isEmpty()) {
+ return referenceBitSet;
+ }
+ if (customerName == null) {
+ for (Map.Entry<SpectrumFillingRulesKey, SpectrumFillingRules> rule:
+ spectrumConstraint.getSpectrumFillingRules().entrySet()) {
+ var spectrumRangeOfAppl = rule.getValue().getSpectrumRangeOfAppliance();
+ var dedicatedCustomer = spectrumRangeOfAppl.getDedicatedCustomer();
+ if (dedicatedCustomer == null || dedicatedCustomer.isEmpty()) {
+ continue;
+ }
+ // Spectrum portion is dedicated to some customers that do not include this one
+ FrequencyTHz startFreq = spectrumRangeOfAppl.getStartEdgeFrequency();
+ FrequencyTHz stopFreq = spectrumRangeOfAppl.getStopEdgeFrequency();
+ referenceBitSet.set(
+ GridUtils.getIndexFromFrequency(startFreq.getValue()),
+ GridUtils.getIndexFromFrequency(stopFreq.getValue()),
+ false);
+ LOG.info(SPECTRUM_LOG_MSG,
+ "other customers, preventing the customer from using", startFreq, stopFreq);
+ }
+ return referenceBitSet;
+ }
+
+ for (Map.Entry<SpectrumFillingRulesKey, SpectrumFillingRules> rule:
+ spectrumConstraint.getSpectrumFillingRules().entrySet()) {
+ var spectrumRangeOfAppl = rule.getValue().getSpectrumRangeOfAppliance();
+ FrequencyTHz startFreq = spectrumRangeOfAppl.getStartEdgeFrequency();
+ FrequencyTHz stopFreq = spectrumRangeOfAppl.getStopEdgeFrequency();
+ var nonAuthorizedCustomer = spectrumRangeOfAppl.getNonAuthorizedCustomer();
+ if (nonAuthorizedCustomer != null && nonAuthorizedCustomer.contains(customerName)) {
+ //Customer shall not be put in this spectrum portion
+ referenceBitSet.set(
+ GridUtils.getIndexFromFrequency(startFreq.getValue()),
+ GridUtils.getIndexFromFrequency(stopFreq.getValue()),
+ false);
+ LOG.info(SPECTRUM_LOG_MSG,
+ "customer " + customerName + ", exluding it from", startFreq, stopFreq);
+ continue;
+ }
+ var dedicatedCustomer = spectrumRangeOfAppl.getDedicatedCustomer();
+ if (dedicatedCustomer == null || dedicatedCustomer.isEmpty()) {
+ continue;
+ }
+ if (dedicatedCustomer.contains(customerName)) {
+ // Spectrum portion is dedicated to customers including this one
+ referenceBitSet.set(
+ GridUtils.getIndexFromFrequency(startFreq.getValue()),
+ GridUtils.getIndexFromFrequency(stopFreq.getValue()),
+ true);
+ LOG.info(SPECTRUM_LOG_MSG,
+ "customer " + customerName + ", to dedicate", startFreq, stopFreq + " to it");
+ continue;
+ }
+ // Spectrum portion is dedicated to some customers that do not include this one
+ referenceBitSet.set(
+ GridUtils.getIndexFromFrequency(startFreq.getValue()),
+ GridUtils.getIndexFromFrequency(stopFreq.getValue()),
+ false);
+ LOG.info(SPECTRUM_LOG_MSG,
+ "other customers, preventing the customer from using", startFreq, stopFreq);
+ }
+ return referenceBitSet;
+ }
+ } catch (InterruptedException | ExecutionException e1) {
+ LOG.error("Exception caught handling Spectrum filling Rules ", e1.getCause());
+ }
+ LOG.info("Did not succeed finding any Specific Spectrum filling Rules defined in Configuration Datastore");
+ return referenceBitSet;
+ }
+}
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.transportpce.pce.constraints.PceConstraints.ResourcePair;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.Constraints;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.CoRouting;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.synchronization.info.SynchronizationBuilder;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.synchronization.info.synchronization.Svec;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.synchronization.info.synchronization.SvecBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev230526.FrequencyTHz;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.generic.path.properties.path.properties.PathRouteObjects;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.service.PathRequest;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.synchronization.info.Synchronization;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.HardConstraints;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.AToZDirectionBuilder;
package org.opendaylight.transportpce.pce.graph;
import java.util.ArrayList;
+import java.util.BitSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.opendaylight.transportpce.pce.networkanalyzer.PceNode;
import org.opendaylight.transportpce.pce.networkanalyzer.PceResult;
import org.opendaylight.transportpce.pce.networkanalyzer.PceResult.LocalCause;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PceConstraintMode;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PceConstraintMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
private Double margin = null;
PceConstraints pceHardConstraints;
private PceConstraintMode pceConstraintMode;
+ private BitSet spectrumConstraint;
// results
private PceResult pceResult = null;
public PceGraph(PceNode aendNode, PceNode zendNode, Map<NodeId, PceNode> allPceNodes,
Map<LinkId, PceLink> allPceLinks, PceConstraints pceHardConstraints,PceResult pceResult, String serviceType,
- NetworkTransactionService networkTransactionService, PceConstraintMode mode) {
+ NetworkTransactionService networkTransactionService, PceConstraintMode mode, BitSet spectrumConstraint) {
super();
this.apceNode = aendNode;
this.zpceNode = zendNode;
this.serviceType = serviceType;
this.networkTransactionService = networkTransactionService;
this.pceConstraintMode = mode;
+ this.spectrumConstraint = spectrumConstraint;
LOG.info("In GraphCalculator: A and Z = {} / {} ", aendNode, zendNode);
LOG.debug("In GraphCalculator: allPceNodes size {}, nodes {} ", allPceNodes.size(), allPceNodes);
for (Entry<Integer, GraphPath<String, PceGraphEdge>> entry : allWPaths.entrySet()) {
GraphPath<String, PceGraphEdge> path = entry.getValue();
LOG.info("validating path n° {} - {}", entry.getKey(), path.getVertexList());
- PostAlgoPathValidator papv = new PostAlgoPathValidator(networkTransactionService);
+ PostAlgoPathValidator papv = new PostAlgoPathValidator(networkTransactionService, spectrumConstraint);
pceResult = papv.checkPath(
path, allPceNodes, allPceLinks, pceResult, pceHardConstraints, serviceType, pceConstraintMode);
this.margin = papv.getTpceCalculatedMargin();
import org.opendaylight.transportpce.pce.networkanalyzer.PceLink;
import org.opendaylight.transportpce.pce.networkanalyzer.PceNode;
import org.opendaylight.transportpce.pce.networkanalyzer.PceResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PceConstraintMode;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.SpectrumAssignment;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.SpectrumAssignmentBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PceConstraintMode;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.SpectrumAssignment;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.SpectrumAssignmentBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmLinkType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmNodeType;
private Double tpceCalculatedMargin = 0.0;
private final NetworkTransactionService networkTransactionService;
+ private final BitSet spectrumConstraint;
- public PostAlgoPathValidator(NetworkTransactionService networkTransactionService) {
+ public PostAlgoPathValidator(NetworkTransactionService networkTransactionService, BitSet spectrumConstraint) {
this.networkTransactionService = networkTransactionService;
+ this.spectrumConstraint = spectrumConstraint;
}
@SuppressWarnings("fallthrough")
pceNode.getNodeId(), pceNodeVersion, sltWdthGran, ctralFreqGran);
isFlexGrid = false;
}
+ if (spectrumConstraint != null) {
+ result.and(spectrumConstraint);
+ }
+
LOG.debug("Bitset result {}", result);
return computeBestSpectrumAssignment(result, spectralWidthSlotNumber, isFlexGrid);
}
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.transportpce.pce.service.PathComputationService;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserve;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.TransportpcePceService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserve;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequest;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequest;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.TransportpcePceService;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.Rpc;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.transportpce.common.service.ServiceTypes;
import org.opendaylight.transportpce.pce.PceComplianceCheck;
import org.opendaylight.transportpce.pce.constraints.PceConstraints;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.Endpoints;
+import org.opendaylight.transportpce.pce.networkanalyzer.port.Factory;
+import org.opendaylight.transportpce.pce.networkanalyzer.port.Preference;
+import org.opendaylight.transportpce.pce.networkanalyzer.port.PreferenceFactory;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.Endpoints;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mc.capabilities.McCapabilities;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Link1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1;
case StringConstants.SERVICE_TYPE_OTUC2:
case StringConstants.SERVICE_TYPE_OTUC3:
case StringConstants.SERVICE_TYPE_OTUC4:
+ Factory portPreferenceFactory = new PreferenceFactory();
+ Preference portPreference = portPreferenceFactory.portPreference(input);
// 100GE service and OTU4 service are handled at the openroadm-topology layer
for (Node node : allNodes) {
- validateNode(node);
+ validateNode(node, portPreference);
}
LOG.debug("analyzeNw: allPceNodes size {}", allPceNodes.size());
}
}
- private void validateNode(Node node) {
+ private void validateNode(Node node, Preference portPreference) {
LOG.debug("validateNode: node {} ", node);
// PceNode will be used in Graph algorithm
Node1 node1 = node.augmentation(Node1.class);
return;
}
- if (endPceNode(nodeType, pceNode.getNodeId(), pceNode)) {
+ if (endPceNode(nodeType, pceNode.getNodeId(), pceNode, portPreference)) {
if (this.aendPceNode == null && isAZendPceNode(this.serviceFormatA, pceNode, anodeId, "A")) {
// Added to ensure A-node has a addlink in the topology
List<Link> links = this.allLinks.stream()
}
}
- private Boolean endPceNode(OpenroadmNodeType openroadmNodeType, NodeId nodeId, PceOpticalNode pceNode) {
+ private Boolean endPceNode(OpenroadmNodeType openroadmNodeType, NodeId nodeId, PceOpticalNode pceNode,
+ Preference portPreference) {
switch (openroadmNodeType) {
case SRG:
- pceNode.initSrgTps();
+ pceNode.initSrgTps(portPreference);
this.azSrgs.add(nodeId);
break;
case XPONDER:
import org.opendaylight.transportpce.common.fixedflex.GridConstant;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.pce.SortPortsByName;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.Endpoints;
+import org.opendaylight.transportpce.pce.networkanalyzer.port.Preference;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.Endpoints;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
}
}
- public void initSrgTps() {
+ public void initSrgTps(Preference portPreference) {
this.availableSrgPp.clear();
this.availableSrgCp.clear();
if (!isValid()) {
case SRGTXPP:
case SRGTXRXPP:
LOG.debug("initSrgTpList: SRG-PP tp = {} found", tp.getTpId().getValue());
+ if (!portPreference.isPreferredPort(nodeId.getValue(), tp.getTpId().getValue())) {
+ LOG.warn("initSrgTpList: SRG-PP tp = {} is rejected by the client", tp.getTpId().getValue());
+ break;
+ }
if (isTerminationPointAvailable(nttp1)) {
LOG.debug("initSrgTpList: adding SRG-PP tp '{}'", tp.getTpId().getValue());
this.availableSrgPp.put(tp.getTpId().getValue(), cntp1.getTpType());
--- /dev/null
+/*
+ * Copyright (c) 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.networkanalyzer.port;
+
+import java.util.Map;
+import java.util.Set;
+
+public class ClientPreference implements Preference {
+
+ Map<String, Set<String>> nodePortPreference;
+
+ public ClientPreference(Map<String, Set<String>> nodePortPreference) {
+ this.nodePortPreference = nodePortPreference;
+ }
+
+ @Override
+ public boolean isPreferredPort(String node, String portName) {
+
+ //If there is no preferred port registered for the node, it means
+ //the client has no preference regarding the node.
+ //Therefore, we'll treat the node as it was preferred to
+ //prevent it from NOT being used.
+ return !nodePortPreference.containsKey(node) || nodePortPreference.get(node).contains(portName);
+
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.networkanalyzer.port;
+
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+
+public interface Factory {
+
+ /**
+ * Extracting preferred ports from pathComputationRequestInput.
+ *
+ * <p>
+ * This is the recommended method of determining if a node/port combination
+ * is preferred by the client.
+ *
+ * <p>
+ * Pseudocode example:
+ * <pre>
+ * Factory.portPreference(PCRI).preferredPort("ROADM-B-SRG1", "SRG1-PP1-TXRX");
+ * </pre>
+ *
+ * @return Client port preference
+ */
+ Preference portPreference(PathComputationRequestInput pathComputationRequestInput);
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.networkanalyzer.port;
+
+/**
+ * This class represents a state where the client has no port preference.
+ * In essence, all ports on all nodes will therefore be treated as 'preferred'
+ * when queried.
+ *
+ * <p>
+ * Usage of this class is of sorts the 'backwards compatible' approach. Meaning,
+ * intended to offer a path for the application to behave as it did
+ * prior to implementing client port preference.
+ */
+public class NoPreference implements Preference {
+ @Override
+ public boolean isPreferredPort(String node, String portName) {
+ return true;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.networkanalyzer.port;
+
+public interface Preference {
+
+ /**
+ * Return true if the portName is among the ports preferred by the client.
+ */
+ boolean isPreferredPort(String node, String portName);
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.networkanalyzer.port;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.port.Port;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class PreferenceFactory implements Factory {
+
+ private static final Logger LOG = LoggerFactory.getLogger(PreferenceFactory.class);
+
+ private String portNamePattern;
+
+ public PreferenceFactory() {
+ this.portNamePattern = "(?i)SRG\\d+-PP\\d+-(TXRX|TX|RX)";
+ }
+
+ @Override
+ public Preference portPreference(PathComputationRequestInput pathComputationRequestInput) {
+
+ Map<String, Set<String>> map = nodePortMap(pathComputationRequestInput);
+
+ if (map.isEmpty()) {
+ LOG.debug("No port preference found in path computation request.");
+ return new NoPreference();
+ }
+
+ LOG.debug("Port preference in path computation request: {}." , map);
+ return new ClientPreference(map);
+ }
+
+ /**
+ * Create a key value mapper from PCRI where key is the node and the value is
+ * a unique list of port names.
+ *
+ * @return Client port preference map
+ */
+ Map<String, Set<String>> nodePortMap(PathComputationRequestInput pathComputationRequestInput) {
+
+ Map<String, Set<String>> mapper = new HashMap<>();
+
+ ServiceAEnd serviceAEnd = pathComputationRequestInput.getServiceAEnd();
+ if (serviceAEnd != null) {
+
+ RxDirection rxAzDirection = serviceAEnd.getRxDirection();
+ if (rxAzDirection != null) {
+
+ Port rxAZport = rxAzDirection.getPort();
+ if (rxAZport != null) {
+ add(rxAZport.getPortDeviceName(), rxAZport.getPortName(), mapper);
+ }
+ }
+
+ TxDirection txAzDirection = serviceAEnd.getTxDirection();
+ if (txAzDirection != null) {
+
+ Port txAZport = txAzDirection.getPort();
+ if (txAZport != null) {
+ add(txAZport.getPortDeviceName(), txAZport.getPortName(), mapper);
+ }
+ }
+ }
+
+ ServiceZEnd serviceZEnd = pathComputationRequestInput.getServiceZEnd();
+ if (serviceZEnd != null) {
+
+ RxDirection rxZaDirection = serviceZEnd.getRxDirection();
+ if (rxZaDirection != null) {
+
+ Port rxZAport = rxZaDirection.getPort();
+ if (rxZAport != null) {
+ add(rxZAport.getPortDeviceName(), rxZAport.getPortName(), mapper);
+ }
+ }
+
+ TxDirection txZaDirection = serviceZEnd.getTxDirection();
+ if (txZaDirection != null) {
+
+ Port txZAport = txZaDirection.getPort();
+ if (txZAport != null) {
+ add(txZAport.getPortDeviceName(), txZAport.getPortName(), mapper);
+ }
+ }
+ }
+
+ return mapper;
+ }
+
+ /**
+ * Add node/port name to key value map. Mutable method, modifies the argument nodePortMap.
+ */
+ boolean add(String node, String port, Map<String, Set<String>> nodePortMap) {
+
+ if (node == null || port == null) {
+ return false;
+ }
+
+ String nodeTrimmed = node.trim();
+ String portTrimmed = port.trim();
+
+ if (nodeTrimmed.isEmpty() || portTrimmed.isEmpty()) {
+ return false;
+ }
+
+ if (!portTrimmed.matches(portNamePattern)) {
+ LOG.warn("Preferred port name '{}' on node {} doesn't match pattern '{}'",
+ portTrimmed,
+ nodeTrimmed,
+ portNamePattern
+ );
+ }
+
+ if (nodePortMap.containsKey(nodeTrimmed)) {
+ boolean added = nodePortMap.get(nodeTrimmed).add(portTrimmed);
+ if (added) {
+ LOG.debug("Preferred port '{}' for node '{}' registered.", portTrimmed, nodeTrimmed);
+ } else {
+ LOG.debug("Failed registering port '{}' for node '{}'.", portTrimmed, nodeTrimmed);
+ }
+ return added;
+ }
+
+ nodePortMap.put(nodeTrimmed, new HashSet<>(Arrays.asList(portTrimmed)));
+
+ return true;
+ }
+}
package org.opendaylight.transportpce.pce.service;
import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutput;
/**
* Path Computation Service.
import org.opendaylight.transportpce.pce.gnpy.GnpyResult;
import org.opendaylight.transportpce.pce.gnpy.consumer.GnpyConsumer;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.result.Response;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.ServicePathRpcResultBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.gnpy.GnpyResponse;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.gnpy.GnpyResponseBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.gnpy.gnpy.response.response.type.NoPathCaseBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.gnpy.gnpy.response.response.type.PathCaseBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceZEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.performance.PathPropertiesBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.performance.path.properties.PathMetric;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.performance.path.properties.PathMetricBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescriptionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.ServicePathRpcResult;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.ServicePathRpcResultBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.gnpy.GnpyResponse;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.gnpy.GnpyResponseBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.gnpy.gnpy.response.response.type.NoPathCaseBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.gnpy.gnpy.response.response.type.PathCaseBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.performance.PathPropertiesBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.performance.path.properties.PathMetric;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.performance.path.properties.PathMetricBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.ZToADirection;
*/
package org.opendaylight.transportpce.pce;
-
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.when;
+import java.util.concurrent.ExecutionException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.opendaylight.transportpce.pce.gnpy.consumer.GnpyConsumer;
import org.opendaylight.transportpce.pce.gnpy.consumer.GnpyConsumerImpl;
import org.opendaylight.transportpce.pce.utils.PceTestData;
-import org.opendaylight.transportpce.pce.utils.PceTestUtils;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.MappingBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.network.nodes.NodeInfoBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.NodeTypes;
+
@ExtendWith(MockitoExtension.class)
public class PceSendingPceRPCsTest extends AbstractTest {
@BeforeEach
- void setUp() {
+ void setUp() throws InterruptedException, ExecutionException {
this.dataBroker = getNewDataBroker();
networkTransaction = new NetworkTransactionImpl(this.dataBroker);
- PceTestUtils.writeNetworkInDataStore(this.dataBroker);
gnpyConsumer = new GnpyConsumerImpl(
"http://localhost:9998", "mylogin", "mypassword", getDataStoreContextUtil().getBindingDOMCodecServices());
pceSendingPceRPCs = new PceSendingPceRPCs(
assertNull(pceSendingPceRPCs.getMessage());
}
+
@Test
void responseCodeTest() {
assertNull(pceSendingPceRPCs.getResponseCode());
--- /dev/null
+/*
+ * Copyright © 2024 Orange Labs, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.pce.constraints;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.nio.charset.StandardCharsets;
+import java.util.BitSet;
+import java.util.concurrent.ExecutionException;
+import org.eclipse.jdt.annotation.NonNull;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.transportpce.common.fixedflex.GridConstant;
+import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
+import org.opendaylight.transportpce.pce.graph.PceGraphTest;
+import org.opendaylight.transportpce.pce.utils.PceTestUtils;
+import org.opendaylight.transportpce.test.AbstractTest;
+import org.opendaylight.transportpce.test.converter.DataObjectConverter;
+import org.opendaylight.transportpce.test.converter.JSONDataObjectConverter;
+//import org.opendaylight.yang.gen.v1.http.org.openroadm.controller.customization.rev230526.controller.parameters
+//.SpectrumFilling;
+//import org.opendaylight.yang.gen.v1.http.org.openroadm.controller.customization.rev230526.controller.parameters
+//.spectrum.filling.SpectrumFillingRules;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ControllerBehaviourSettings;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+@ExtendWith(MockitoExtension.class)
+public class OperatorConstraintsTest extends AbstractTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(PceGraphTest.class);
+ private NetworkTransactionImpl networkTransaction;
+ private static final String SPEC_FILLING_FILE = "src/test/resources/spectrum-filling-rule1.json";
+// private static SpectrumFillingRules sfRule;
+ private static ControllerBehaviourSettings cbSettings;
+ private OperatorConstraints opConstraints;
+ @Mock
+ private BindingDOMCodecServices bindingDOMCodecServices;
+ private DataBroker dataBroker;
+
+ @BeforeEach
+ void setUp() throws InterruptedException, ExecutionException {
+ this.dataBroker = getNewDataBroker();
+ networkTransaction = new NetworkTransactionImpl(this.dataBroker);
+ opConstraints = new OperatorConstraints(networkTransaction);
+ PceTestUtils.writeNetworkInDataStore(this.dataBroker);
+ DataObjectConverter dataObjectConverter = JSONDataObjectConverter
+ .createWithDataStoreUtil(getDataStoreContextUtil());
+ // The Spectrum filling rules associated with CustomerProfileLamda1 is populated from a file in the Data Store
+ try (Reader reader = new FileReader(SPEC_FILLING_FILE, StandardCharsets.UTF_8)) {
+ NormalizedNode normalizedNode = dataObjectConverter.transformIntoNormalizedNode(reader).orElseThrow();
+ cbSettings = (ControllerBehaviourSettings) getDataStoreContextUtil()
+ .getBindingDOMCodecServices()
+ .fromNormalizedNode(
+ YangInstanceIdentifier.of(ControllerBehaviourSettings.QNAME), normalizedNode)
+ .getValue();
+ InstanceIdentifier<ControllerBehaviourSettings> sfIID =
+ InstanceIdentifier
+ .builder(ControllerBehaviourSettings.class)
+// .child(SpectrumFilling.class)
+// .child(SpectrumFillingRules.class)
+ .build();
+ @NonNull
+ WriteTransaction newWriteOnlyTransaction = dataBroker.newWriteOnlyTransaction();
+ newWriteOnlyTransaction.put(LogicalDatastoreType.CONFIGURATION, sfIID, cbSettings);
+ newWriteOnlyTransaction.commit().get();
+ } catch (IOException e) {
+ LOG.error("Cannot load Spectrum-Filling-Rules in Service DS ", e);
+ fail("Cannot load Spectrum-Filling-Rules");
+ }
+ }
+
+
+ @Test
+ void checkSpecttrumFilling() {
+ BitSet referenceBitSet = new BitSet(GridConstant.EFFECTIVE_BITS);
+ referenceBitSet.set(0, GridConstant.EFFECTIVE_BITS, false);
+ referenceBitSet.set(0, 8, true);
+ assertEquals(referenceBitSet, opConstraints.getBitMapConstraint("CustomerProfileLamda1"));
+ referenceBitSet.set(8, GridConstant.EFFECTIVE_BITS, true);
+ referenceBitSet.set(0, 8, false);
+ assertEquals(referenceBitSet, opConstraints.getBitMapConstraint("otherCustomer"));
+ }
+
+}
import org.opendaylight.transportpce.test.converter.JSONDataObjectConverter;
import org.opendaylight.transportpce.test.stub.MountPointServiceStub;
import org.opendaylight.transportpce.test.stub.MountPointStub;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PceConstraintMode;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PceConstraintMode;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.port.PortBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev230526.OpenroadmVersionType;
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_100GE_T, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_100GE_T, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), true);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(3.0919881995992924));
}
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_OTUC2, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_OTUC2, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), true);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(1.1559963686478447));
}
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_OTUC3, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_OTUC3, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), true);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(0.3351048800367167));
}
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_400GE, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_400GE, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), false);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(0.0));
}
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_400GE, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_400GE, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), true);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(1.4432381874659086));
}
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_OTUC4, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_OTUC4, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), true);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(1.4432381874659086));
}
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_OTUC4, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_OTUC4, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), true);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(0.0));
}
pceCalc.retrievePceNetwork();
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_100GE_T, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_100GE_T, netTransServ, PceConstraintMode.Loose, null);
assertEquals(pceGraph.calcPath(), true);
assertEquals(Optional.ofNullable(pceGraph.getmargin()), Optional.ofNullable(3.0919881995992924));
}
pceHardConstraints.setPceMetrics(PceMetric.PropagationDelay);
pceGraph = new PceGraph(pceCalc.getaendPceNode(), pceCalc.getzendPceNode(),
pceCalc.getAllPceNodes(), pceCalc.getAllPceLinks(), pceHardConstraints,
- rc, StringConstants.SERVICE_TYPE_100GE_T, netTransServ, PceConstraintMode.Loose);
+ rc, StringConstants.SERVICE_TYPE_100GE_T, netTransServ, PceConstraintMode.Loose, null);
pceGraph.setConstrains(pceHardConstraints);
assertEquals(pceGraph.calcPath(), true);
new NodeId("optical"), pceOtnNode,
new NodeId("optical2"), pceOtnNode2);
return new PceGraph(pceOtnNode, pceOtnNode2, allPceNodes, allPceLinks, pceHardConstraints,
- new PceResult(), type, null, PceConstraintMode.Loose);
+ new PceResult(), type, null, PceConstraintMode.Loose, null);
}
private void saveOpenRoadmNetwork(Network network, String networkId)
import org.opendaylight.transportpce.pce.utils.PceTestUtils;
import org.opendaylight.transportpce.pce.utils.TransactionUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveInputBuilder;
@ExtendWith(MockitoExtension.class)
public class PceServiceRPCImplTest extends AbstractTest {
import org.opendaylight.transportpce.pce.utils.PceTestUtils;
import org.opendaylight.transportpce.pce.utils.TransactionUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.MappingBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.network.Nodes;
import org.opendaylight.transportpce.common.fixedflex.GridConstant;
import org.opendaylight.transportpce.common.fixedflex.GridUtils;
import org.opendaylight.transportpce.common.mapping.PortMapping;
+import org.opendaylight.transportpce.pce.networkanalyzer.port.NoPreference;
+import org.opendaylight.transportpce.pce.networkanalyzer.port.Preference;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1Builder;
private String serviceType = "100GE";
@Mock
private PortMapping portMapping;
+ private final Preference portPreference = new NoPreference();
@BeforeEach
void setUp() {
pceOpticalNode = new PceOpticalNode(deviceNodeId, serviceType, portMapping, node,
OpenroadmNodeType.ROADM, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
- pceOpticalNode.initSrgTps();
+ pceOpticalNode.initSrgTps(portPreference);
pceOpticalNode.initXndrTps(ServiceFormat.OMS);
pceOpticalNode.initFrequenciesBitSet();
assertFalse(pceOpticalNode.isValid());
pceOpticalNode = new PceOpticalNode(null, null, null, node,
OpenroadmNodeType.ROADM, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
- pceOpticalNode.initSrgTps();
+ pceOpticalNode.initSrgTps(portPreference);
assertNull(pceOpticalNode.getRdmSrgClient("7", StringConstants.SERVICE_DIRECTION_AZ));
assertFalse(pceOpticalNode.isValid());
assertNull(pceOpticalNode.getBitSetData());
pceOpticalNode = new PceOpticalNode(null, null, null, specificNode,
OpenroadmNodeType.ROADM, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
- pceOpticalNode.initSrgTps();
+ pceOpticalNode.initSrgTps(portPreference);
pceOpticalNode.initFrequenciesBitSet();
pceOpticalNode.initXndrTps(ServiceFormat.OMS);
assertNull(pceOpticalNode.getRdmSrgClient("7" ,StringConstants.SERVICE_DIRECTION_AZ));
pceOpticalNode = new PceOpticalNode(null, null, null, node,
OpenroadmNodeType.DEGREE, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
- pceOpticalNode.initSrgTps();
+ pceOpticalNode.initSrgTps(portPreference);
assertNull(pceOpticalNode.getRdmSrgClient("7" ,StringConstants.SERVICE_DIRECTION_AZ));
assertFalse(pceOpticalNode.isValid());
assertNull(pceOpticalNode.getBitSetData());
pceOpticalNode = new PceOpticalNode(null, null, null, specificNode,
OpenroadmNodeType.ROADM, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
- pceOpticalNode.initSrgTps();
+ pceOpticalNode.initSrgTps(portPreference);
assertFalse(pceOpticalNode.isValid());
assertNull(pceOpticalNode.getBitSetData());
assertTrue(pceOpticalNode.checkTP("testTP"));
pceOpticalNode = new PceOpticalNode(null, null, null, node,
OpenroadmNodeType.ROADM, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
- pceOpticalNode.initSrgTps();
+ pceOpticalNode.initSrgTps(portPreference);
assertNull(pceOpticalNode.getRdmSrgClient("2" ,StringConstants.SERVICE_DIRECTION_AZ));
assertFalse(pceOpticalNode.isValid());
assertNull(pceOpticalNode.getBitSetData());
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.networkanalyzer.port;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class ClientPreferenceTest {
+
+ @Test
+ void preferredPort_returnTrue() {
+
+ Map<String, Set<String>> nodePortPreference = new HashMap<>();
+ nodePortPreference.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TXRX"));
+
+ Preference clientPreference = new ClientPreference(nodePortPreference);
+
+ Assertions.assertTrue(clientPreference.isPreferredPort("ROADM-B-SRG1", "SRG1-PP1-TXRX"));
+ }
+
+ /**
+ * The client prefer to use SRG1-PP1-TXRX on ROADM-B-SRG1.
+ * Therefore, preferredPort returns false on SRG1-PP2-TXRX.
+ */
+ @Test
+ void nonPreferredPort_returnFalse() {
+
+ Map<String, Set<String>> nodePortPreference = new HashMap<>();
+ nodePortPreference.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TXRX"));
+
+ Preference clientPreference = new ClientPreference(nodePortPreference);
+
+ Assertions.assertFalse(clientPreference.isPreferredPort("ROADM-B-SRG1", "SRG1-PP2-TXRX"));
+ }
+
+ /**
+ * In this scenario ROADM-A-SRG1 is missing from the client preferred list.
+ * We treat this as the client has no opinion on what port
+ * to use on ROADM-A-SRG1. Meaning, as far as the client goes, all
+ * ports on ROADM-A-SRG1 are fine.
+ */
+ @Test
+ void nodeMissingInPreferredList_returnTrue() {
+
+ Map<String, Set<String>> nodePortPreference = new HashMap<>();
+ nodePortPreference.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TXRX"));
+
+ Preference clientPreference = new ClientPreference(nodePortPreference);
+
+ Assertions.assertTrue(clientPreference.isPreferredPort("ROADM-A-SRG1", "SRG1-PP2-TXRX"));
+
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.pce.networkanalyzer.port;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.port.PortBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirection;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirection;
+
+class PreferenceFactoryTest {
+
+ @Test
+ void emptyPathComputationRequest_returnEmptyHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceAEndRxDirectionWithoutDeviceAndPort_returnEmptyHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceAEnd serviceAEnd = Mockito.mock(ServiceAEnd.class);
+ RxDirection rxDirection = Mockito.mock(RxDirection.class);
+
+ Mockito.when(rxDirection.getPort()).thenReturn(new PortBuilder().build());
+ Mockito.when(serviceAEnd.getRxDirection()).thenReturn(rxDirection);
+ Mockito.when(pathComputationRequestInput.getServiceAEnd()).thenReturn(serviceAEnd);
+
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceAEndRxDirectionWithoutPort_returnEmptyHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceAEnd serviceAEnd = Mockito.mock(ServiceAEnd.class);
+ RxDirection rxDirection = Mockito.mock(RxDirection.class);
+
+ Mockito.when(rxDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .build()
+ );
+ Mockito.when(serviceAEnd.getRxDirection()).thenReturn(rxDirection);
+ Mockito.when(pathComputationRequestInput.getServiceAEnd()).thenReturn(serviceAEnd);
+
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceAEndRxDirectionTxRx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceAEnd serviceAEnd = Mockito.mock(ServiceAEnd.class);
+ RxDirection rxDirection = Mockito.mock(RxDirection.class);
+
+ Mockito.when(rxDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("SRG1-PP1-TXRX")
+ .build()
+ );
+ Mockito.when(serviceAEnd.getRxDirection()).thenReturn(rxDirection);
+ Mockito.when(pathComputationRequestInput.getServiceAEnd()).thenReturn(serviceAEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TXRX"));
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceAEndRxDirectionTx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceAEnd serviceAEnd = Mockito.mock(ServiceAEnd.class);
+ RxDirection rxDirection = Mockito.mock(RxDirection.class);
+
+ Mockito.when(rxDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("SRG1-PP1-TX")
+ .build()
+ );
+ Mockito.when(serviceAEnd.getRxDirection()).thenReturn(rxDirection);
+ Mockito.when(pathComputationRequestInput.getServiceAEnd()).thenReturn(serviceAEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TX"));
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceAEndRxDirectionRx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceAEnd serviceAEnd = Mockito.mock(ServiceAEnd.class);
+ TxDirection txDirection = Mockito.mock(TxDirection.class);
+
+ Mockito.when(txDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("SRG1-PP1-RX")
+ .build()
+ );
+ Mockito.when(serviceAEnd.getTxDirection()).thenReturn(txDirection);
+ Mockito.when(pathComputationRequestInput.getServiceAEnd()).thenReturn(serviceAEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("SRG1-PP1-RX"));
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceZEndRx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceZEnd serviceZEnd = Mockito.mock(ServiceZEnd.class);
+ RxDirection rxDirection = Mockito.mock(RxDirection.class);
+
+ Mockito.when(rxDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("SRG1-PP1-TXRX")
+ .build()
+ );
+ Mockito.when(serviceZEnd.getRxDirection()).thenReturn(rxDirection);
+ Mockito.when(pathComputationRequestInput.getServiceZEnd()).thenReturn(serviceZEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TXRX"));
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceZEndTxDirectionTxRx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceZEnd serviceZEnd = Mockito.mock(ServiceZEnd.class);
+ TxDirection txDirection = Mockito.mock(TxDirection.class);
+
+ Mockito.when(txDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("SRG1-PP1-TXRX")
+ .build()
+ );
+ Mockito.when(serviceZEnd.getTxDirection()).thenReturn(txDirection);
+ Mockito.when(pathComputationRequestInput.getServiceZEnd()).thenReturn(serviceZEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TXRX"));
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceZEndTxDirectionTx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceZEnd serviceZEnd = Mockito.mock(ServiceZEnd.class);
+ TxDirection txDirection = Mockito.mock(TxDirection.class);
+
+ Mockito.when(txDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("SRG1-PP1-TX")
+ .build()
+ );
+ Mockito.when(serviceZEnd.getTxDirection()).thenReturn(txDirection);
+ Mockito.when(pathComputationRequestInput.getServiceZEnd()).thenReturn(serviceZEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("SRG1-PP1-TX"));
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathComputationRequestServiceZEndTxDirectionRx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceZEnd serviceZEnd = Mockito.mock(ServiceZEnd.class);
+ TxDirection txDirection = Mockito.mock(TxDirection.class);
+
+ Mockito.when(txDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("SRG1-PP1-RX")
+ .build()
+ );
+ Mockito.when(serviceZEnd.getTxDirection()).thenReturn(txDirection);
+ Mockito.when(pathComputationRequestInput.getServiceZEnd()).thenReturn(serviceZEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("SRG1-PP1-RX"));
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathEmptyComputationRequestServiceZEndTx_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceZEnd serviceZEnd = Mockito.mock(ServiceZEnd.class);
+ TxDirection txDirection = Mockito.mock(TxDirection.class);
+
+ Mockito.when(txDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName(" ")
+ .build()
+ );
+ Mockito.when(serviceZEnd.getTxDirection()).thenReturn(txDirection);
+ Mockito.when(pathComputationRequestInput.getServiceZEnd()).thenReturn(serviceZEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void pathUnexpectedPortName_returnHashmap() {
+
+ PathComputationRequestInput pathComputationRequestInput = Mockito.mock(PathComputationRequestInput.class);
+ ServiceZEnd serviceZEnd = Mockito.mock(ServiceZEnd.class);
+ TxDirection txDirection = Mockito.mock(TxDirection.class);
+
+ Mockito.when(txDirection.getPort()).thenReturn(
+ new PortBuilder()
+ .setPortDeviceName("ROADM-B-SRG1")
+ .setPortName("FUBAR")
+ .build()
+ );
+ Mockito.when(serviceZEnd.getTxDirection()).thenReturn(txDirection);
+ Mockito.when(pathComputationRequestInput.getServiceZEnd()).thenReturn(serviceZEnd);
+
+ Map<String, Set<String>> expected = new HashMap<>();
+ expected.put("ROADM-B-SRG1", Set.of("FUBAR"));
+
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+ Assertions.assertEquals(expected, portPreferenceFactory.nodePortMap(pathComputationRequestInput));
+
+ }
+
+ @Test
+ void addingMultiplePort() {
+
+ PreferenceFactory portPreferenceFactory = new PreferenceFactory();
+ Map<String, Set<String>> mapper = new HashMap<>();
+
+ //New ports
+ Assertions.assertTrue(portPreferenceFactory.add("ROADM-B-SRG1", "SRG1-PP1-TXRX", mapper));
+ Assertions.assertTrue(portPreferenceFactory.add("ROADM-B-SRG1", "SRG1-PP2-TXRX", mapper));
+ Assertions.assertTrue(portPreferenceFactory.add("ROADM-B-SRG1", "SRG1-PP3-RX", mapper));
+ Assertions.assertTrue(portPreferenceFactory.add("ROADM-B-SRG1", "SRG1-PP3-TX", mapper));
+
+ //This port already exists, should return false.
+ Assertions.assertFalse(portPreferenceFactory.add("ROADM-B-SRG1", "SRG1-PP2-TXRX", mapper));
+
+ Assertions.assertEquals(
+ Set.of("SRG1-PP1-TXRX", "SRG1-PP2-TXRX", "SRG1-PP3-RX", "SRG1-PP3-TX"),
+ mapper.get("ROADM-B-SRG1")
+ );
+ }
+}
\ No newline at end of file
import java.util.Map;
import java.util.Set;
import org.opendaylight.transportpce.common.ResponseCodes;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceZEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.EndpointsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.EndpointsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommon;
.setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co
- .routing.ServiceIdentifierListKey("Some existing-service"),
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service").build()))
.build())
.build())
.setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co
- .routing.ServiceIdentifierListKey("Some existing-service"),
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service").build()))
.build())
.build())
.setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co
- .routing.ServiceIdentifierListKey("Some existing-service"),
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service").build()))
.build())
.build())
.setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co
- .routing.ServiceIdentifierListKey("Some existing-service"),
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service").build()))
.build())
.build())
.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder()
.setRequestId("request1")
.build())
- .setServiceAEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ .setServiceAEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceAEndBuilder()
- .setServiceFormat(ServiceFormat.Ethernet)
- .setServiceRate(Uint32.valueOf(100))
- .setClli("clli11")
- .setNodeId("XPONDER-2-2")
- .setTxDirection(new TxDirectionBuilder()
- .setPort(new PortBuilder()
- .setPortDeviceName("Some port-device-name")
- .setPortType("Some port-type")
- .setPortName("Some port-name")
- .setPortRack("Some port-rack")
- .setPortShelf("Some port-shelf")
- .setPortSlot("Some port-slot")
- .setPortSubSlot("Some port-sub-slot")
- .build())
- .build())
- .setRxDirection(new RxDirectionBuilder()
- .setPort(new PortBuilder()
- .setPortDeviceName("Some port-device-name")
- .setPortType("Some port-type")
- .setPortName("Some port-name")
- .setPortRack("Some port-rack")
- .setPortShelf("Some port-shelf")
- .setPortSlot("Some port-slot")
- .setPortSubSlot("Some port-sub-slot")
- .build())
- .build())
- .build())
- .setServiceZEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ .setServiceFormat(ServiceFormat.Ethernet)
+ .setServiceRate(Uint32.valueOf(100))
+ .setClli("clli11")
+ .setNodeId("XPONDER-2-2")
+ .setTxDirection(new TxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("Some port-device-name")
+ .setPortType("Some port-type")
+ .setPortName("Some port-name")
+ .setPortRack("Some port-rack")
+ .setPortShelf("Some port-shelf")
+ .setPortSlot("Some port-slot")
+ .setPortSubSlot("Some port-sub-slot")
+ .build())
+ .build())
+ .setRxDirection(new RxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("Some port-device-name")
+ .setPortType("Some port-type")
+ .setPortName("Some port-name")
+ .setPortRack("Some port-rack")
+ .setPortShelf("Some port-shelf")
+ .setPortSlot("Some port-slot")
+ .setPortSubSlot("Some port-sub-slot")
+ .build())
+ .build())
+ .build())
+ .setServiceZEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceZEndBuilder()
- .setServiceFormat(ServiceFormat.Ethernet)
- .setServiceRate(Uint32.valueOf(0))
- .setClli("Some clli11")
- .setNodeId("XPONDER-1-2")
- .setTxDirection(new TxDirectionBuilder()
- .setPort(new PortBuilder()
- .setPortDeviceName("Some port-device-name")
- .setPortType("Some port-type")
- .setPortName("Some port-name")
- .setPortRack("Some port-rack")
- .setPortShelf("Some port-shelf")
- .setPortSlot("Some port-slot")
- .setPortSubSlot("Some port-sub-slot")
- .build())
- .build())
- .setRxDirection(new RxDirectionBuilder()
- .setPort(new PortBuilder()
- .setPortDeviceName("Some port-device-name")
- .setPortType("Some port-type")
- .setPortName("Some port-name")
- .setPortRack("Some port-rack")
- .setPortShelf("Some port-shelf")
- .setPortSlot("Some port-slot")
- .setPortSubSlot("Some port-sub-slot")
- .build())
- .build())
- .build())
+ .setServiceFormat(ServiceFormat.Ethernet)
+ .setServiceRate(Uint32.valueOf(0))
+ .setClli("Some clli11")
+ .setNodeId("XPONDER-1-2")
+ .setTxDirection(new TxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("Some port-device-name")
+ .setPortType("Some port-type")
+ .setPortName("Some port-name")
+ .setPortRack("Some port-rack")
+ .setPortShelf("Some port-shelf")
+ .setPortSlot("Some port-slot")
+ .setPortSubSlot("Some port-sub-slot")
+ .build())
+ .build())
+ .setRxDirection(new RxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName("Some port-device-name")
+ .setPortType("Some port-type")
+ .setPortName("Some port-name")
+ .setPortRack("Some port-rack")
+ .setPortShelf("Some port-shelf")
+ .setPortSlot("Some port-slot")
+ .setPortSubSlot("Some port-sub-slot")
+ .build())
+ .build())
+ .build())
.setHardConstraints(new HardConstraintsBuilder()
- .setCustomerCode(Set.of("Some customer-code"))
- .setCoRouting(new CoRoutingBuilder()
- .setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1
- .http.org.openroadm.routing.constraints.rev221209
- .constraints.co.routing.ServiceIdentifierListKey("test"),
- new ServiceIdentifierListBuilder().setServiceIdentifier("test").build()))
- .build())
+ .setCustomerCode(Set.of("Some customer-code"))
+ .setCoRouting(new CoRoutingBuilder()
+ .setServiceIdentifierList(Map.of(
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("test"),
+ new ServiceIdentifierListBuilder().setServiceIdentifier("test").build()))
.build())
+ .build())
.setSoftConstraints(new SoftConstraintsBuilder()
- .setCustomerCode(Set.of("Some customer-code"))
- .setCoRouting(new CoRoutingBuilder()
- .setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1
- .http.org.openroadm.routing.constraints.rev221209
- .constraints.co.routing.ServiceIdentifierListKey("test"),
- new ServiceIdentifierListBuilder().setServiceIdentifier("test").build()))
- .build())
+ .setCustomerCode(Set.of("Some customer-code"))
+ .setCoRouting(new CoRoutingBuilder()
+ .setServiceIdentifierList(Map.of(
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("test"),
+ new ServiceIdentifierListBuilder().setServiceIdentifier("test").build()))
.build())
+ .build())
.setEndpoints(new EndpointsBuilder()
- .setAEndTp("AendTP")
- .setZEndTp("ZendTP")
- .build())
+ .setAEndTp("AendTP")
+ .setZEndTp("ZendTP")
+ .build())
.build();
}
.setRequestId("request 1")
.build())
.setPceRoutingMetric(PceMetric.HopCount)
- .setServiceAEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ .setServiceAEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceAEndBuilder()
.setServiceRate(Uint32.valueOf(100))
.setServiceFormat(ServiceFormat.Ethernet)
.setNodeId("XPONDER-1-2")
.build())
- .setServiceZEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ .setServiceZEnd(new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceZEndBuilder()
.setServiceRate(Uint32.valueOf(0))
.setServiceFormat(ServiceFormat.Ethernet)
.setDiversity(new DiversityBuilder()
.setServiceIdentifierList(Map.of(
new ServiceIdentifierListKey(base.getServiceName()),
- new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.diversity
- .existing.service.constraints.ServiceIdentifierListBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .diversity.existing.service.constraints.ServiceIdentifierListBuilder()
.setServiceIdentifier(base.getServiceName())
.setServiceApplicability(new ServiceApplicabilityBuilder()
.setNode(true)
.setCustomer("Customer")
.setServiceName("service 1")
.setServiceAEnd(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.create.input
- .ServiceAEndBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
+ .service.create.input.ServiceAEndBuilder()
.setClli("clli")
.setServiceRate(Uint32.valueOf(0))
.setNodeId(new NodeIdType("XPONDER-1-2"))
.setTxDirection(Map.of(
new TxDirectionKey(Uint8.ZERO),
- new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service
- .endpoint.TxDirectionBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526
+ .service.endpoint.TxDirectionBuilder()
.setPort(new PortBuilder().build())
.build()))
.setRxDirection(Map.of(
new RxDirectionKey(Uint8.ZERO),
- new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service
- .endpoint.RxDirectionBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526
+ .service.endpoint.RxDirectionBuilder()
.setPort(new PortBuilder().build())
.build()))
.build())
.setServiceZEnd(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.create.input
- .ServiceZEndBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
+ .service.create.input.ServiceZEndBuilder()
.setClli("clli")
.setServiceRate(Uint32.valueOf(0))
.setNodeId(new NodeIdType("XPONDER-3-2"))
.setTxDirection(Map.of(
new TxDirectionKey(Uint8.ZERO),
- new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service
- .endpoint.TxDirectionBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526
+ .service.endpoint.TxDirectionBuilder()
.setPort(new PortBuilder().build())
.build()))
.setRxDirection(Map.of(
new RxDirectionKey(Uint8.ZERO),
- new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service
- .endpoint.RxDirectionBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526
+ .service.endpoint.RxDirectionBuilder()
.setPort(new PortBuilder().build())
.build()))
.build())
.setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co
- .routing.ServiceIdentifierListKey("Some existing-service"),
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service").build()))
.build())
.build())
.setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co
- .routing.ServiceIdentifierListKey("Some existing-service"),
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209
+ .constraints.co.routing.ServiceIdentifierListKey("Some existing-service"),
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service").build()))
.build())
.build())
import org.opendaylight.transportpce.test.DataStoreContext;
import org.opendaylight.transportpce.test.converter.DataObjectConverter;
import org.opendaylight.transportpce.test.converter.XMLDataObjectConverter;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZ;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZKey;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.pce.resource.resource.resource.Node;
--- /dev/null
+{
+ "controller-behaviour-settings": {
+ "spectrum-filling": {
+ "spectrum-filling-rules": [
+ {
+ "rule-id": 1,
+ "priority": 1,
+ "RMSA-policy": "maximize-capacity",
+ "spectrum-range-of-appliance": {
+ "dedicated-signal-bandwidth-multiple": 50,
+ "spectrum-portion-id": 0,
+ "start-edge-frequency": 191.325,
+ "stop-edge-frequency": 191.375,
+ "dedicated-customer": [
+ "CustomerProfileLamda1"
+ ],
+ "non-authorized-customer": [
+ "All-other"
+ ]
+ }
+ },
+ {
+ "rule-id": 2,
+ "priority": 1,
+ "RMSA-policy": "maximize-capacity",
+ "spectrum-range-of-appliance": {
+ "spectrum-portion-id": 1,
+ "start-edge-frequency": 191.375,
+ "stop-edge-frequency": 196.125,
+ "non-authorized-customer": [
+ "CustomerProfileLamda1"
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.history.History;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.CreateOtsOmsInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.CreateOtsOmsOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackInput;
*/
ServicePathOutput setupServicePath(ServicePathInput input, ServicePathDirection direction);
+ /**
+ * This method set's wavelength path based on following steps.
+ *
+ * <p>
+ * For each node:
+ * 1. Create Och interface on source termination point.
+ * 2. Create Och interface on destination termination point.
+ * 3. Create cross connect between source and destination tps created in step 1
+ * and 2.
+ *
+ * Naming convention used for OCH interfaces name : tp-wavenumber Naming
+ * convention used for cross connect name : src-dest-wavenumber
+ * </p>
+ *
+ * @param input
+ * Input parameter from the service-path yang model
+ * @param direction
+ * Service Path direction
+ * @param transactionHistory
+ * Object tracking created interface(s) and connection(s).
+ *
+ * @return Result list of all nodes if request successful otherwise specific
+ * reason of failure.
+ */
+ ServicePathOutput setupServicePath(
+ ServicePathInput input,
+ ServicePathDirection direction,
+ History transactionHistory);
+
/**
* This method removes wavelength path based on following steps.
*
*/
RendererRollbackOutput rendererRollback(RendererRollbackInput input);
+ /**
+ * Rollback created interfaces and cross connects specified by transaction history.
+ *
+ * @param transactionHistory The transaction history in need of rollback.
+ * @return Success flag and nodes which failed to rollback
+ */
+ RendererRollbackOutput rendererRollback(History transactionHistory);
+
/**
* This method creates the basis of ots and oms interfaces on a specific ROADM degree.
*
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServiceListTopology;
import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.Connection;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.DeviceInterface;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.DeleteService;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.DeleteSubscriber;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.FailedRollbackResult;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Result;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Subscriber;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.history.History;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.history.NonStickHistoryMemory;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.ServiceNodelist;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.NodelistBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service.nodelist.NodelistKey;
this.openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(mappingUtils, portMapping, openRoadmInterfaces);
}
+ @Override
+ public ServicePathOutput setupServicePath(ServicePathInput input, ServicePathDirection direction) {
+ return setupServicePath(input, direction, new NonStickHistoryMemory());
+ }
+
@SuppressWarnings("rawtypes")
// FIXME check if the ForkJoinTask raw type can be avoided
// Raw types use are discouraged since they lack type safety.
// Resulting Problems are observed at run time and not at compile time
@Override
- public ServicePathOutput setupServicePath(ServicePathInput input, ServicePathDirection direction) {
+ public ServicePathOutput setupServicePath(
+ ServicePathInput input,
+ ServicePathDirection direction,
+ History transactionHistory
+ ) {
LOG.info("setup service path for input {} and direction {}", input, direction);
List<Nodes> nodes = new ArrayList<>();
if (input.getNodes() != null) {
crossConnectFlag++;
String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
nodeId, destTp, spectrumInformation);
+ transactionHistory.add(new DeviceInterface(nodeId, supportingOchInterface));
+
// Split the string based on # pass the last element as the supported Interface
// This is needed for 7.1 device models with B100G, we have OTSI, OTSI-group combined as OCH
String[] listOfSuppOchInf = supportingOchInterface.split("#");
List<String> createdOchInf = Arrays.asList(listOfSuppOchInf);
+ transactionHistory.addInterfaces(nodeId, listOfSuppOchInf);
+
createdOchInterfaces.addAll(createdOchInf);
LOG.info("DEST all otsi interfaces {}", createdOchInterfaces);
// Taking the last element
.createOpenRoadmOtu4Interface(nodeId, destTp, supportingOchInterface, apiInfoA,
apiInfoZ);
createdOtuInterfaces.add(supportingOtuInterface);
+ transactionHistory.add(new DeviceInterface(nodeId, supportingOtuInterface));
+
LOG.info("all dest otu interfaces {}", createdOtuInterfaces);
if (srcTp == null) {
otnLinkTps.add(new LinkTpBuilder().setNodeId(nodeId).setTpId(destTp).build());
// If src and dest tp contains the network token, then it is regenerator
LOG.info("Create the ODUCn for regen on the dest-tp");
// Here we first create ODUCn interface for the Regen
- createdOduInterfaces.add(this.openRoadmInterfaceFactory
- .createOpenRoadmOducn(nodeId, destTp));
+ String openRoadmOducn = this.openRoadmInterfaceFactory
+ .createOpenRoadmOducn(nodeId, destTp);
+ createdOduInterfaces.add(openRoadmOducn);
+ transactionHistory.addInterfaces(nodeId, openRoadmOducn);
+
LOG.info("all dest odu interfaces {}", createdOduInterfaces);
} else {
// This is needed for 7.1 device models for 400GE, since we have ODUC4 and ODUflex
// are combined
- createdOduInterfaces = Set.of(this.openRoadmInterfaceFactory
- .createOpenRoadmOdu4HOInterface(
- nodeId, destTp, false, apiInfoA, apiInfoZ, PT_07).split("#"));
+ String[] oduInterfaces = this.openRoadmInterfaceFactory
+ .createOpenRoadmOdu4HOInterface(
+ nodeId, destTp, false, apiInfoA, apiInfoZ, PT_07).split("#");
+ createdOduInterfaces.addAll(Arrays.asList(oduInterfaces));
+ transactionHistory.addInterfaces(nodeId, oduInterfaces);
+
}
}
if ((srcTp != null) && srcTp.contains(StringConstants.CLIENT_TOKEN)) {
LOG.info("Adding supporting EThernet interface for node {}, src tp {}", nodeId, srcTp);
crossConnectFlag++;
// create OpenRoadm Xponder Client Interfaces
- createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(
- nodeId, srcTp));
+ String openRoadmEthInterface = this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(
+ nodeId, srcTp);
+ createdEthInterfaces.add(openRoadmEthInterface);
+ transactionHistory.add(new DeviceInterface(nodeId, openRoadmEthInterface));
+
}
if ((srcTp != null) && srcTp.contains(StringConstants.NETWORK_TOKEN)) {
LOG.info("Adding supporting OCH interface for node {}, src tp {}, spectrumInformation {}",
// create OpenRoadm Xponder Line Interfaces
String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
nodeId, srcTp, spectrumInformation);
+ transactionHistory.add(new DeviceInterface(nodeId, supportingOchInterface));
+
// createdOchInterfaces.add(supportingOchInterface);
// Split the string based on # pass the last element as the supported Interface
// This is needed for 7.1 device models with B100G, we have OTSI, OTSI-group combined as OCH
String[] listOfSuppOchInf = supportingOchInterface.split("#");
+ transactionHistory.addInterfaces(nodeId, listOfSuppOchInf);
+
List<String> tmpCreatedOchInterfaces = Arrays.asList(listOfSuppOchInf);
createdOchInterfaces.addAll(tmpCreatedOchInterfaces);
// Taking the last element
String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
nodeId, srcTp, supportingOchInterface, apiInfoA, apiInfoZ);
createdOtuInterfaces.add(supportingOtuInterface);
+ transactionHistory.add(new DeviceInterface(nodeId, supportingOtuInterface));
+
if (destTp == null) {
otnLinkTps.add(new LinkTpBuilder().setNodeId(nodeId).setTpId(srcTp).build());
} else if (destTp.contains(StringConstants.NETWORK_TOKEN)) {
// If the src and dest tp have network-token, then it is a regen
LOG.info("Create the regen-interfaces on the src-tp");
// Here we first create ODUCn interface for the Regen
- createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOducn(nodeId,
- srcTp));
+ String openRoadmOducn = this.openRoadmInterfaceFactory.createOpenRoadmOducn(nodeId,
+ srcTp);
+ createdOduInterfaces.add(openRoadmOducn);
+ transactionHistory.add(new DeviceInterface(nodeId, openRoadmOducn));
+
LOG.info("all src odu interfaces {}", createdOduInterfaces);
} else {
- createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
- nodeId, srcTp, false, apiInfoA, apiInfoZ, PT_07));
+ String openRoadmOdu4HOInterface = this.openRoadmInterfaceFactory
+ .createOpenRoadmOdu4HOInterface(nodeId, srcTp, false, apiInfoA, apiInfoZ, PT_07);
+ createdOduInterfaces.add(openRoadmOdu4HOInterface);
+ transactionHistory.add(new DeviceInterface(nodeId, openRoadmOdu4HOInterface));
}
}
if ((destTp != null) && destTp.contains(StringConstants.CLIENT_TOKEN)) {
LOG.info("Adding supporting EThernet interface for node {}, dest tp {}", nodeId, destTp);
crossConnectFlag++;
// create OpenRoadm Xponder Client Interfaces
- createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(
- nodeId, destTp));
+ String openRoadmEthInterface = this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(
+ nodeId, destTp);
+ createdEthInterfaces.add(openRoadmEthInterface);
+ transactionHistory.add(new DeviceInterface(nodeId, openRoadmEthInterface));
}
if ((srcTp != null) && (srcTp.contains(StringConstants.TTP_TOKEN)
|| srcTp.contains(StringConstants.PP_TOKEN))) {
LOG.info("Adding supporting OCH interface for node {}, src tp {}, spectrumInformation {}",
nodeId, srcTp, spectrumInformation);
- createdOchInterfaces.addAll(this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaces(
- nodeId, srcTp, spectrumInformation));
+ List<String> openRoadmOchInterfaces = this.openRoadmInterfaceFactory
+ .createOpenRoadmOchInterfaces(nodeId, srcTp, spectrumInformation);
+ createdOchInterfaces.addAll(openRoadmOchInterfaces);
+ transactionHistory.addInterfaces(nodeId, openRoadmOchInterfaces);
}
if ((destTp != null) && (destTp.contains(StringConstants.TTP_TOKEN)
|| destTp.contains(StringConstants.PP_TOKEN))) {
LOG.info("Adding supporting OCH interface for node {}, dest tp {}, spectrumInformation {}",
nodeId, destTp, spectrumInformation);
- createdOchInterfaces.addAll(this.openRoadmInterfaceFactory.createOpenRoadmOchInterfaces(
- nodeId, destTp, spectrumInformation));
+ List<String> openRoadmOchInterfaces = this.openRoadmInterfaceFactory
+ .createOpenRoadmOchInterfaces(nodeId, destTp, spectrumInformation);
+ createdOchInterfaces.addAll(openRoadmOchInterfaces);
+ transactionHistory.addInterfaces(nodeId, openRoadmOchInterfaces);
}
if (crossConnectFlag < 1) {
LOG.info("Creating cross connect between source {} and destination {} for node {}", srcTp,
this.crossConnect.postCrossConnect(nodeId, srcTp, destTp, spectrumInformation);
if (connectionNameOpt.isPresent()) {
nodesProvisioned.add(nodeId);
- createdConnections.add(connectionNameOpt.orElseThrow());
+ String connectionName = connectionNameOpt.orElseThrow();
+ createdConnections.add(connectionName);
+ transactionHistory.add(new Connection(nodeId, connectionName, false));
} else {
processErrorMessage("Unable to post Roadm-connection for node " + nodeId, forkJoinPool,
results);
.build();
}
+ @Override
+ public RendererRollbackOutput rendererRollback(History transactionHistory) {
+ LOG.info("Rolling back...");
+
+ Result rollbackResult = new FailedRollbackResult();
+ Subscriber deleteSubscriber = new DeleteSubscriber(rollbackResult);
+
+ transactionHistory.rollback(
+ new DeleteService(
+ crossConnect,
+ openRoadmInterfaces,
+ deleteSubscriber
+ )
+ );
+
+ LOG.info("Rollback done!");
+
+ return rollbackResult.renderRollbackOutput();
+ }
+
private boolean alarmSuppressionNodeRegistration(ServicePathInput input) {
Map<org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102.service
.nodelist.nodelist.NodesKey,
import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection;
import org.opendaylight.transportpce.renderer.provisiondevice.tasks.DeviceRenderingRollbackTask;
import org.opendaylight.transportpce.renderer.provisiondevice.tasks.DeviceRenderingTask;
+import org.opendaylight.transportpce.renderer.provisiondevice.tasks.NetworkDeviceRenderingRollbackTask;
import org.opendaylight.transportpce.renderer.provisiondevice.tasks.OlmPowerSetupRollbackTask;
import org.opendaylight.transportpce.renderer.provisiondevice.tasks.OlmPowerSetupTask;
import org.opendaylight.transportpce.renderer.provisiondevice.tasks.OlmPowerTurnDownTask;
import org.opendaylight.transportpce.renderer.provisiondevice.tasks.OtnDeviceRenderingTask;
import org.opendaylight.transportpce.renderer.provisiondevice.tasks.RollbackProcessor;
+import org.opendaylight.transportpce.renderer.provisiondevice.tasks.RollbackResultMessage;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.history.History;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.history.TransactionHistory;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.Action;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType;
servicePathDataAtoZ.getServicePathInput().getServiceName(),
RpcStatusEx.Pending,
RENDERING_DEVICES_A_Z_MSG);
+
+ History transactionHistory = new TransactionHistory();
ListenableFuture<DeviceRenderingResult> atozrenderingFuture =
this.executor.submit(
- new DeviceRenderingTask(this.deviceRenderer, servicePathDataAtoZ, ServicePathDirection.A_TO_Z));
+ new DeviceRenderingTask(this.deviceRenderer, servicePathDataAtoZ, ServicePathDirection.A_TO_Z,
+ transactionHistory));
LOG.info(RENDERING_DEVICES_Z_A_MSG);
sendNotifications(
RENDERING_DEVICES_Z_A_MSG);
ListenableFuture<DeviceRenderingResult> ztoarenderingFuture =
this.executor.submit(
- new DeviceRenderingTask(this.deviceRenderer, servicePathDataZtoA, ServicePathDirection.Z_TO_A));
+ new DeviceRenderingTask(this.deviceRenderer, servicePathDataZtoA, ServicePathDirection.Z_TO_A,
+ transactionHistory));
ListenableFuture<List<DeviceRenderingResult>> renderingCombinedFuture =
Futures.allAsList(atozrenderingFuture, ztoarenderingFuture);
}
rollbackProcessor.addTask(
- new DeviceRenderingRollbackTask(
- "AtoZDeviceTask",
- ! renderingResults.get(0).isSuccess(),
- renderingResults.get(0).getRenderedNodeInterfaces(),
- this.deviceRenderer));
- rollbackProcessor.addTask(
- new DeviceRenderingRollbackTask("ZtoADeviceTask",
- ! renderingResults.get(1).isSuccess(),
- renderingResults.get(1).getRenderedNodeInterfaces(),
- this.deviceRenderer));
+ new NetworkDeviceRenderingRollbackTask(
+ "RollbackTransactionHistoryTask",
+ transactionHistory,
+ ! (renderingResults.get(0).isSuccess() && renderingResults.get(1).isSuccess()),
+ deviceRenderer,
+ new RollbackResultMessage()
+ )
+ );
+
return renderingResults;
}
import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRenderingResult;
import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.history.History;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.ServicePathOutput;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.optical.renderer.nodes.Nodes;
import org.slf4j.Logger;
private final DeviceRendererService deviceRenderer;
private final ServicePathInputData servicePathInputData;
private final ServicePathDirection direction;
+ private final History transactionHistory;
public DeviceRenderingTask(DeviceRendererService deviceRenderer, ServicePathInputData servicePathInputData,
- ServicePathDirection direction) {
+ ServicePathDirection direction, History transactionHistory) {
this.deviceRenderer = deviceRenderer;
this.servicePathInputData = servicePathInputData;
this.direction = direction;
+ this.transactionHistory = transactionHistory;
}
@Override
case Create:
operation = "setup";
output = this.deviceRenderer.setupServicePath(this.servicePathInputData.getServicePathInput(),
- this.direction);
+ this.direction, transactionHistory);
olmList = this.servicePathInputData.getNodeLists().getOlmNodeList();
break;
case Delete:
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.tasks;
+
+import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.history.History;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackOutput;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class NetworkDeviceRenderingRollbackTask extends RollbackTask {
+
+ private final History transactionHistory;
+
+ private final boolean isRollbackNecessary;
+
+ private final DeviceRendererService deviceRendererService;
+
+ private final ResultMessage message;
+
+ private static final Logger LOG = LoggerFactory.getLogger(NetworkDeviceRenderingRollbackTask.class);
+
+ public NetworkDeviceRenderingRollbackTask(String id, History transactionHistory,
+ boolean isRollbackNecessary,
+ DeviceRendererService deviceRendererService, ResultMessage message) {
+ super(id);
+ this.transactionHistory = transactionHistory;
+ this.isRollbackNecessary = isRollbackNecessary;
+ this.deviceRendererService = deviceRendererService;
+ this.message = message;
+ }
+
+ @Override
+ public boolean isRollbackNecessary() {
+ return isRollbackNecessary;
+ }
+
+ @Override
+ public Void call() throws Exception {
+
+ RendererRollbackOutput rollbackOutput = deviceRendererService.rendererRollback(transactionHistory);
+
+ if (! rollbackOutput.getSuccess()) {
+ LOG.warn("Device rendering rollback of {} was not successful! Failed rollback on {}.", this.getId(),
+ message.createErrorMessage(rollbackOutput.nonnullFailedToRollback().values()));
+ } else {
+ LOG.info("Device rollback of {} successful.", this.getId());
+ }
+
+ return null;
+ }
+}
.setNodes(this.powerSetupInput.getNodes())
.setServiceName(this.powerSetupInput.getServiceName())
.setWaveNumber(this.powerSetupInput.getWaveNumber())
+ .setLowerSpectralSlotNumber(this.powerSetupInput.getLowerSpectralSlotNumber())
+ .setHigherSpectralSlotNumber(this.powerSetupInput.getHigherSpectralSlotNumber())
.build();
Future<RpcResult<ServicePowerTurndownOutput>> powerTurndownResultFuture =
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.tasks;
+
+import java.util.Collection;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollback;
+
+public interface ResultMessage {
+
+ /**
+ * Build an error message for a failed rollback.
+ */
+ String createErrorMessage(Collection<FailedToRollback> failedRollbacks);
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.tasks;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollback;
+
+public class RollbackResultMessage implements ResultMessage {
+
+ @Override
+ public String createErrorMessage(Collection<FailedToRollback> failedRollbacks) {
+ List<String> failedRollbackNodes = new ArrayList<>();
+
+ failedRollbacks.forEach(failedRollback -> {
+ var intf = failedRollback.getInterface();
+
+ failedRollbackNodes.add(
+ failedRollback.getNodeId()
+ + ": "
+ + intf == null ? "" : String.join(", ", intf)
+ );
+ });
+
+ return String.join(System.lineSeparator(), failedRollbackNodes);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction;
+
+import java.util.List;
+import java.util.Objects;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Connection transaction.
+ *
+ * <p>
+ * i.e. a class tracking a connection.
+ */
+public class Connection implements Transaction {
+
+ private static final Logger LOG = LoggerFactory.getLogger(Connection.class);
+ private final String deviceId;
+ private final String connectionNumber;
+ private final boolean isOtn;
+
+ public Connection(String deviceId, String connectionNumber, boolean isOtn) {
+ this.deviceId = deviceId;
+ this.connectionNumber = connectionNumber;
+ this.isOtn = isOtn;
+ }
+
+ @Override
+ public boolean rollback(Delete delete) {
+ List<String> supportingInterfaces = delete.deleteCrossConnect(deviceId, connectionNumber, isOtn);
+
+ if (supportingInterfaces == null || supportingInterfaces.size() == 0) {
+ return false;
+ }
+
+ LOG.info("Supporting interfaces {} affected by rollback on {} {}",
+ String.join(", ", supportingInterfaces), deviceId, connectionNumber);
+
+ return true;
+
+ }
+
+ @Override
+ public String description() {
+ return String.format("Connection %s connection number %s isOtn %s", deviceId,
+ connectionNumber, isOtn);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof Connection)) {
+ return false;
+ }
+ Connection that = (Connection) object;
+ return isOtn == that.isOtn && Objects.equals(deviceId, that.deviceId)
+ && Objects.equals(connectionNumber, that.connectionNumber);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(deviceId, connectionNumber, isOtn);
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction;
+
+import java.util.Objects;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+
+public class DeviceInterface implements Transaction {
+
+ private final String nodeId;
+
+ private final String interfaceId;
+
+ public DeviceInterface(String nodeId, String interfaceId) {
+ this.nodeId = nodeId;
+ this.interfaceId = interfaceId;
+ }
+
+ @Override
+ public boolean rollback(Delete delete) {
+ return delete.deleteInterface(nodeId, interfaceId);
+ }
+
+ @Override
+ public String description() {
+ return String.format("Node: %s interface id: %s", nodeId, interfaceId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(nodeId, interfaceId);
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (!(object instanceof DeviceInterface)) {
+ return false;
+ }
+ DeviceInterface that = (DeviceInterface) object;
+ return Objects.equals(nodeId, that.nodeId) && Objects.equals(interfaceId,
+ that.interfaceId);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction;
+
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+
+/**
+ * Any class wishing to keep track of transactions
+ * may implement this interface.
+ */
+public interface Transaction {
+
+ /**
+ * Rollback this transaction.
+ */
+ boolean rollback(Delete delete);
+
+ String description();
+
+ int hashCode();
+
+ boolean equals(Object object);
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete;
+
+import java.util.List;
+
+/**
+ * A class capable of deleting service connections/interfaces
+ * may implement this interface.
+ */
+public interface Delete {
+
+ /**
+ * Delete cross connection.
+ * Typically, deleted before interfaces.
+ */
+ List<String> deleteCrossConnect(String deviceId, String connectionNumber, boolean isOtn);
+
+ /**
+ * Delete an interface.
+ * Typically, deleted after the cross connection.
+ */
+ boolean deleteInterface(String nodeId, String interfaceId);
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
+import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
+import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DeleteService implements Delete {
+
+ private final CrossConnect crossConnect;
+ private final OpenRoadmInterfaces openRoadmInterfaces;
+
+ private final Subscriber subscriber;
+
+ private static final Logger LOG = LoggerFactory.getLogger(DeleteService.class);
+
+ public DeleteService(
+ CrossConnect crossConnect,
+ OpenRoadmInterfaces openRoadmInterfaces,
+ Subscriber subscriber) {
+ this.crossConnect = crossConnect;
+ this.openRoadmInterfaces = openRoadmInterfaces;
+ this.subscriber = subscriber;
+ }
+
+ @Override
+ public @NonNull List<String> deleteCrossConnect(String deviceId, String connectionNumber,
+ boolean isOtn) {
+ List<String> result = crossConnect.deleteCrossConnect(deviceId, connectionNumber, isOtn);
+
+ if (result == null) {
+ subscriber.result(false, deviceId, connectionNumber);
+ return new ArrayList<>();
+ }
+
+ subscriber.result(true, deviceId, connectionNumber);
+
+ return result;
+ }
+
+ @Override
+ public boolean deleteInterface(String nodeId, String interfaceId) {
+ try {
+ openRoadmInterfaces.deleteInterface(nodeId, interfaceId);
+
+ subscriber.result(true, nodeId, interfaceId);
+ return true;
+ } catch (OpenRoadmInterfaceException e) {
+ LOG.error("Failed rolling back {} {}", nodeId, interfaceId);
+ subscriber.result(false, nodeId, interfaceId);
+ return false;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete;
+
+public class DeleteSubscriber implements Subscriber {
+
+ private final Result result;
+
+ public DeleteSubscriber(Result result) {
+ this.result = result;
+ }
+
+ @Override
+ public void result(Boolean success, String nodeId, String interfaceId) {
+
+ result.add(success, nodeId, interfaceId);
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollback;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollbackBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.renderer.rollback.output.FailedToRollbackKey;
+
+public class FailedRollbackResult implements Result {
+
+ private final Map<String, Set<String>> failedRollback = Collections.synchronizedMap(
+ new HashMap<>());
+
+ @Override
+ public boolean add(boolean success, String nodeId, String interfaceId) {
+
+ if (success) {
+ return false;
+ }
+
+ if (!failedRollback.containsKey(nodeId)) {
+ failedRollback.put(nodeId, new LinkedHashSet<>());
+ }
+
+ return failedRollback.get(nodeId).add(interfaceId);
+ }
+
+ @Override
+ public RendererRollbackOutput renderRollbackOutput() {
+
+ Map<FailedToRollbackKey, FailedToRollback> failedToRollbackList = new HashMap<>();
+
+ for (Entry<String, Set<String>> entry : failedRollback.entrySet()) {
+
+ FailedToRollback failedToRollack = new FailedToRollbackBuilder()
+ .withKey(new FailedToRollbackKey(entry.getKey()))
+ .setNodeId(entry.getKey())
+ .setInterface(entry.getValue())
+ .build();
+
+ failedToRollbackList.put(failedToRollack.key(), failedToRollack);
+
+ }
+
+ return new RendererRollbackOutputBuilder()
+ .setSuccess(failedRollback.isEmpty())
+ .setFailedToRollback(failedToRollbackList)
+ .build();
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete;
+
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.RendererRollbackOutput;
+
+public interface Result {
+
+ boolean add(boolean success, String nodeId, String interfaceId);
+
+ RendererRollbackOutput renderRollbackOutput();
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete;
+
+public interface Subscriber {
+
+ void result(Boolean success, String nodeId, String interfaceId);
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.history;
+
+import java.util.List;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.Transaction;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+
+public interface History {
+
+ /**
+ * Add transaction.
+ *
+ * <p>
+ * Only accepts the transaction if this History
+ * object doesn't already contain the object.
+ *
+ * @return true if the transaction was added.
+ */
+ boolean add(Transaction transaction);
+
+ /**
+ * A list of transactions.
+ *
+ * <p>
+ * Will only accept unique transactions.
+ * @return true if all transactions was added. false if one or more transactions was rejected.
+ */
+ boolean add(List<Transaction> transactions);
+
+ /**
+ * Add an array of interface transactions.
+ *
+ * <p>
+ * Duplicate interface ids, null or empty strings
+ * are silently ignored.
+ * @return may return false
+ */
+ boolean addInterfaces(String nodeId, String interfaceId);
+
+ /**
+ * Add an array of interface transactions.
+ *
+ * <p>
+ * Duplicate interface ids, null or empty strings
+ * are silently ignored.
+ * @return may return false
+ */
+ boolean addInterfaces(String nodeId, String[] interfaceIds);
+
+ /**
+ * Add a list of interface transactions.
+ *
+ * <p>
+ * Duplicate interface ids, null or empty strings
+ * are silently ignored.
+ */
+ boolean addInterfaces(String nodeId, List<String> interfaceIds);
+
+ /**
+ * Rollback all transactions.
+ *
+ * <p>
+ * Typically, the transactions are rolled back in reverse
+ * order, but the implementing class may choose a different
+ * logic.
+ */
+ boolean rollback(Delete delete);
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.history;
+
+import java.util.List;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.Transaction;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Goldfish implementation of the History interface.
+ *
+ * <p>
+ * This implementation simply doesn't track anything.
+ * Most useful for backwards compatibility reasons.
+ */
+public class NonStickHistoryMemory implements History {
+
+ private static final Logger LOG = LoggerFactory.getLogger(NonStickHistoryMemory.class);
+
+ @Override
+ public boolean add(Transaction transaction) {
+ LOG.warn("Transaction history disabled. Ignoring '{}'.", transaction.description());
+ return false;
+ }
+
+ @Override
+ public boolean add(List<Transaction> transactions) {
+ LOG.warn("Transaction history disabled. No rollback executed.");
+ return false;
+ }
+
+ @Override
+ public boolean addInterfaces(String nodeId, String interfaceId) {
+ LOG.warn("Transaction history disabled.");
+ return false;
+ }
+
+ @Override
+ public boolean addInterfaces(String nodeId, String[] interfaceIds) {
+ LOG.warn("Transaction history disabled.");
+ return false;
+ }
+
+ @Override
+ public boolean addInterfaces(String nodeId, List<String> interfaceIds) {
+ LOG.warn("Transaction history disabled.");
+ return false;
+ }
+
+ @Override
+ public boolean rollback(Delete delete) {
+ LOG.warn("Transaction history disabled. No rollback executed.");
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.history;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.DeviceInterface;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.Transaction;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A class keeping track of transaction history.
+ *
+ * <p>
+ * A transaction can be something like an interface or a roadm connection, that may need to be
+ * rolled back in the future.
+ */
+public class TransactionHistory implements History {
+
+ private static final Logger LOG = LoggerFactory.getLogger(TransactionHistory.class);
+ Set<Transaction> transactionHistory = Collections.synchronizedSet(new LinkedHashSet<>());
+
+ @Override
+ public boolean add(Transaction transaction) {
+
+ boolean result = transactionHistory.add(transaction);
+
+ if (result) {
+ LOG.info("Adding {}", transaction.description());
+ } else {
+ LOG.warn("Transaction {} not added.", transaction.description());
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean add(List<Transaction> transactions) {
+ Set<Boolean> results = new HashSet<>(transactions.size());
+
+ for (Transaction transaction : transactions) {
+ results.add(add(transaction));
+ }
+
+ return results.stream().allMatch(i -> (i.equals(Boolean.TRUE)));
+ }
+
+ @Override
+ public boolean addInterfaces(String nodeId, String interfaceId) {
+ return addInterfaces(nodeId, Collections.singletonList(interfaceId));
+ }
+
+ @Override
+ public boolean addInterfaces(String nodeId, String[] interfaceIds) {
+
+ return addInterfaces(nodeId, Arrays.asList(interfaceIds));
+
+ }
+
+ @Override
+ public boolean addInterfaces(String nodeId, List<String> interfaceIds) {
+
+ Set<Boolean> results = new HashSet<>();
+ Set<String> unique = new LinkedHashSet<>();
+
+ for (String interfaceId : interfaceIds) {
+ if (interfaceId != null && !interfaceId.trim().isEmpty()) {
+ unique.add(interfaceId.trim());
+ }
+ }
+
+ for (String interfaceId : unique) {
+ results.add(this.add(new DeviceInterface(nodeId, interfaceId)));
+ }
+
+ return results.stream().allMatch(i -> (i.equals(Boolean.TRUE)));
+
+ }
+
+ @Override
+ public boolean rollback(Delete delete) {
+
+ LOG.info("History contains {} items. Rolling them back in reverse order.",
+ transactionHistory.size());
+
+ List<Transaction> reverse = new ArrayList<>(transactionHistory);
+
+ Collections.reverse(reverse);
+
+ boolean success = true;
+
+ for (Transaction transaction : reverse) {
+ LOG.info("Rolling back {}", transaction.description());
+ if (!transaction.rollback(delete)) {
+ success = false;
+ }
+ }
+
+ return success;
+
+ }
+}
\ No newline at end of file
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.TTP_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestOutput result =
this.rendererServiceOperations.serviceImplementation(input, false).get();
assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.TTP_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
doReturn(RpcResultBuilder.failed().buildFuture()).when(this.olmService).servicePowerSetup(any());
ServiceImplementationRequestOutput result =
this.rendererServiceOperations.serviceImplementation(input, false).get();
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.PP_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
false).get();
assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
false).get();
assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.CLIENT_TOKEN);
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
false).get();
assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("failed")
.setSuccess(false);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
for (String tpToken : interfaceTokens) {
ServiceImplementationRequestInput input = ServiceDataUtils
when(this.olmService.getPm(eq(getPmInputA))).thenReturn(RpcResultBuilder.success(getPmOutput).buildFuture());
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
when(this.olmService.getPm(any())).thenReturn(RpcResultBuilder.success(getPmOutput1).buildFuture());
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
false).get();
assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
when(this.olmService.getPm(any())).thenReturn(RpcResultBuilder.success(getPmOutput).buildFuture());
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
false).get();
assertEquals(ResponseCodes.RESPONSE_OK, result.getConfigurationResponseCommon().getResponseCode());
doReturn(RpcResultBuilder.success(getPmOutput).buildFuture()).when(this.olmService).getPm(any());
ServicePathOutputBuilder mockOutputBuilder = new ServicePathOutputBuilder().setResult("success")
.setSuccess(true);
- doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any());
+ doReturn(mockOutputBuilder.build()).when(this.deviceRenderer).setupServicePath(any(), any(), any());
ServiceImplementationRequestInput input = ServiceDataUtils
.buildServiceImplementationRequestInputTerminationPointResource(StringConstants.NETWORK_TOKEN);
ServiceImplementationRequestOutput result = this.rendererServiceOperations.serviceImplementation(input,
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+
+class ConnectionTest {
+
+ @Test
+ void rollback() {
+ Delete delete = Mockito.mock(Delete.class);
+ Mockito.when(delete.deleteCrossConnect("ROADM-A", "DEG1", false))
+ .thenReturn(List.of("Interface1"));
+
+ Connection n1 = new Connection("ROADM-A", "DEG1", false);
+
+ Assert.assertTrue(n1.rollback(delete));
+
+ Mockito.verify(delete, Mockito.times(1))
+ .deleteCrossConnect("ROADM-A", "DEG1", false);
+ }
+
+ @Test
+ void testTwoObjectsWithSameInformationIsEqual() {
+ Connection n1 = new Connection("ROADM-A", "DEG1", false);
+ Connection n2 = new Connection("ROADM-A", "DEG1", false);
+
+ Assert.assertTrue(n1.equals(n2));
+ }
+
+ @Test
+ void testTwoObjectsWithDifferentInformationIsNotEqual() {
+ Connection n1 = new Connection("ROADM-A", "DEG1", true);
+ Connection n2 = new Connection("ROADM-A", "DEG1", false);
+
+ Assert.assertFalse(n1.equals(n2));
+ }
+
+ @Test
+ void testTwoDifferentRoadmNodesAreNotEqual() {
+ Connection n1 = new Connection("ROADM-A", "DEG1", false);
+ Connection n2 = new Connection("ROADM-B", "DEG1", false);
+
+ Assert.assertFalse(n1.equals(n2));
+ }
+
+
+ @Test
+ void deleteReturnNull() {
+ Delete delete = Mockito.mock(Delete.class);
+ Mockito.when(delete.deleteCrossConnect("ROADM-A", "DEG1", false))
+ .thenReturn(null);
+
+ Connection n1 = new Connection("ROADM-A", "DEG1", false);
+
+ Assert.assertFalse(n1.rollback(delete));
+
+ Mockito.verify(delete, Mockito.times(1))
+ .deleteCrossConnect("ROADM-A", "DEG1", false);
+ }
+
+ @Test
+ void deleteReturnEmptyList() {
+ Delete delete = Mockito.mock(Delete.class);
+ Mockito.when(delete.deleteCrossConnect("ROADM-A", "DEG1", false))
+ .thenReturn(new ArrayList<>());
+
+ Connection n1 = new Connection("ROADM-A", "DEG1", false);
+
+ Assert.assertFalse(n1.rollback(delete));
+
+ Mockito.verify(delete, Mockito.times(1))
+ .deleteCrossConnect("ROADM-A", "DEG1", false);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction;
+
+import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+
+class DeviceInterfaceTest {
+
+ @Test
+ void rollback() {
+ Delete delete = Mockito.mock(Delete.class);
+ Mockito.when(delete.deleteInterface("ROADM-A", "DEG1")).thenReturn(true);
+
+ DeviceInterface n1 = new DeviceInterface("ROADM-A", "DEG1");
+ Assert.assertTrue(n1.rollback(delete));
+
+ Mockito.verify(delete, Mockito.times(1)).deleteInterface("ROADM-A", "DEG1");
+ }
+
+ @Test
+ void testTwoInterfacesAreEqual() {
+ DeviceInterface n1 = new DeviceInterface("ROADM-A", "DEG1");
+ DeviceInterface n2 = new DeviceInterface("ROADM-A", "DEG1");
+
+ Assert.assertTrue(n1.equals(n2));
+ }
+
+ @Test
+ void testTwoInterfacesAreNotEqual() {
+ DeviceInterface n1 = new DeviceInterface("ROADM-A", "DEG1");
+ DeviceInterface n2 = new DeviceInterface("ROADM-B", "DEG1");
+
+ Assert.assertFalse(n1.equals(n2));
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2024 Smartoptics and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.renderer.provisiondevice.transaction.history;
+
+import java.util.List;
+import org.junit.Assert;
+import org.junit.jupiter.api.Test;
+import org.mockito.InOrder;
+import org.mockito.Mockito;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.DeviceInterface;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.Transaction;
+import org.opendaylight.transportpce.renderer.provisiondevice.transaction.delete.Delete;
+
+class TransactionHistoryTest {
+
+ @Test
+ void add() {
+ Transaction transaction = Mockito.mock(Transaction.class);
+ History history = new TransactionHistory();
+
+ Assert.assertTrue(history.add(transaction));
+ }
+
+ @Test
+ void testDuplicateTransactionIsIgnored() {
+
+ Transaction t1 = new DeviceInterface("ROADM-A", "DEG1");
+ Transaction t2 = new DeviceInterface("ROADM-A", "DEG1");
+
+ History history = new TransactionHistory();
+
+ history.add(t1);
+ Assert.assertFalse(history.add(t2));
+ }
+
+ @Test
+ void testAddCollectionOfUniqueTransactions() {
+ Transaction t1 = new DeviceInterface("ROADM-A", "DEG1");
+ Transaction t2 = new DeviceInterface("ROADM-A", "DEG2");
+
+ List<Transaction> transactions = List.of(t1, t2);
+
+ History history = new TransactionHistory();
+
+ Assert.assertTrue(history.add(transactions));
+ }
+
+ @Test
+ void testAddCollectionOfDuplicateTransactions() {
+ Transaction t1 = new DeviceInterface("ROADM-A", "DEG1");
+ Transaction t2 = new DeviceInterface("ROADM-A", "DEG1");
+
+ List<Transaction> transactions = List.of(t1, t2);
+
+ History history = new TransactionHistory();
+
+ Assert.assertFalse(history.add(transactions));
+ }
+
+ @Test
+ void testAddUniqueStringOfInterfaceIds() {
+ String nodeId = "ROADM-A";
+ String[] interfaces = new String[]{"DEG1", "DEG2"};
+
+ History history = new TransactionHistory();
+
+ Assert.assertTrue(history.addInterfaces(nodeId, interfaces));
+ }
+
+ @Test
+ void testAddDuplicateStringOfInterfaceIds() {
+ String nodeId = "ROADM-A";
+ String[] interfaces = new String[]{"DEG1", "DEG1"};
+
+ History history = new TransactionHistory();
+
+ Assert.assertTrue(history.addInterfaces(nodeId, interfaces));
+
+ }
+
+ @Test
+ void testAddDuplicateListOfInterfaceIds() {
+ String nodeId = "ROADM-A";
+ List<String> interfaces = List.of("DEG1", "DEG1");
+
+ History history = new TransactionHistory();
+
+ Assert.assertTrue(history.addInterfaces(nodeId, interfaces));
+
+ }
+
+ @Test
+ void rollbackOneInterface() {
+
+ String nodeId = "ROADM-A";
+ List<String> interfaces = List.of("DEG1", "DEG1");
+
+ History history = new TransactionHistory();
+ history.addInterfaces(nodeId, interfaces);
+
+ Delete delete = Mockito.mock(Delete.class);
+ Mockito.when(delete.deleteInterface("ROADM-A", "DEG1")).thenReturn(true);
+
+ Assert.assertTrue(history.rollback(delete));
+
+ //Although the same interface was added twice, we only rollback once.
+ Mockito.verify(delete, Mockito.times(1))
+ .deleteInterface("ROADM-A", "DEG1");
+ }
+
+ @Test
+ void rollbackTwoInterfacesInReverseOrderTheyWereAdded() {
+
+ String nodeId = "ROADM-A";
+
+ //Note DEG1 is added before DEG2
+ List<String> interfaces = List.of("DEG1", "DEG2");
+
+ History history = new TransactionHistory();
+ history.addInterfaces(nodeId, interfaces);
+
+ Delete delete = Mockito.mock(Delete.class);
+ Mockito.when(delete.deleteInterface("ROADM-A", "DEG1")).thenReturn(true);
+ Mockito.when(delete.deleteInterface("ROADM-A", "DEG2")).thenReturn(true);
+
+ Assert.assertTrue(history.rollback(delete));
+
+ //The rollback occurs in the reverse order.
+ // i.e. DEG2 before DEG1.
+ InOrder inOrder = Mockito.inOrder(delete);
+ inOrder.verify(delete, Mockito.times(1))
+ .deleteInterface("ROADM-A", "DEG2");
+ inOrder.verify(delete, Mockito.times(1))
+ .deleteInterface("ROADM-A", "DEG1");
+
+ }
+}
\ No newline at end of file
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.HashMap;
import java.util.Map;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceAEnd;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceZEnd;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceZEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInputBuilder;
.build();
}
- public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceAEnd createServiceAEndReroute(ServiceEndpoint serviceAEnd) {
- return new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ return new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceAEndBuilder()
.setClli(serviceAEnd.getClli())
.setNodeId(serviceAEnd.getNodeId().getValue())
.build();
}
- public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceZEnd createServiceZEndReroute(ServiceEndpoint serviceZEnd) {
- return new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ return new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.path.computation.reroute.request.input.ServiceZEndBuilder()
.setClli(serviceZEnd.getClli())
.setNodeId(serviceZEnd.getNodeId().getValue())
import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.EndpointsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.EndpointsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.RpcActions;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceNotificationTypes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescriptionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.ServicePathRpcResult;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
} else {
deleteServiceOperationResult = this.serviceDataStoreOperations.deleteService(serviceName);
}
- if (deleteServiceOperationResult.isSuccess()) {
+ if (!deleteServiceOperationResult.isSuccess()) {
LOG.warn("{}Service was not removed from datastore!", serviceType);
}
}
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.pce.service.PathComputationService;
import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.Endpoints;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.reroute.request.input.EndpointsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.Endpoints;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.reroute.request.input.EndpointsBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultSh;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultShBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceEndpoint;
return performPCE(serviceCreateInput.getHardConstraints(), serviceCreateInput.getSoftConstraints(),
serviceCreateInput.getServiceName(), serviceCreateInput.getSdncRequestHeader(),
serviceCreateInput.getServiceAEnd(), serviceCreateInput.getServiceZEnd(),
- ServiceNotificationTypes.ServiceCreateResult, reserveResource);
+ ServiceNotificationTypes.ServiceCreateResult, reserveResource,
+ serviceCreateInput.getCustomer());
} else {
return returnPCEFailed();
}
return performPCE(tempServiceCreateInput.getHardConstraints(), tempServiceCreateInput.getSoftConstraints(),
tempServiceCreateInput.getCommonId(), tempServiceCreateInput.getSdncRequestHeader(),
tempServiceCreateInput.getServiceAEnd(), tempServiceCreateInput.getServiceZEnd(),
- ServiceNotificationTypes.ServiceCreateResult, reserveResource);
+ ServiceNotificationTypes.ServiceCreateResult, reserveResource,
+ tempServiceCreateInput.getCustomer());
} else {
return returnPCEFailed();
}
serviceFeasibilityCheckInput.getSoftConstraints(), serviceFeasibilityCheckInput.getCommonId(),
serviceFeasibilityCheckInput.getSdncRequestHeader(), serviceFeasibilityCheckInput.getServiceAEnd(),
serviceFeasibilityCheckInput.getServiceZEnd(),
- ServiceNotificationTypes.ServiceCreateResult, reserveResource);
+ ServiceNotificationTypes.ServiceCreateResult, reserveResource,
+ serviceFeasibilityCheckInput.getCustomer());
} else {
return returnPCEFailed();
}
private PathComputationRequestOutput performPCE(HardConstraints hardConstraints, SoftConstraints softConstraints,
String serviceName, SdncRequestHeader sdncRequestHeader, ServiceEndpoint serviceAEnd,
- ServiceEndpoint serviceZEnd, ServiceNotificationTypes notifType, boolean reserveResource) {
+ ServiceEndpoint serviceZEnd, ServiceNotificationTypes notifType, boolean reserveResource,
+ String customerName) {
LOG.info("Calling path computation.");
notification = new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName(serviceName)
.setStatus(RpcStatusEx.Pending)
FutureCallback<PathComputationRequestOutput> pceCallback =
new PathComputationRequestOutputCallback(notifType, serviceName);
PathComputationRequestInput pathComputationRequestInput = createPceRequestInput(serviceName, sdncRequestHeader,
- hardConstraints, softConstraints, reserveResource, serviceAEnd, serviceZEnd);
+ hardConstraints, softConstraints, reserveResource, serviceAEnd, serviceZEnd, customerName);
ListenableFuture<PathComputationRequestOutput> pce = this.pathComputationService
.pathComputationRequest(pathComputationRequestInput);
Futures.addCallback(pce, pceCallback, executor);
private PathComputationRequestInput createPceRequestInput(String serviceName,
SdncRequestHeader serviceHandler, HardConstraints hardConstraints,
SoftConstraints softConstraints, Boolean reserveResource, ServiceEndpoint serviceAEnd,
- ServiceEndpoint serviceZEnd) {
+ ServiceEndpoint serviceZEnd, String customerName) {
LOG.info("Mapping ServiceCreateInput or ServiceFeasibilityCheckInput or serviceReconfigureInput to PCE"
+ "requests");
ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
.setHardConstraints(hardConstraints)
.setSoftConstraints(softConstraints)
.setPceRoutingMetric(PceMetric.TEMetric)
+ .setCustomerName(customerName)
.setServiceAEnd(ModelMappingUtils.createServiceAEnd(serviceAEnd))
.setServiceZEnd(ModelMappingUtils.createServiceZEnd(serviceZEnd))
.build();
import java.util.Optional;
import org.opendaylight.transportpce.common.OperationResult;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateInput;
* @return result of createTempService operation
*/
OperationResult createTempService(TempServiceCreateInput tempServiceCreateInput,
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.service.path.rpc.result.PathDescription pathDescription);
Optional<ServicePathList> getServicePaths();
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateInput;
try {
LOG.info("initializing service registry");
WriteTransaction transaction = this.dataBroker.newWriteOnlyTransaction();
- transaction.put(
+ transaction.merge(
LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.create(ServiceList.class),
new ServiceListBuilder().build());
try {
LOG.info("initializing temp service registry");
WriteTransaction transaction = this.dataBroker.newWriteOnlyTransaction();
- transaction.put(
+ transaction.merge(
LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.create(TempServiceList.class),
new TempServiceListBuilder().build());
@Override
public OperationResult createTempService(
TempServiceCreateInput tempServiceCreateInput,
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205
.service.path.rpc.result.PathDescription pathDescription) {
LOG.debug("Writing '{}' Temp Service", tempServiceCreateInput.getCommonId());
try {
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.sdnc.request.header.SdncRequestHeaderBuilder;
import org.opendaylight.transportpce.servicehandler.utils.CatalogDataUtils;
import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRerouteRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRerouteRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddOpenroadmOperationalModesToCatalogInputBuilder;
import org.opendaylight.transportpce.pce.service.PathComputationService;
import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.CancelResourceReserveOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.CancelResourceReserveOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceNotificationTypes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceAEnd;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceZEnd;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.path.computation.request.input.ServiceZEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceAEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEnd;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.path.computation.request.input.ServiceZEndBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInputBuilder;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.PathComputationRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.ServicePathRpcResultBuilder;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescriptionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.PathComputationRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.ServicePathRpcResult;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.ServicePathRpcResultBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSp;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSpBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultSh;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.ServiceType;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnection;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnectionBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnectionKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology;
public final class ConnectivityUtils {
- private final Uuid tapiTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString());
+ private final Uuid tapiTopoUuid = new Uuid(
+ UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(StandardCharsets.UTF_8)).toString());
private static final Logger LOG = LoggerFactory.getLogger(ConnectivityUtils.class);
private final ServiceDataStoreOperations serviceDataStoreOperations;
private final TapiContext tapiContext;
private Map<ServiceInterfacePointKey, ServiceInterfacePoint> sipMap;
+ // this variable is for complete connection objects
private final Map<
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection>
- connectionFullMap; // this variable is for complete connection objects
+ connectionFullMap;
private final NetworkTransactionService networkTransactionService;
private Connection topConnRdmRdm;
private Connection topConnXpdrXpdrPhtn;
.setServiceName("service test")
.setServiceAEnd(serviceAEnd)
.setServiceZEnd(serviceZEnd)
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request-1")
- .setRpcAction(RpcActions.ServiceCreate).setNotificationUrl("notification url").setRequestSystemId(
- "appname")
- .build())
+ .setSdncRequestHeader(
+ new SdncRequestHeaderBuilder()
+ .setRequestId("request-1")
+ .setRpcAction(RpcActions.ServiceCreate)
+ .setNotificationUrl("notification url")
+ .setRequestSystemId("appname")
+ .build())
.build();
}
- public static ServiceAEnd buildServiceAEnd(String nodeid, String clli, String txPortDeviceName,
- String txPortName, String rxPortDeviceName, String rxPortName) {
+ public static ServiceAEnd buildServiceAEnd(
+ String nodeid, String clli, String txPortDeviceName,
+ String txPortName, String rxPortDeviceName, String rxPortName) {
return new ServiceAEndBuilder()
.setClli(clli)
.setNodeId(new NodeIdType(nodeid))
.setOpticType(OpticTypes.Gray)
.setServiceFormat(ServiceFormat.Ethernet)
.setServiceRate(Uint32.valueOf(100))
- .setTxDirection(Map.of(new TxDirectionKey(Uint8.ZERO), new TxDirectionBuilder()
- .setPort(new PortBuilder()
- .setPortDeviceName(txPortDeviceName)
- .setPortName(txPortName)
- .setPortRack(TapiStringConstants.PORT_RACK_VALUE)
- .setPortShelf("00")
- .setPortType(TapiStringConstants.PORT_TYPE)
- .build())
- .setLgx(new LgxBuilder()
- .setLgxDeviceName(TapiStringConstants.LGX_DEVICE_NAME)
- .setLgxPortName(TapiStringConstants.LGX_PORT_NAME)
- .setLgxPortRack(TapiStringConstants.PORT_RACK_VALUE)
- .setLgxPortShelf("00")
- .build())
- .build()))
- .setRxDirection(Map.of(new RxDirectionKey(Uint8.ZERO), new RxDirectionBuilder()
- .setPort(new PortBuilder()
- .setPortDeviceName(rxPortDeviceName)
- .setPortName(rxPortName)
- .setPortRack(TapiStringConstants.PORT_RACK_VALUE)
- .setPortShelf("00")
- .setPortType(TapiStringConstants.PORT_TYPE)
- .build())
- .setLgx(new LgxBuilder()
- .setLgxDeviceName(TapiStringConstants.LGX_DEVICE_NAME)
- .setLgxPortName(TapiStringConstants.LGX_PORT_NAME)
- .setLgxPortRack(TapiStringConstants.PORT_RACK_VALUE)
- .setLgxPortShelf("00")
- .build())
- .build()))
+ .setTxDirection(Map.of(
+ new TxDirectionKey(Uint8.ZERO),
+ new TxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName(txPortDeviceName)
+ .setPortName(txPortName)
+ .setPortRack(TapiStringConstants.PORT_RACK_VALUE)
+ .setPortShelf("00")
+ .setPortType(TapiStringConstants.PORT_TYPE)
+ .build())
+ .setLgx(new LgxBuilder()
+ .setLgxDeviceName(TapiStringConstants.LGX_DEVICE_NAME)
+ .setLgxPortName(TapiStringConstants.LGX_PORT_NAME)
+ .setLgxPortRack(TapiStringConstants.PORT_RACK_VALUE)
+ .setLgxPortShelf("00")
+ .build())
+ .build()))
+ .setRxDirection(Map.of(
+ new RxDirectionKey(Uint8.ZERO),
+ new RxDirectionBuilder()
+ .setPort(new PortBuilder()
+ .setPortDeviceName(rxPortDeviceName)
+ .setPortName(rxPortName)
+ .setPortRack(TapiStringConstants.PORT_RACK_VALUE)
+ .setPortShelf("00")
+ .setPortType(TapiStringConstants.PORT_TYPE)
+ .build())
+ .setLgx(new LgxBuilder()
+ .setLgxDeviceName(TapiStringConstants.LGX_DEVICE_NAME)
+ .setLgxPortName(TapiStringConstants.LGX_PORT_NAME)
+ .setLgxPortRack(TapiStringConstants.PORT_RACK_VALUE)
+ .setLgxPortShelf("00")
+ .build())
+ .build()))
.build();
}
- public static ServiceZEnd buildServiceZEnd(String nodeid, String clli, String txPortDeviceName,
- String txPortName, String rxPortDeviceName, String rxPortName) {
+ public static ServiceZEnd buildServiceZEnd(
+ String nodeid, String clli, String txPortDeviceName,
+ String txPortName, String rxPortDeviceName, String rxPortName) {
return new ServiceZEndBuilder().setClli(clli).setNodeId(new NodeIdType(nodeid))
.setOpticType(OpticTypes.Gray)
.setServiceFormat(ServiceFormat.Ethernet)
LOG.info("Service = {}", service);
Optional<ServicePaths> optServicePaths =
this.serviceDataStoreOperations.getServicePath(service.getServiceName());
- if (!optServicePaths.isPresent()) {
+ if (optServicePaths.isEmpty()) {
LOG.error("No service path found for service {}", service.getServiceName());
return null;
}
- ServicePaths servicePaths = optServicePaths.orElseThrow();
- PathDescription pathDescription = servicePaths.getPathDescription();
+ PathDescription pathDescription = optServicePaths.orElseThrow().getPathDescription();
LOG.info("Path description of service = {}", pathDescription);
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceAEnd serviceAEnd
- = service.getServiceAEnd();
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceAEnd serviceAEnd =
+ service.getServiceAEnd();
// Endpoint creation
EndPoint endPoint1 = mapServiceAEndPoint(serviceAEnd, pathDescription);
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceZEnd serviceZEnd
- = service.getServiceZEnd();
- EndPoint endPoint2 = mapServiceZEndPoint(serviceZEnd, pathDescription);
- Map<EndPointKey, EndPoint> endPointMap = new HashMap<>();
- endPointMap.put(endPoint1.key(), endPoint1);
- endPointMap.put(endPoint2.key(), endPoint2);
+ EndPoint endPoint2 = mapServiceZEndPoint(service.getServiceZEnd(), pathDescription);
+ Map<EndPointKey, EndPoint> endPointMap = new HashMap<>(Map.of(
+ endPoint1.key(), endPoint1,
+ endPoint2.key(), endPoint2));
LOG.info("EndPoints of connectivity services = {}", endPointMap);
// Services Names
- Name name = new NameBuilder().setValueName("Connectivity Service Name").setValue(service.getServiceName())
- .build();
+ Name name =
+ new NameBuilder().setValueName("Connectivity Service Name").setValue(service.getServiceName()).build();
// Connection creation
Map<ConnectionKey, Connection> connMap =
createConnectionsFromService(pathDescription, mapServiceLayerToAend(serviceAEnd));
- LOG.debug("connectionMap for service {} = {} ", name.toString(), connMap.toString());
+ LOG.debug("connectionMap for service {} = {} ", name, connMap);
ConnectivityConstraint conConstr =
new ConnectivityConstraintBuilder().setServiceType(ServiceType.POINTTOPOINTCONNECTIVITY).build();
// TODO: full connectivity service?? With constraints and the rest of fields...
.setAdministrativeState(AdministrativeState.UNLOCKED)
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
- .setUuid(new Uuid(UUID.nameUUIDFromBytes(service.getServiceName().getBytes(StandardCharsets.UTF_8))
- .toString()))
+ .setUuid(new Uuid(
+ UUID.nameUUIDFromBytes(service.getServiceName().getBytes(StandardCharsets.UTF_8)).toString()))
.setLayerProtocolName(mapServiceLayer(serviceAEnd.getServiceFormat(), endPoint1, endPoint2))
.setConnectivityConstraint(conConstr)
.setDirection(ForwardingDirection.BIDIRECTIONAL)
.build();
}
- public Map<ConnectionKey, Connection> createConnectionsFromService(PathDescription pathDescription,
- LayerProtocolName lpn) {
+ public Map<ConnectionKey, Connection> createConnectionsFromService(
+ PathDescription pathDescription, LayerProtocolName lpn) {
Map<ConnectionKey, Connection> connectionServMap = new HashMap<>();
// build lists with ROADM nodes, XPDR/MUX/SWITCH nodes, ROADM DEG TTPs, ROADM SRG TTPs, XPDR CLIENT TTPs
// and XPDR NETWORK TTPs (if any). From the path description. This will help to build the uuid of the CEPs
List<String> rdmNodelist = new ArrayList<>();
List<String> xpdrNodelist = new ArrayList<>();
for (AToZ elem:pathDescription.getAToZDirection().getAToZ().values().stream()
- .sorted((Comparator.comparing(atoz -> Integer.valueOf(atoz.getId())))).collect(Collectors.toList())) {
+ .sorted((Comparator.comparing(atoz -> Integer.valueOf(atoz.getId())))).collect(Collectors.toList())) {
resourceType = elem.getResource().getResource().implementedInterface().getSimpleName();
switch (resourceType) {
case TapiStringConstants.TP:
// - XC Connection between OTSiMC CEPs mapped from OTSiMC NEPs (within a roadm)
// - Top Connection MC betwwen MC CEPs of different roadms
// - Top Connection OTSiMC betwwen OTSiMC CEPs of extreme roadms
- connectionServMap.putAll(createRoadmCepsAndConnections(rdmAddDropTplist, rdmDegTplist, rdmNodelist,
- edgeRoadm1, edgeRoadm2));
+ connectionServMap.putAll(
+ createRoadmCepsAndConnections(rdmAddDropTplist, rdmDegTplist, rdmNodelist, edgeRoadm1, edgeRoadm2));
if (!pathDescription.getAToZDirection().getAToZ().values().stream().findFirst().orElseThrow().getId()
- .contains("ROADM")) {
+ .contains("ROADM")) {
// - XC Connection OTSi betwwen iOTSi y eOTSi of xpdr
// - Top connection OTSi between network ports of xpdrs in the Photonic media layer -> i_OTSi
connectionServMap.putAll(createXpdrCepsAndConnectionsPht(xpdrNetworkTplist, xpdrNodelist));
// Check if OC, OTU and ODU are created
if (openroadmNodeType.equals(OpenroadmNodeType.TPDR)) {
LOG.info("WDM ETH service");
- connectionServMap.putAll(createRoadmCepsAndConnections(rdmAddDropTplist, rdmDegTplist, rdmNodelist,
- edgeRoadm1, edgeRoadm2));
+ connectionServMap.putAll(
+ createRoadmCepsAndConnections(
+ rdmAddDropTplist, rdmDegTplist, rdmNodelist, edgeRoadm1, edgeRoadm2));
connectionServMap.putAll(createXpdrCepsAndConnectionsPht(xpdrNetworkTplist, xpdrNodelist));
this.topConnRdmRdm = null;
xpdrClientTplist = getAssociatedClientsPort(xpdrNetworkTplist);
LOG.info("Associated client ports = {}", xpdrClientTplist);
- connectionServMap.putAll(createXpdrCepsAndConnectionsEth(xpdrClientTplist, xpdrNodelist,
- connectionServMap));
+ connectionServMap.putAll(
+ createXpdrCepsAndConnectionsEth(xpdrClientTplist, xpdrNodelist, connectionServMap));
this.topConnXpdrXpdrPhtn = null;
}
break;
// TODO: We create both ODU and DSR because there is no ODU service creation for the switch
// - XC Connection OTSi between iODU and eODU of xpdr
// - Top connection in the ODU layer, between xpdr eODU ports (?)
- connectionServMap.putAll(createXpdrCepsAndConnectionsDsr(xpdrClientTplist, xpdrNetworkTplist,
- xpdrNodelist));
+ connectionServMap.putAll(
+ createXpdrCepsAndConnectionsDsr(xpdrClientTplist, xpdrNetworkTplist, xpdrNodelist));
this.topConnXpdrXpdrPhtn = null;
}
if (openroadmNodeType.equals(OpenroadmNodeType.MUXPDR)) {
// TODO: OTN service but mux has 3 steps at rendering. Verify that things exist
- connectionServMap.putAll(createXpdrCepsAndConnectionsDsr(xpdrClientTplist, xpdrNetworkTplist,
- xpdrNodelist));
+ connectionServMap.putAll(
+ createXpdrCepsAndConnectionsDsr(xpdrClientTplist, xpdrNetworkTplist, xpdrNodelist));
this.topConnXpdrXpdrOdu = null;
}
break;
default:
LOG.error("Service type format not supported");
}
- LOG.debug("CONNSERVERMAP = {}", connectionServMap.toString());
+ LOG.debug("CONNSERVERMAP = {}", connectionServMap);
return connectionServMap;
}
.child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid))
.build();
try {
- Optional<OwnedNodeEdgePoint> optionalOnep = this.networkTransactionService.read(
- LogicalDatastoreType.OPERATIONAL, onepIID).get();
+ Optional<OwnedNodeEdgePoint> optionalOnep =
+ this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, onepIID).get();
if (optionalOnep.isPresent()) {
LOG.error("ONEP is already present in datastore");
return;
}
// merge in datastore
- this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, onepIID,
- onep);
+ this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, onepIID, onep);
this.networkTransactionService.commit().get();
- LOG.info("NEP {} added successfully.", onep.getName().toString());
+ LOG.info("NEP {} added successfully.", onep.getName());
} catch (InterruptedException | ExecutionException e) {
- LOG.error("Couldnt put NEP {} in topology, error = ", onep.getName().toString(), e);
+ LOG.error("Couldnt put NEP {} in topology, error = ", onep.getName(), e);
}
}
public ServiceCreateInput createORServiceInput(CreateConnectivityServiceInput input, Uuid serviceUuid) {
// TODO: not taking into account all the constraints. Only using EndPoints and Connectivity Constraint.
- Map<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPointKey,
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint>
- endPointMap = input.getEndPoint();
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .create.connectivity.service.input.EndPointKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .create.connectivity.service.input.EndPoint> endPointMap = input.getEndPoint();
ConnectionType connType = null;
ServiceFormat serviceFormat = null;
- String nodeAid = String.join("+", endPointMap.values().stream().findFirst().orElseThrow().getLocalId(),
+ String nodeAid = String.join("+",
+ endPointMap.values().stream().findFirst().orElseThrow().getLocalId(),
TapiStringConstants.XPDR);
- String nodeZid = String.join("+", endPointMap.values().stream().skip(1).findFirst().orElseThrow().getLocalId(),
+ String nodeZid = String.join("+",
+ endPointMap.values().stream().skip(1).findFirst().orElseThrow().getLocalId(),
TapiStringConstants.XPDR);
LOG.info("NodeAid = {}", nodeAid);
LOG.info("NodeZid = {}", nodeZid);
Uint64 capacity = Uint64.valueOf(Math.abs(
input.getConnectivityConstraint().getRequestedCapacity().getTotalSize().getValue().intValue()));
// map endpoints into service end points. Map the type of service from TAPI to OR
- ServiceAEnd serviceAEnd = tapiEndPointToServiceAPoint(endPointMap.values().stream().findFirst().orElseThrow(),
+ ServiceAEnd serviceAEnd = tapiEndPointToServiceAPoint(
+ endPointMap.values().stream().findFirst().orElseThrow(),
serviceFormat, nodeAid, capacity, input.getLayerProtocolName());
- ServiceZEnd serviceZEnd = tapiEndPointToServiceZPoint(endPointMap.values().stream().skip(1).findFirst()
- .orElseThrow(), serviceFormat, nodeZid, capacity, input.getLayerProtocolName());
+ ServiceZEnd serviceZEnd = tapiEndPointToServiceZPoint(
+ endPointMap.values().stream().skip(1).findFirst().orElseThrow(),
+ serviceFormat, nodeZid, capacity, input.getLayerProtocolName());
if (serviceAEnd == null || serviceZEnd == null) {
LOG.error("Couldnt map endpoints to service end");
return null;
}
private LayerProtocolName mapServiceLayerToAend(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceAEnd
- serviceAEnd) {
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526
+ .service.ServiceAEnd serviceAEnd) {
ServiceFormat serviceFormat = serviceAEnd.getServiceFormat();
switch (serviceFormat) {
case OC:
case ODU:
return LayerProtocolName.ODU;
case Ethernet:
- if (getOpenroadmType(serviceAEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort()
- .getPortDeviceName()).equals(OpenroadmNodeType.TPDR)) {
+ if (getOpenroadmType(
+ serviceAEnd.getTxDirection().values().stream().findFirst().orElseThrow()
+ .getPort().getPortDeviceName())
+ .equals(OpenroadmNodeType.TPDR)) {
return LayerProtocolName.ETH;
}
return LayerProtocolName.DSR;
}
return null;
}
+ //TODO factorize these two similar methods
private OpenroadmNodeType getOpenroadmType(String nodeName) {
LOG.info("Node name = {}", nodeName);
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+",nodeName, TapiStringConstants.XPDR))
- .getBytes(StandardCharsets.UTF_8)).toString());
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node tapiNode
- = this.tapiContext.getTapiNode(this.tapiTopoUuid, nodeUuid);
- if (tapiNode != null) {
- return OpenroadmNodeType.forName(tapiNode.getName().get(new NameKey("Node Type"))
- .getValue());
- }
- return null;
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node tapiNode =
+ this.tapiContext.getTapiNode(
+ this.tapiTopoUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+",nodeName, TapiStringConstants.XPDR)).getBytes(StandardCharsets.UTF_8))
+ .toString()));
+ return tapiNode == null
+ ? null
+ : OpenroadmNodeType.forName(tapiNode.getName().get(new NameKey("Node Type")).getValue());
}
- private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsEth(List<String> xpdrClientTplist,
- List<String> xpdrNodelist,
- Map<ConnectionKey, Connection> lowerConn) {
+ private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsEth(
+ List<String> xpdrClientTplist, List<String> xpdrNodelist, Map<ConnectionKey, Connection> lowerConn) {
// TODO: do we need to create cross connection between iODU and eODU??
// add the lower connections of the previous steps for this kind of service
Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
LowerConnection conn = new LowerConnectionBuilder().setConnectionUuid(lowConn.getConnectionUuid()).build();
xcMap.put(conn.key(), conn);
}
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMapDsr = new HashMap<>();
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey, ConnectionEndPoint> cepMapDsr = new HashMap<>();
// Create 1 cep per Xpdr in the CLIENT
// 1 top connection DSR between the CLIENT xpdrs
for (String xpdr:xpdrNodelist) {
LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrClient = xpdrClientTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
- ConnectionEndPoint netCep1 = createCepXpdr(spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR,
- LayerProtocolName.DSR);
- putXpdrCepInTopologyContext(xpdr, spcXpdrClient, TapiStringConstants.DSR,
- TapiStringConstants.XPDR, netCep1);
-
+ String spcXpdrClient =
+ xpdrClientTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst().orElseThrow();
+ ConnectionEndPoint netCep1 =
+ createCepXpdr(spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR, LayerProtocolName.DSR);
+ putXpdrCepInTopologyContext(
+ xpdr, spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR, netCep1);
cepMapDsr.put(netCep1.key(), netCep1);
}
- String spcXpdr1 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
-
// DSR top connection between edge xpdr CLIENT DSR
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connectionDsr = createTopConnection(spcXpdr1, spcXpdr2, cepMapDsr, TapiStringConstants.DSR,
- LayerProtocolName.DSR, xcMap, this.topConnXpdrXpdrPhtn);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connectionDsr =
+ createTopConnection(
+ //spcXpdr1,
+ xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(0)))
+ .findFirst().orElseThrow(),
+ //spcXpdr2,
+ xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(xpdrNodelist.size() - 1)))
+ .findFirst().orElseThrow(),
+ cepMapDsr, TapiStringConstants.DSR, LayerProtocolName.DSR, xcMap, this.topConnXpdrXpdrPhtn);
this.connectionFullMap.put(connectionDsr.key(), connectionDsr);
-
// DSR top connection that will be added to the service object
Connection conn1 = new ConnectionBuilder().setConnectionUuid(connectionDsr.getUuid()).build();
- connServMap.put(conn1.key(), conn1);
-
- return connServMap;
+ return new HashMap<>(Map.of(conn1.key(), conn1));
}
- private Map<ConnectionKey,Connection> createXpdrCepsAndConnectionsDsr(List<String> xpdrClientTplist,
- List<String> xpdrNetworkTplist,
- List<String> xpdrNodelist) {
+ private Map<ConnectionKey,Connection> createXpdrCepsAndConnectionsDsr(
+ List<String> xpdrClientTplist, List<String> xpdrNetworkTplist, List<String> xpdrNodelist) {
Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMapDsr = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMapOdu = new HashMap<>();
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey, ConnectionEndPoint> cepMapDsr = new HashMap<>();
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey, ConnectionEndPoint> cepMapOdu = new HashMap<>();
// TODO: when upgrading the models to 2.1.3, get the connection inclusion because those connections will
// be added to the lower connection of a top connection
Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
// 1 top connection between eODU and a top connection DSR between the CLIENT xpdrs
for (String xpdr:xpdrNodelist) {
LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrClient = xpdrClientTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
- ConnectionEndPoint clientCep1 = createCepXpdr(spcXpdrClient, TapiStringConstants.DSR,
- TapiStringConstants.XPDR, LayerProtocolName.DSR);
- putXpdrCepInTopologyContext(xpdr, spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR,
- clientCep1);
-
- ConnectionEndPoint clientCep2 = createCepXpdr(spcXpdrClient, TapiStringConstants.E_ODU,
- TapiStringConstants.XPDR, LayerProtocolName.ODU);
- putXpdrCepInTopologyContext(xpdr, spcXpdrClient, TapiStringConstants.E_ODU, TapiStringConstants.XPDR,
- clientCep2);
-
- String spcXpdrNetwork = getAssociatedNetworkPort(spcXpdrClient, xpdrNetworkTplist);
- ConnectionEndPoint netCep3 = getAssociatediODUCep(spcXpdrNetwork);
-
+ String spcXpdrClient =
+ xpdrClientTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst().orElseThrow();
+ ConnectionEndPoint clientCep1 =
+ createCepXpdr(spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR, LayerProtocolName.DSR);
+ putXpdrCepInTopologyContext(
+ xpdr, spcXpdrClient, TapiStringConstants.DSR, TapiStringConstants.XPDR, clientCep1);
+ ConnectionEndPoint clientCep2 = createCepXpdr(
+ spcXpdrClient, TapiStringConstants.E_ODU, TapiStringConstants.XPDR, LayerProtocolName.ODU);
+ putXpdrCepInTopologyContext(
+ xpdr, spcXpdrClient, TapiStringConstants.E_ODU, TapiStringConstants.XPDR, clientCep2);
cepMapDsr.put(clientCep1.key(), clientCep1);
cepMapOdu.put(clientCep2.key(), clientCep2);
+
+ String spcXpdrNetwork = getAssociatedNetworkPort(spcXpdrClient, xpdrNetworkTplist);
// Create x connection between I_ODU and E_ODU within xpdr
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createXCBetweenCeps(clientCep2, netCep3, spcXpdrClient, spcXpdrNetwork,
- TapiStringConstants.ODU, LayerProtocolName.ODU);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection =
+ createXCBetweenCeps(
+ clientCep2, getAssociatediODUCep(spcXpdrNetwork),
+ spcXpdrClient, spcXpdrNetwork, TapiStringConstants.ODU, LayerProtocolName.ODU);
this.connectionFullMap.put(connection.key(), connection);
// Create X connection that will be added to the service object
}
// DSR top connection between edge xpdr CLIENT DSR
- String spcXpdr1 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
-
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connectionOdu = createTopConnection(spcXpdr1, spcXpdr2, cepMapOdu, TapiStringConstants.E_ODU,
- LayerProtocolName.ODU, xcMap, this.topConnXpdrXpdrOdu);
+ String spcXpdr1 =
+ xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(0)))
+ .findFirst().orElseThrow();
+ String spcXpdr2 =
+ xpdrClientTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(xpdrNodelist.size() - 1)))
+ .findFirst().orElseThrow();
+
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connectionOdu =
+ createTopConnection(
+ spcXpdr1, spcXpdr2, cepMapOdu, TapiStringConstants.E_ODU,
+ LayerProtocolName.ODU, xcMap, this.topConnXpdrXpdrOdu);
this.connectionFullMap.put(connectionOdu.key(), connectionOdu);
// ODU top connection that will be added to the service object
LowerConnection lowerConn = new LowerConnectionBuilder().setConnectionUuid(connectionOdu.getUuid()).build();
xcMap.put(lowerConn.key(), lowerConn);
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connectionDsr = createTopConnection(spcXpdr1, spcXpdr2, cepMapDsr, TapiStringConstants.DSR,
- LayerProtocolName.DSR, xcMap, this.topConnXpdrXpdrPhtn);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connectionDsr =
+ createTopConnection(
+ spcXpdr1, spcXpdr2, cepMapDsr, TapiStringConstants.DSR,
+ LayerProtocolName.DSR, xcMap, this.topConnXpdrXpdrPhtn);
this.connectionFullMap.put(connectionDsr.key(), connectionDsr);
-
// DSR top connection that will be added to the service object
Connection conn1 = new ConnectionBuilder().setConnectionUuid(connectionDsr.getUuid()).build();
connServMap.put(conn1.key(), conn1);
-
return connServMap;
}
- private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsOdu(List<String> xpdrNetworkTplist,
- List<String> xpdrNodelist) {
+ private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsOdu(
+ List<String> xpdrNetworkTplist, List<String> xpdrNodelist) {
Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMap = new HashMap<>();
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey, ConnectionEndPoint> cepMap = new HashMap<>();
// TODO: when upgrading the models to 2.1.3, get the connection inclusion because those connections will
// be added to the lower connection of a top connection
- Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
-
// Create 1 cep per Xpdr in the I_ODU and a top
// connection iODU between the xpdrs
for (String xpdr:xpdrNodelist) {
LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrNetwork = xpdrNetworkTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
- ConnectionEndPoint netCep1 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.I_ODU,
- TapiStringConstants.XPDR, LayerProtocolName.ODU);
- putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.I_ODU, TapiStringConstants.XPDR,
- netCep1);
-
+ String spcXpdrNetwork =
+ xpdrNetworkTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst().orElseThrow();
+ ConnectionEndPoint netCep1 =
+ createCepXpdr(
+ spcXpdrNetwork, TapiStringConstants.I_ODU, TapiStringConstants.XPDR, LayerProtocolName.ODU);
+ putXpdrCepInTopologyContext(
+ xpdr, spcXpdrNetwork, TapiStringConstants.I_ODU, TapiStringConstants.XPDR, netCep1);
cepMap.put(netCep1.key(), netCep1);
}
-
// ODU top connection between edge xpdr i_ODU
- String spcXpdr1 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createTopConnection(spcXpdr1, spcXpdr2, cepMap, TapiStringConstants.I_ODU,
- LayerProtocolName.ODU, xcMap, this.topConnXpdrXpdrPhtn);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection =
+ createTopConnection(
+ //spcXpdr1,
+ xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(0)))
+ .findFirst().orElseThrow(),
+ //spcXpdr2,
+ xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(xpdrNodelist.size() - 1)))
+ .findFirst().orElseThrow(),
+ cepMap, TapiStringConstants.I_ODU,
+ LayerProtocolName.ODU, new HashMap<>(), this.topConnXpdrXpdrPhtn);
this.connectionFullMap.put(connection.key(), connection);
-
// ODU top connection that will be added to the service object
Connection conn = new ConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
connServMap.put(conn.key(), conn);
this.topConnXpdrXpdrOdu = conn;
-
return connServMap;
}
- private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsPht(List<String> xpdrNetworkTplist,
- List<String> xpdrNodelist) {
-
+ private Map<ConnectionKey, Connection> createXpdrCepsAndConnectionsPht(
+ List<String> xpdrNetworkTplist, List<String> xpdrNodelist) {
// TODO: when upgrading the models to 2.1.3, get the connection inclusion because those connections will
// be added to the lower connection of a top connection
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
// create ceps and x connections within xpdr
for (String xpdr:xpdrNodelist) {
LOG.info("Creating ceps and xc for xpdr {}", xpdr);
- String spcXpdrNetwork = xpdrNetworkTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst()
- .orElseThrow();
+ String spcXpdrNetwork =
+ xpdrNetworkTplist.stream().filter(netp -> netp.contains(xpdr)).findFirst().orElseThrow();
// There should be 1 network tp per xpdr
// Just create 2 different CEPs (1 OTS + 1 OTSI_MC)
- ConnectionEndPoint netCep1 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.PHTNC_MEDIA_OTS,
- TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
- putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.PHTNC_MEDIA_OTS,
- TapiStringConstants.XPDR, netCep1);
- ConnectionEndPoint netCep2 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.OTSI_MC,
- TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
- putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.OTSI_MC, TapiStringConstants.XPDR,
- netCep2);
+ ConnectionEndPoint netCep1 = createCepXpdr(
+ spcXpdrNetwork, TapiStringConstants.PHTNC_MEDIA_OTS,
+ TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
+ putXpdrCepInTopologyContext(
+ xpdr, spcXpdrNetwork, TapiStringConstants.PHTNC_MEDIA_OTS, TapiStringConstants.XPDR, netCep1);
+ ConnectionEndPoint netCep2 = createCepXpdr(
+ spcXpdrNetwork, TapiStringConstants.OTSI_MC,
+ TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
+ putXpdrCepInTopologyContext(
+ xpdr, spcXpdrNetwork, TapiStringConstants.OTSI_MC, TapiStringConstants.XPDR, netCep2);
// ConnectionEndPoint netCep3 = createCepXpdr(spcXpdrNetwork, TapiStringConstants.I_OTSI,
// TapiStringConstants.XPDR, LayerProtocolName.PHOTONICMEDIA);
// putXpdrCepInTopologyContext(xpdr, spcXpdrNetwork, TapiStringConstants.I_OTSI, TapiStringConstants.OTSI,
// netCep3);
-
cepMap.put(netCep1.key(), netCep1);
cepMap.put(netCep2.key(), netCep2);
// cepMap.put(netCep3.key(), netCep3);
}
-
// OTSi top connection between edge OTSI_MC Xpdr
- Map<LowerConnectionKey, LowerConnection> xcMap = new HashMap<>();
- String spcXpdr1 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(0))).findFirst().orElseThrow();
- String spcXpdr2 = xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist
- .get(xpdrNodelist.size() - 1))).findFirst().orElseThrow();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createTopConnection(spcXpdr1, spcXpdr2, cepMap, TapiStringConstants.OTSI_MC,
- LayerProtocolName.PHOTONICMEDIA, xcMap, this.topConnRdmRdm);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection =
+ createTopConnection(
+ //spcXpdr1,
+ xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(0)))
+ .findFirst().orElseThrow(),
+ //spcXpdr2,
+ xpdrNetworkTplist.stream().filter(adp -> adp.contains(xpdrNodelist.get(xpdrNodelist.size() - 1)))
+ .findFirst().orElseThrow(),
+ cepMap, TapiStringConstants.OTSI_MC,
+ LayerProtocolName.PHOTONICMEDIA, new HashMap<>(), this.topConnRdmRdm);
this.connectionFullMap.put(connection.key(), connection);
-
- // OTSi top connection that will be added to the service object
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
+ // OTSi top connection that will be added to the service object
Connection conn = new ConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- connServMap.put(conn.key(), conn);
this.topConnXpdrXpdrPhtn = conn;
-
- return connServMap;
+ return new HashMap<>(Map.of(conn.key(), conn));
}
- private Map<ConnectionKey, Connection> createRoadmCepsAndConnections(List<String> rdmAddDropTplist,
- List<String> rdmDegTplist,
- List<String> rdmNodelist,
- String edgeRoadm1, String edgeRoadm2) {
+ private Map<ConnectionKey, Connection> createRoadmCepsAndConnections(
+ List<String> rdmAddDropTplist, List<String> rdmDegTplist, List<String> rdmNodelist,
+ String edgeRoadm1, String edgeRoadm2) {
// TODO: will need to check if things exist already or not
- Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMap = new HashMap<>();
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey, ConnectionEndPoint> cepMap = new HashMap<>();
// create ceps and x connections within roadm
Map<LowerConnectionKey, LowerConnection> xcLowerMap = new HashMap<>();
for (String roadm : rdmNodelist) {
LOG.info("Creating ceps and xc for roadm {}", roadm);
if (roadm.equals(edgeRoadm1) || roadm.equals(edgeRoadm2)) {
LOG.info("EDGE ROADM, cross connections needed between SRG and DEG");
- String spcRdmAD = rdmAddDropTplist.stream().filter(adp -> adp.contains(roadm)).findFirst()
- .orElseThrow();
+ String spcRdmAD = rdmAddDropTplist.stream().filter(adp -> adp.contains(roadm))
+ .findFirst().orElseThrow();
LOG.info("AD port of ROADm {} = {}", roadm, spcRdmAD);
// There should be only 1 AD and 1 DEG per roadm
// TODO photonic media model should be updated to have the corresponding CEPs. I will just create
LOG.info("Going to create cross connections for ROADM {}", roadm);
// Create X connections between MC and OTSi_MC for full map
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection1
- = createXCBetweenCeps(adCep2, degCep2, spcRdmAD, spcRdmDEG, TapiStringConstants.MC,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection1 =
+ createXCBetweenCeps(
+ adCep2, degCep2, spcRdmAD, spcRdmDEG, TapiStringConstants.MC,
LayerProtocolName.PHOTONICMEDIA);
- LOG.info("Cross connection 1 created = {}", connection1.toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection2
- = createXCBetweenCeps(adCep3, degCep3, spcRdmAD, spcRdmDEG, TapiStringConstants.OTSI_MC,
- LayerProtocolName.PHOTONICMEDIA);
- LOG.info("Cross connection 2 created = {}", connection2.toString());
+ LOG.info("Cross connection 1 created = {}", connection1);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection2 =
+ createXCBetweenCeps(
+ adCep3, degCep3, spcRdmAD, spcRdmDEG, TapiStringConstants.OTSI_MC,
+ LayerProtocolName.PHOTONICMEDIA);
+ LOG.info("Cross connection 2 created = {}", connection2);
this.connectionFullMap.put(connection1.key(), connection1);
this.connectionFullMap.put(connection2.key(), connection2);
cepMap.put(deg1Cep2.key(), deg1Cep2);
cepMap.put(deg1Cep3.key(), deg1Cep3);
- String spcRdmDEG2 = rdmDegTplist.stream().filter(adp -> adp.contains(roadm)).skip(1).findFirst()
- .orElseThrow();
+ String spcRdmDEG2 =
+ rdmDegTplist.stream().filter(adp -> adp.contains(roadm)).skip(1).findFirst().orElseThrow();
LOG.info("Degree 2 port of ROADm {} = {}", roadm, spcRdmDEG2);
ConnectionEndPoint deg2Cep0 = createCepRoadm(spcRdmDEG2, TapiStringConstants.PHTNC_MEDIA_OTS);
LOG.info("Going to create cross connections for ROADM {}", roadm);
// Create X connections between MC and OTSi_MC for full map
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection1
- = createXCBetweenCeps(deg1Cep2, deg2Cep2, spcRdmDEG1, spcRdmDEG2,
- TapiStringConstants.MC, LayerProtocolName.PHOTONICMEDIA);
- LOG.info("Cross connection 1 created = {}", connection1.toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection connection2
- = createXCBetweenCeps(deg1Cep3, deg2Cep3, spcRdmDEG1, spcRdmDEG2,
- TapiStringConstants.OTSI_MC, LayerProtocolName.PHOTONICMEDIA);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection1 =
+ createXCBetweenCeps(
+ deg1Cep2, deg2Cep2, spcRdmDEG1, spcRdmDEG2,
+ TapiStringConstants.MC, LayerProtocolName.PHOTONICMEDIA);
+ LOG.info("Cross connection 1 created = {}", connection1);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection2 =
+ createXCBetweenCeps(
+ deg1Cep3, deg2Cep3, spcRdmDEG1, spcRdmDEG2,
+ TapiStringConstants.OTSI_MC, LayerProtocolName.PHOTONICMEDIA);
LOG.info("Cross connection 2 created = {}", connection2.toString());
this.connectionFullMap.put(connection1.key(), connection1);
this.connectionFullMap.put(connection2.key(), connection2);
// Create X connections that will be added to the service object
LowerConnection conn1 = new LowerConnectionBuilder().setConnectionUuid(connection1.getUuid()).build();
- LowerConnection conn2 = new LowerConnectionBuilder().setConnectionUuid(connection2.getUuid()).build();
-
xcLowerMap.put(conn1.key(), conn1);
+ LowerConnection conn2 = new LowerConnectionBuilder().setConnectionUuid(connection2.getUuid()).build();
xcLowerMap.put(conn2.key(), conn2);
}
}
String spcRdmAD2 = rdmAddDropTplist.stream().filter(adp -> adp.contains(edgeRoadm2)).findFirst().orElseThrow();
// MC top connection between edge roadms
LOG.info("Going to created top connection between MC");
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection = createTopConnection(spcRdmAD1, spcRdmAD2, cepMap, TapiStringConstants.MC,
- LayerProtocolName.PHOTONICMEDIA, xcLowerMap, null);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection =
+ createTopConnection(
+ spcRdmAD1, spcRdmAD2, cepMap, TapiStringConstants.MC,
+ LayerProtocolName.PHOTONICMEDIA, xcLowerMap, null);
this.connectionFullMap.put(connection.key(), connection);
- LOG.info("Top connection created = {}", connection.toString());
+ LOG.info("Top connection created = {}", connection);
- Map<ConnectionKey, Connection> connServMap = new HashMap<>();
- // OTSiMC top connections that will be added to the service object
- Connection conn = new ConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- connServMap.put(conn.key(), conn);
LowerConnection conn1 = new LowerConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
- Map<LowerConnectionKey, LowerConnection> topLowerMap = new HashMap<>();
- topLowerMap.put(conn1.key(), conn1);
-
// OTSiMC top connection between edge roadms
LOG.info("Going to created top connection between OTSiMC");
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- connection1 = createTopConnection(spcRdmAD1, spcRdmAD2, cepMap, TapiStringConstants.OTSI_MC,
- LayerProtocolName.PHOTONICMEDIA, topLowerMap, null);
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection connection1 =
+ createTopConnection(
+ spcRdmAD1, spcRdmAD2, cepMap, TapiStringConstants.OTSI_MC,
+ LayerProtocolName.PHOTONICMEDIA,
+ //topLowerMap,
+ new HashMap<>(Map.of(conn1.key(), conn1)),
+ null);
this.connectionFullMap.put(connection1.key(), connection1);
- LOG.info("Top connection created = {}", connection1.toString());
+ LOG.info("Top connection created = {}", connection1);
// OTSiMC top connections that will be added to the service object
+ Connection conn = new ConnectionBuilder().setConnectionUuid(connection.getUuid()).build();
Connection conn2 = new ConnectionBuilder().setConnectionUuid(connection1.getUuid()).build();
- connServMap.put(conn2.key(), conn2);
this.topConnRdmRdm = conn2;
- return connServMap;
+ return new HashMap<>(Map.of(conn.key(), conn, conn2.key(), conn2));
}
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- createTopConnection(String tp1, String tp2,
- Map<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey,
- ConnectionEndPoint> cepMap, String qual, LayerProtocolName topPortocol,
- Map<LowerConnectionKey, LowerConnection> xcMap, Connection additionalLowerConn) {
+ private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection createTopConnection(
+ String tp1,
+ String tp2,
+ Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey, ConnectionEndPoint> cepMap,
+ String qual, LayerProtocolName topPortocol,
+ Map<LowerConnectionKey, LowerConnection> xcMap,
+ Connection additionalLowerConn) {
// find cep for each AD MC of roadm 1 and 2
- LOG.info("Top connection name = {}", String.join("+", "TOP", tp1, tp2, qual));
+ String topConnName = String.join("+", "TOP", tp1, tp2, qual);
+ LOG.info("Top connection name = {}", topConnName);
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.ConnectionEndPoint adCep1 =
- cepMap.get(new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey(
- new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", tp1.split("\\+")[0],
- qual, tp1.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString())));
+ cepMap.get(
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey(new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "CEP", tp1.split("\\+")[0], qual, tp1.split("\\+")[1]))
+ .getBytes(StandardCharsets.UTF_8)).toString())));
LOG.info("ADCEP1 = {}", adCep1);
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cep1 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPoint cep1 =
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPointBuilder()
.setNodeEdgePointUuid(adCep1.getParentNodeEdgePoint().getNodeEdgePointUuid())
.setNodeUuid(adCep1.getParentNodeEdgePoint().getNodeUuid())
.setTopologyUuid(adCep1.getParentNodeEdgePoint().getTopologyUuid())
.setConnectionEndPointUuid(adCep1.getUuid())
.build();
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.ConnectionEndPoint adCep2 =
- cepMap.get(new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey(
- new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", tp2.split("\\+")[0],
- qual, tp2.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString())));
+ cepMap.get(
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .cep.list.ConnectionEndPointKey(
+ new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "CEP", tp2.split("\\+")[0], qual, tp2.split("\\+")[1]))
+ .getBytes(StandardCharsets.UTF_8)).toString())));
LOG.info("ADCEP2 = {}", adCep2);
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cep2 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPoint cep2 =
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPointBuilder()
.setNodeEdgePointUuid(adCep2.getParentNodeEdgePoint().getNodeEdgePointUuid())
.setNodeUuid(adCep2.getParentNodeEdgePoint().getNodeUuid())
.setTopologyUuid(adCep2.getParentNodeEdgePoint().getTopologyUuid())
.setConnectionEndPointUuid(adCep1.getUuid())
.build();
- Map<ConnectionEndPointKey, org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint> ceps = new HashMap<>();
- ceps.put(cep1.key(), cep1);
- ceps.put(cep2.key(), cep2);
Name connName = new NameBuilder()
.setValueName("Connection name")
- .setValue(String.join("+", "TOP", tp1, tp2, qual))
+ .setValue(topConnName)
.build();
// TODO: lower connection, supported link.......
if (additionalLowerConn != null) {
xcMap.putIfAbsent(new LowerConnectionKey(additionalLowerConn.getConnectionUuid()),
new LowerConnectionBuilder().setConnectionUuid(additionalLowerConn.getConnectionUuid()).build());
}
- return new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "TOP", tp1, tp2, qual))
- .getBytes(StandardCharsets.UTF_8)).toString()))
+ return new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.ConnectionBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(topConnName.getBytes(StandardCharsets.UTF_8)).toString()))
.setName(Map.of(connName.key(), connName))
- .setConnectionEndPoint(ceps)
+ .setConnectionEndPoint(new HashMap<>(Map.of(cep1.key(), cep1, cep2.key(), cep2)))
.setOperationalState(OperationalState.ENABLED)
.setLayerProtocolName(topPortocol)
.setLifecycleState(LifecycleState.INSTALLED)
.build();
}
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection
- createXCBetweenCeps(ConnectionEndPoint cep1, ConnectionEndPoint cep2, String tp1, String tp2, String qual,
- LayerProtocolName xcProtocol) {
+ private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.Connection createXCBetweenCeps(
+ ConnectionEndPoint cep1, ConnectionEndPoint cep2,
+ String tp1, String tp2, String qual, LayerProtocolName xcProtocol) {
+ String crossConnName = String.join("+", "XC", tp1, tp2, qual);
LOG.info("Creation cross connection between: {} and {}", tp1, tp2);
- LOG.info("Cross connection name = {}", String.join("+", "XC", tp1, tp2, qual));
- LOG.debug("Parent NEP of CEP1 = {}", cep1.getParentNodeEdgePoint().toString());
- LOG.debug("Parent NEP CEP2 = {}", cep2.getParentNodeEdgePoint().toString());
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cepServ1 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
- .setNodeEdgePointUuid(cep1.getParentNodeEdgePoint().getNodeEdgePointUuid())
- .setNodeUuid(cep1.getParentNodeEdgePoint().getNodeUuid())
- .setTopologyUuid(cep1.getParentNodeEdgePoint().getTopologyUuid())
- .setConnectionEndPointUuid(cep1.getUuid())
- .build();
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint cepServ2 =
- new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPointBuilder()
- .setNodeEdgePointUuid(cep2.getParentNodeEdgePoint().getNodeEdgePointUuid())
- .setNodeUuid(cep2.getParentNodeEdgePoint().getNodeUuid())
- .setTopologyUuid(cep2.getParentNodeEdgePoint().getTopologyUuid())
- .setConnectionEndPointUuid(cep2.getUuid())
- .build();
- Map<ConnectionEndPointKey, org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connection.ConnectionEndPoint> ceps = new HashMap<>();
- ceps.put(cepServ1.key(), cepServ1);
- ceps.put(cepServ2.key(), cepServ2);
+ LOG.info("Cross connection name = {}", crossConnName);
+ LOG.debug("Parent NEP of CEP1 = {}", cep1.getParentNodeEdgePoint());
+ LOG.debug("Parent NEP CEP2 = {}", cep2.getParentNodeEdgePoint());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPoint cepServ1 =
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPointBuilder()
+ .setNodeEdgePointUuid(cep1.getParentNodeEdgePoint().getNodeEdgePointUuid())
+ .setNodeUuid(cep1.getParentNodeEdgePoint().getNodeUuid())
+ .setTopologyUuid(cep1.getParentNodeEdgePoint().getTopologyUuid())
+ .setConnectionEndPointUuid(cep1.getUuid())
+ .build();
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPoint cepServ2 =
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connection.ConnectionEndPointBuilder()
+ .setNodeEdgePointUuid(cep2.getParentNodeEdgePoint().getNodeEdgePointUuid())
+ .setNodeUuid(cep2.getParentNodeEdgePoint().getNodeUuid())
+ .setTopologyUuid(cep2.getParentNodeEdgePoint().getTopologyUuid())
+ .setConnectionEndPointUuid(cep2.getUuid())
+ .build();
Name connName = new NameBuilder()
.setValueName("Connection name")
- .setValue(String.join("+", "XC", tp1, tp2, qual))
+ .setValue(crossConnName)
.build();
// TODO: lower connection, supported link.......
- return new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "XC", tp1, tp2, qual))
- .getBytes(StandardCharsets.UTF_8)).toString()))
+ return new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .connectivity.context.ConnectionBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(crossConnName.getBytes(StandardCharsets.UTF_8)).toString()))
.setName(Map.of(connName.key(), connName))
- .setConnectionEndPoint(ceps)
+ .setConnectionEndPoint(new HashMap<>(Map.of(cepServ1.key(), cepServ1, cepServ2.key(), cepServ2)))
.setOperationalState(OperationalState.ENABLED)
.setLayerProtocolName(xcProtocol)
.setLifecycleState(LifecycleState.INSTALLED)
}
private ConnectionEndPoint createCepRoadm(String id, String qualifier) {
- LOG.info("NEP = {}", String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]));
+ String nepId = String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]);
+ String nodeNepId = String.join("+",id.split("\\+")[0], TapiStringConstants.PHTNC_MEDIA);
+ LOG.info("NEP = {}", nepId);
Name cepName = new NameBuilder()
.setValueName("ConnectionEndPoint name")
- .setValue(String.join("+", id.split("\\+")[0], qualifier,
- id.split("\\+")[1]))
+ .setValue(nepId)
.build();
ParentNodeEdgePoint pnep = new ParentNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
+ .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes(
+ nepId.getBytes(StandardCharsets.UTF_8))
+ .toString()))
+ .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes(
+ nodeNepId.getBytes(StandardCharsets.UTF_8))
.toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8))
+ .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER.getBytes(StandardCharsets.UTF_8))
.toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
.build();
String clientQualifier = "";
switch (qualifier) {
TapiStringConstants.OTSI_MC, onepOTSiMC);
break;
default:
- LOG.debug("not currently handling client NEP for OTSiMC CEP {}",
- String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]));
+ LOG.debug("not currently handling client NEP for OTSiMC CEP {}", nepId);
break;
}
ClientNodeEdgePoint cnep = new ClientNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- clientQualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
+ .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", id.split("\\+")[0], clientQualifier, id.split("\\+")[1]))
+ .getBytes(StandardCharsets.UTF_8))
.toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8))
+ .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes(
+ nodeNepId.getBytes(StandardCharsets.UTF_8))
+ .toString()))
+ .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER.getBytes(StandardCharsets.UTF_8))
.toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
.build();
// TODO: add augmentation with the corresponding cep-spec (i.e. MC, OTSiMC...)
// TODO: add parent ONEP??
ConnectionEndPointBuilder cepBldr = new ConnectionEndPointBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "CEP", id.split("\\+")[0], qualifier, id.split("\\+")[1]))
+ .getBytes(StandardCharsets.UTF_8))
.toString()))
.setParentNodeEdgePoint(pnep)
.setName(Map.of(cepName.key(), cepName))
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA);
- if (!(TapiStringConstants.OTSI_MC.equals(qualifier))) {
- cepBldr.setClientNodeEdgePoint(Map.of(cnep.key(), cnep));
- }
- return cepBldr.build();
+ return TapiStringConstants.OTSI_MC.equals(qualifier)
+ ? cepBldr.build()
+ : cepBldr.setClientNodeEdgePoint(Map.of(cnep.key(), cnep)).build();
}
- private ConnectionEndPoint createCepXpdr(String id, String qualifier, String nodeLayer,
- LayerProtocolName cepProtocol) {
+ private ConnectionEndPoint createCepXpdr(
+ String id, String qualifier, String nodeLayer, LayerProtocolName cepProtocol) {
+ String nepId = String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]);
+ String nepNodeId = String.join("+",id.split("\\+")[0], TapiStringConstants.XPDR);
Name cepName = new NameBuilder()
.setValueName("ConnectionEndPoint name")
- .setValue(String.join("+", id.split("\\+")[0], qualifier,
- id.split("\\+")[1]))
+ .setValue(nepId)
.build();
ParentNodeEdgePoint pnep = new ParentNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.XPDR)).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
+ .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes(
+ nepId.getBytes(StandardCharsets.UTF_8)).toString()))
+ .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes(
+ nepNodeId.getBytes(StandardCharsets.UTF_8)).toString()))
+ .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER
+ .getBytes(StandardCharsets.UTF_8)).toString()))
.build();
String clientQualifier = "";
String clientNodeLayer = TapiStringConstants.PHTNC_MEDIA;
clientNodeLayer = TapiStringConstants.DSR;
break;
default :
- LOG.debug("no client CEP for DSR NEP {}",
- String.join("+", id.split("\\+")[0], qualifier, id.split("\\+")[1]));
+ LOG.debug("no client CEP for DSR NEP {}", nepId);
break;
}
ClientNodeEdgePoint cnep = new ClientNodeEdgePointBuilder()
- .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", id.split("\\+")[0],
- clientQualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+",id.split("\\+")[0],
- TapiStringConstants.XPDR)).getBytes(StandardCharsets.UTF_8))
- .toString()))
- .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString()))
+ .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", id.split("\\+")[0], clientQualifier, id.split("\\+")[1]))
+ .getBytes(StandardCharsets.UTF_8)).toString()))
+ .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes(
+ nepNodeId.getBytes(StandardCharsets.UTF_8)).toString()))
+ .setTopologyUuid(new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER
+ .getBytes(StandardCharsets.UTF_8)).toString()))
.build();
// TODO: add augmentation with the corresponding cep-spec (i.e. MC, OTSiMC...)
// TODO: add parent ONEP??
ConnectionEndPointBuilder cepBldr = new ConnectionEndPointBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP", id.split("\\+")[0],
- qualifier, id.split("\\+")[1])).getBytes(StandardCharsets.UTF_8))
- .toString()))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "CEP", id.split("\\+")[0], qualifier, id.split("\\+")[1]))
+ .getBytes(StandardCharsets.UTF_8)).toString()))
.setParentNodeEdgePoint(pnep)
.setName(Map.of(cepName.key(), cepName))
.setConnectionPortRole(PortRole.SYMMETRIC)
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setLayerProtocolName(cepProtocol);
- if (!(TapiStringConstants.DSR.equals(qualifier))) {
- cepBldr.setClientNodeEdgePoint(Map.of(cnep.key(), cnep));
- }
- return cepBldr.build();
+ return TapiStringConstants.DSR.equals(qualifier)
+ ? cepBldr.build()
+ : cepBldr.setClientNodeEdgePoint(Map.of(cnep.key(), cnep)).build();
}
private EndPoint mapServiceZEndPoint(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.service.ServiceZEnd
- serviceZEnd, PathDescription pathDescription) {
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526
+ .service.ServiceZEnd serviceZEnd, PathDescription pathDescription) {
EndPointBuilder endPointBuilder = new EndPointBuilder();
// 1. Service Format: ODU, OTU, ETH
ServiceFormat serviceFormat = serviceZEnd.getServiceFormat();
default:
LOG.error("Service Format not supported");
}
+ var portZEnd = serviceZEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort();
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.Name name =
new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.NameBuilder()
.setValueName("OpenROADM info")
- .setValue(String.join("-", serviceZEnd.getClli(),
- serviceZEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort()
- .getPortDeviceName(),
- serviceZEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort().getPortName()))
+ .setValue(String.join("-", serviceZEnd.getClli(), portZEnd.getPortDeviceName(), portZEnd.getPortName()))
.build();
return endPointBuilder
.setServiceInterfacePoint(new ServiceInterfacePointBuilder()
.setValue(Decimal64.valueOf(BigDecimal.valueOf(serviceZEnd.getServiceRate().doubleValue())))
.setUnit(CAPACITYUNITGBPS.VALUE)
.build())
-// .setBandwidthProfile(new BandwidthProfileBuilder().build())
+// .setBandwidthProfile(new BandwidthProfileBuilder().build()) // TODO: implement bandwidth profile
.build())
.setProtectionRole(ProtectionRole.WORK)
.setRole(PortRole.SYMMETRIC)
- .setLocalId(serviceZEnd.getTxDirection().values().stream().findFirst().orElseThrow()
- .getPort().getPortDeviceName())
+ .setLocalId(portZEnd.getPortDeviceName())
.build();
}
default:
LOG.error("Service Format not supported");
}
+ var portAEnd = serviceAEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort();
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.Name name =
new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.NameBuilder()
.setValueName("OpenROADM info")
- .setValue(String.join("-", serviceAEnd.getClli(),
- serviceAEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort()
- .getPortDeviceName(),
- serviceAEnd.getTxDirection().values().stream().findFirst().orElseThrow().getPort().getPortName()))
+ .setValue(String.join("-", serviceAEnd.getClli(), portAEnd.getPortDeviceName(), portAEnd.getPortName()))
.build();
return endPointBuilder
.setServiceInterfacePoint(new ServiceInterfacePointBuilder()
}
private Uuid getSipIdFromZend(Map<ZToAKey, ZToA> mapztoa, String serviceNodeId, ServiceFormat serviceFormat) {
- Uuid zendUuid = null;
if (serviceNodeId.contains("ROADM")) {
// Service from ROADM to ROADM
// AddDrop-AddDrop ports --> MC layer SIPs
- ZToA firstElement = mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("0")).findFirst()
- .orElseThrow();
+ ZToA firstElement =
+ mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("0")).findFirst().orElseThrow();
TerminationPoint tp = (TerminationPoint) firstElement.getResource().getResource();
- Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP",
- tp.getTpNodeId(), TapiStringConstants.MC, tp.getTpId())).getBytes(StandardCharsets.UTF_8))
- .toString());
+ Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.MC, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
LOG.info("SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.MC, tp.getTpId()));
for (ServiceInterfacePoint sip:this.sipMap.values()) {
- if (!sip.getUuid().equals(sipUuid)) {
- LOG.info("SIP {} doesn match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
- continue;
+ if (sip.getUuid().equals(sipUuid)) {
+ return sip.getUuid();
}
- zendUuid = sip.getUuid();
- break;
- }
- } else {
- // Service from XPDR to XPDR
- ZToA firstElement;
- TerminationPoint tp;
- Uuid sipUuid;
- switch (serviceFormat) {
- case ODU:
- firstElement = mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("2")).findFirst()
- .orElseThrow();
- tp = (TerminationPoint) firstElement.getResource().getResource();
- // Network-Network ports --> iODU layer SIPs TODO --> updated to E_ODU
- sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", tp.getTpNodeId(),
- TapiStringConstants.I_ODU, tp.getTpId())).getBytes(StandardCharsets.UTF_8)).toString());
- LOG.info("SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.I_ODU,
- tp.getTpId()));
- break;
- case OTU:
- firstElement = mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("2")).findFirst()
- .orElseThrow();
- tp = (TerminationPoint) firstElement.getResource().getResource();
- // Network-Network ports --> iOTSi layer SIPs
- sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", tp.getTpNodeId(),
- TapiStringConstants.I_OTSI, tp.getTpId())).getBytes(StandardCharsets.UTF_8)).toString());
- LOG.info("SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.I_OTSI,
- tp.getTpId()));
- break;
- case Ethernet:
- LOG.info("Elements ZA = {}", mapztoa.values().toString());
- firstElement = mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("0")).findFirst()
- .orElseThrow();
- tp = (TerminationPoint) firstElement.getResource().getResource();
- // Client-client ports --> DSR layer SIPs
- sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", tp.getTpNodeId(),
- TapiStringConstants.DSR, tp.getTpId())).getBytes(StandardCharsets.UTF_8)).toString());
- LOG.info("SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.DSR,
- tp.getTpId()));
- break;
- default:
- sipUuid = null;
- LOG.warn("Service format {} not supported (?)", serviceFormat.getName());
+ LOG.debug("SIP {} does not match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
}
- for (ServiceInterfacePoint sip:this.sipMap.values()) {
- if (!sip.getUuid().equals(sipUuid)) {
- LOG.info("SIP {} doesn match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
- continue;
- }
- zendUuid = sip.getUuid();
+ return null;
+ }
+ // Service from XPDR to XPDR
+ ZToA firstElement;
+ TerminationPoint tp;
+ Uuid sipUuid;
+ switch (serviceFormat) {
+ case ODU:
+ firstElement =
+ mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("2")).findFirst().orElseThrow();
+ tp = (TerminationPoint) firstElement.getResource().getResource();
+ // Network-Network ports --> iODU layer SIPs TODO --> updated to E_ODU
+ sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.I_ODU, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ LOG.info("SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.I_ODU, tp.getTpId()));
+ break;
+ case OTU:
+ firstElement =
+ mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("2")).findFirst().orElseThrow();
+ tp = (TerminationPoint) firstElement.getResource().getResource();
+ // Network-Network ports --> iOTSi layer SIPs
+ sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.I_OTSI, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ LOG.info("SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.I_OTSI, tp.getTpId()));
+ break;
+ case Ethernet:
+ LOG.info("Elements ZA = {}", mapztoa.values());
+ firstElement =
+ mapztoa.values().stream().filter(ztoa -> ztoa.getId().equals("0")).findFirst().orElseThrow();
+ tp = (TerminationPoint) firstElement.getResource().getResource();
+ // Client-client ports --> DSR layer SIPs
+ sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.DSR, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ LOG.info("SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.DSR, tp.getTpId()));
break;
+ default:
+ sipUuid = null;
+ LOG.warn("Service format {} not supported (?)", serviceFormat.getName());
+ }
+ for (ServiceInterfacePoint sip:this.sipMap.values()) {
+ if (sip.getUuid().equals(sipUuid)) {
+ return sip.getUuid();
}
+ LOG.debug("SIP {} does not match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
}
- return zendUuid;
+ return null;
}
private Uuid getSipIdFromAend(Map<AToZKey, AToZ> mapatoz, String serviceNodeId, ServiceFormat serviceFormat) {
- Uuid aendUuid = null;
LOG.info("ServiceNode = {} and ServiceFormat = {}", serviceNodeId, serviceFormat.getName());
LOG.info("Map a to z = {}", mapatoz);
if (serviceNodeId.contains("ROADM")) {
// Service from ROADM to ROADM
// AddDrop-AddDrop ports --> MC layer SIPs
- AToZ firstElement = mapatoz.values().stream().filter(atoz -> atoz.getId().equals("0")).findFirst()
- .orElseThrow();
+ AToZ firstElement =
+ mapatoz.values().stream().filter(atoz -> atoz.getId().equals("0")).findFirst().orElseThrow();
LOG.info("First element of service path = {}", firstElement.getResource().getResource());
TerminationPoint tp = (TerminationPoint) firstElement.getResource().getResource();
- Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP",
- tp.getTpNodeId(), TapiStringConstants.MC, tp.getTpId())).getBytes(StandardCharsets.UTF_8))
- .toString());
- LOG.info("ROADM SIP name = {}", String.join("+", tp.getTpNodeId(), TapiStringConstants.MC,
- tp.getTpId()));
+ Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.MC, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ LOG.info("ROADM SIP name = {}",
+ String.join("+", tp.getTpNodeId(), TapiStringConstants.MC, tp.getTpId()));
for (ServiceInterfacePoint sip:this.sipMap.values()) {
- if (!sip.getUuid().equals(sipUuid)) {
- LOG.info("SIP {} doesn match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
- continue;
+ if (sip.getUuid().equals(sipUuid)) {
+ return sip.getUuid();
}
- aendUuid = sip.getUuid();
- break;
- }
- } else {
- // Service from XPDR to XPDR
- AToZ firstElement;
- TerminationPoint tp;
- Uuid sipUuid;
- switch (serviceFormat) {
- case ODU:
- firstElement = mapatoz.values().stream().filter(atoz -> atoz.getId().equals("2")).findFirst()
- .orElseThrow();
- tp = (TerminationPoint) firstElement.getResource().getResource();
- // Network-Network ports --> iODU layer SIPs. TODO -> updated to eODU
- sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", tp.getTpNodeId(),
- TapiStringConstants.I_ODU, tp.getTpId())).getBytes(StandardCharsets.UTF_8)).toString());
- LOG.info("ODU XPDR SIP name = {}", String.join("+", tp.getTpNodeId(),
- TapiStringConstants.I_ODU, tp.getTpId()));
- break;
- case OTU:
- firstElement = mapatoz.values().stream().filter(atoz -> atoz.getId().equals("2")).findFirst()
- .orElseThrow();
- tp = (TerminationPoint) firstElement.getResource().getResource();
- // Network-Network ports --> iOTSi layer SIPs
- sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", tp.getTpNodeId(),
- TapiStringConstants.I_OTSI, tp.getTpId())).getBytes(StandardCharsets.UTF_8)).toString());
- LOG.info("OTU XPDR SIP name = {}", String.join("+", tp.getTpNodeId(),
- TapiStringConstants.I_OTSI, tp.getTpId()));
- break;
- case Ethernet:
- LOG.info("Elements AZ = {}", mapatoz.values().toString());
- firstElement = mapatoz.values().stream().filter(atoz -> atoz.getId().equals("0")).findFirst()
- .orElseThrow();
- tp = (TerminationPoint) firstElement.getResource().getResource();
- // Client-client ports --> DSR layer SIPs
- sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", tp.getTpNodeId(),
- TapiStringConstants.DSR, tp.getTpId())).getBytes(StandardCharsets.UTF_8)).toString());
- LOG.info("DSR XPDR SIP name = {}", String.join("+", tp.getTpNodeId(),
- TapiStringConstants.DSR, tp.getTpId()));
- break;
- default:
- sipUuid = null;
- LOG.warn("Service format {} not supported (?)", serviceFormat.getName());
+ LOG.debug("SIP {} does not match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
}
- for (ServiceInterfacePoint sip:this.sipMap.values()) {
- if (!sip.getUuid().equals(sipUuid)) {
- LOG.info("SIP {} doesn match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
- continue;
- }
- aendUuid = sip.getUuid();
+ return null;
+ }
+ // Service from XPDR to XPDR
+ AToZ firstElement;
+ TerminationPoint tp;
+ Uuid sipUuid;
+ switch (serviceFormat) {
+ case ODU:
+ firstElement =
+ mapatoz.values().stream().filter(atoz -> atoz.getId().equals("2")).findFirst().orElseThrow();
+ tp = (TerminationPoint) firstElement.getResource().getResource();
+ // Network-Network ports --> iODU layer SIPs. TODO -> updated to eODU
+ sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.I_ODU, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ LOG.info("ODU XPDR SIP name = {}",
+ String.join("+", tp.getTpNodeId(), TapiStringConstants.I_ODU, tp.getTpId()));
+ break;
+ case OTU:
+ firstElement =
+ mapatoz.values().stream().filter(atoz -> atoz.getId().equals("2")).findFirst().orElseThrow();
+ tp = (TerminationPoint) firstElement.getResource().getResource();
+ // Network-Network ports --> iOTSi layer SIPs
+ sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.I_OTSI, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ LOG.info("OTU XPDR SIP name = {}",
+ String.join("+", tp.getTpNodeId(), TapiStringConstants.I_OTSI, tp.getTpId()));
break;
+ case Ethernet:
+ LOG.info("Elements AZ = {}", mapatoz.values());
+ firstElement =
+ mapatoz.values().stream().filter(atoz -> atoz.getId().equals("0")).findFirst().orElseThrow();
+ tp = (TerminationPoint) firstElement.getResource().getResource();
+ // Client-client ports --> DSR layer SIPs
+ sipUuid = new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", "SIP", tp.getTpNodeId(), TapiStringConstants.DSR, tp.getTpId()))
+ .getBytes(StandardCharsets.UTF_8)).toString());
+ LOG.info("DSR XPDR SIP name = {}",
+ String.join("+", tp.getTpNodeId(), TapiStringConstants.DSR, tp.getTpId()));
+ break;
+ default:
+ sipUuid = null;
+ LOG.warn("Service format {} not supported (?)", serviceFormat.getName());
+ }
+ for (ServiceInterfacePoint sip:this.sipMap.values()) {
+ if (sip.getUuid().equals(sipUuid)) {
+ return sip.getUuid();
}
+ LOG.debug("SIP {} does not match sipname {}", sip.getUuid().getValue(), sipUuid.getValue());
}
- return aendUuid;
+ return null;
}
private void putRdmCepInTopologyContext(String node, String spcRdmAD, String qual, ConnectionEndPoint cep) {
- LOG.info("NEP id before Merge = {}", String.join("+", node, qual, spcRdmAD.split("\\+")[1]));
- LOG.info("Node of NEP id before Merge = {}", String.join("+", node, TapiStringConstants.PHTNC_MEDIA));
+ String nepId = String.join("+", node, qual, spcRdmAD.split("\\+")[1]);
+ String nodeNepId = String.join("+", node, TapiStringConstants.PHTNC_MEDIA);
+ LOG.info("NEP id before Merge = {}", nepId);
+ LOG.info("Node of NEP id before Merge = {}", nodeNepId);
// Give uuids so that it is easier to look for things: topology uuid, node uuid, nep uuid, cep
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, TapiStringConstants.PHTNC_MEDIA)
- .getBytes(StandardCharsets.UTF_8)).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, qual, spcRdmAD.split("\\+")[1])
- .getBytes(StandardCharsets.UTF_8)).toString());
- this.tapiContext.updateTopologyWithCep(topoUuid, nodeUuid, nepUuid, cep);
+ this.tapiContext.updateTopologyWithCep(
+ //topoUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER.getBytes(StandardCharsets.UTF_8)).toString()),
+ //nodeUuid,
+ new Uuid(UUID.nameUUIDFromBytes(nodeNepId.getBytes(StandardCharsets.UTF_8)).toString()),
+ //nepUuid,
+ new Uuid(UUID.nameUUIDFromBytes(nepId.getBytes(StandardCharsets.UTF_8)).toString()),
+ cep);
}
- private void putXpdrCepInTopologyContext(String node, String spcXpdrNet, String qual, String nodeLayer,
- ConnectionEndPoint cep) {
+ private void putXpdrCepInTopologyContext(
+ String node, String spcXpdrNet, String qual, String nodeLayer, ConnectionEndPoint cep) {
// Give uuids so that it is easier to look for things: topology uuid, node uuid, nep uuid, cep
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(StandardCharsets.UTF_8)).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, nodeLayer)
- .getBytes(StandardCharsets.UTF_8)).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", node, qual, spcXpdrNet.split("\\+")[1])
- .getBytes(StandardCharsets.UTF_8)).toString());
- this.tapiContext.updateTopologyWithCep(topoUuid, nodeUuid, nepUuid, cep);
+ this.tapiContext.updateTopologyWithCep(
+ //topoUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER.getBytes(StandardCharsets.UTF_8))
+ .toString()),
+ //nodeUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ String.join("+", node, nodeLayer).getBytes(StandardCharsets.UTF_8))
+ .toString()),
+ //nepUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ String.join("+", node, qual, spcXpdrNet.split("\\+")[1]).getBytes(StandardCharsets.UTF_8))
+ .toString()),
+ cep);
}
private void putRdmNepInTopologyContext(String orNodeId, String orTpId, String qual, OwnedNodeEdgePoint onep) {
- LOG.info("NEP id before Merge = {}", String.join("+", orNodeId, qual, orTpId));
- LOG.info("Node of NEP id before Merge = {}", String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA));
+ String nepId = String.join("+", orNodeId, qual, orTpId);
+ String nepNodeId = String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA);
+ LOG.info("NEP id before Merge = {}", nepId);
+ LOG.info("Node of NEP id before Merge = {}", nepNodeId);
// Give uuids so that it is easier to look for things: topology uuid, node uuid, nep uuid, cep
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA)
- .getBytes(Charset.forName("UTF-8"))).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(String.join("+", orNodeId, qual, orTpId)
- .getBytes(Charset.forName("UTF-8"))).toString());
- updateTopologyWithNep(topoUuid, nodeUuid, nepUuid, onep);
+ updateTopologyWithNep(
+ //topoUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.T0_FULL_MULTILAYER.getBytes(Charset.forName("UTF-8")))
+ .toString()),
+ //nodeUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ nepNodeId.getBytes(Charset.forName("UTF-8")))
+ .toString()),
+ //nepUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ nepId.getBytes(Charset.forName("UTF-8")))
+ .toString()),
+ onep);
}
private String getIdBasedOnModelVersion(String nodeid) {
- return nodeid.matches("[A-Z]{5}-[A-Z0-9]{2}-.*") ? String.join("-", nodeid.split("-")[0],
- nodeid.split("-")[1]) : nodeid.split("-")[0];
+ return nodeid.matches("[A-Z]{5}-[A-Z0-9]{2}-.*")
+ ? String.join("-", nodeid.split("-")[0], nodeid.split("-")[1])
+ : nodeid.split("-")[0];
}
private ServiceZEnd tapiEndPointToServiceZPoint(
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint endPoint,
- ServiceFormat serviceFormat, String nodeZid, Uint64 capacity, LayerProtocolName serviceLayer) {
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .create.connectivity.service.input.EndPoint endPoint,
+ ServiceFormat serviceFormat, String nodeZid, Uint64 capacity, LayerProtocolName serviceLayer) {
// TODO -> change way this is being created. The name includes only SPDR-SA1-XPDR1.
// Not the rest which is needed in the txPortDeviceName.
// It could be obtained from the SIP which has the NEP and includes all the OR name.
// connection is between 2 CLIENT ports. Otherwise it will not work...
OwnedNodeEdgePoint nep = null;
for (OwnedNodeEdgePoint onep : node.getOwnedNodeEdgePoint().values()) {
- if (onep.getMappedServiceInterfacePoint() == null) {
- continue;
- }
- if (onep.getMappedServiceInterfacePoint().containsKey(new MappedServiceInterfacePointKey(sipUuid))) {
+ if (onep.getMappedServiceInterfacePoint() != null
+ && onep.getMappedServiceInterfacePoint().containsKey(new MappedServiceInterfacePointKey(sipUuid))) {
nep = onep;
break;
}
return null;
}
String nodeName = "";
- for (Map.Entry<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.NameKey,
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.Name> entry:
+ for (Map.Entry<
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.NameKey,
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.Name> entry:
endPoint.getName().entrySet()) {
if (!("Node Type").equals(entry.getValue().getValueName())) {
nodeName = entry.getValue().getValue();
if (serviceFormat.equals(ServiceFormat.OTU)) {
serviceZEndBuilder.setOtuServiceRate(OTU4.VALUE);
}
- if (!serviceLayer.equals(LayerProtocolName.ETH)) {
- serviceZEndBuilder
- .setEthernetAttributes(new EthernetAttributesBuilder().setSubrateEthSla(new SubrateEthSlaBuilder()
+ return serviceLayer.equals(LayerProtocolName.ETH)
+ ? serviceZEndBuilder.build()
+ : serviceZEndBuilder
+ .setEthernetAttributes(new EthernetAttributesBuilder()
+ .setSubrateEthSla(new SubrateEthSlaBuilder()
.setCommittedBurstSize(Uint16.valueOf(64))
.setCommittedInfoRate(Uint32.valueOf(100000))
.build())
- .build());
- }
- return serviceZEndBuilder.build();
+ .build())
+ .build();
}
private ServiceAEnd tapiEndPointToServiceAPoint(
- org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint endPoint,
- ServiceFormat serviceFormat, String nodeAid, Uint64 capacity, LayerProtocolName serviceLayer) {
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .create.connectivity.service.input.EndPoint endPoint,
+ ServiceFormat serviceFormat, String nodeAid, Uint64 capacity, LayerProtocolName serviceLayer) {
// TODO -> change way this is being created. The name includes only SPDR-SA1-XPDR1.
// Not the rest which is needed in the txPortDeviceName.
// It could be obtained from the SIP which has the NEP and includes all the OR name.
// connection is between 2 CLIENT ports. Otherwise it will not work...
OwnedNodeEdgePoint nep = null;
for (OwnedNodeEdgePoint onep : node.getOwnedNodeEdgePoint().values()) {
- if (onep.getMappedServiceInterfacePoint() == null) {
- continue;
- }
- if (onep.getMappedServiceInterfacePoint().containsKey(new MappedServiceInterfacePointKey(sipUuid))) {
+ if (onep.getMappedServiceInterfacePoint() != null
+ && onep.getMappedServiceInterfacePoint().containsKey(new MappedServiceInterfacePointKey(sipUuid))) {
nep = onep;
break;
}
return null;
}
String nodeName = "";
- for (Map.Entry<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.NameKey,
+ for (Map.Entry<
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.NameKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.local._class.Name> entry:
- endPoint.getName().entrySet()) {
+ endPoint.getName().entrySet()) {
if (!("Node Type").equals(entry.getValue().getValueName())) {
nodeName = entry.getValue().getValue();
}
.setServiceFormat(serviceFormat)
.setServiceRate(Uint32.valueOf(capacity))
.setEthernetAttributes(new EthernetAttributesBuilder().setSubrateEthSla(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.subrate.eth
- .sla.SubrateEthSlaBuilder()
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526
+ .subrate.eth.sla.SubrateEthSlaBuilder()
.setCommittedBurstSize(Uint16.valueOf(64))
.setCommittedInfoRate(Uint32.valueOf(100000))
.build())
} else if (serviceFormat.equals(ServiceFormat.OTU)) {
serviceAEndBuilder.setOtuServiceRate(OTU4.VALUE);
}
- if (!serviceLayer.equals(LayerProtocolName.ETH)) {
- serviceAEndBuilder
- .setEthernetAttributes(new EthernetAttributesBuilder().setSubrateEthSla(new SubrateEthSlaBuilder()
+ return serviceLayer.equals(LayerProtocolName.ETH)
+ ? serviceAEndBuilder.build()
+ : serviceAEndBuilder
+ .setEthernetAttributes(new EthernetAttributesBuilder()
+ .setSubrateEthSla(new SubrateEthSlaBuilder()
.setCommittedBurstSize(Uint16.valueOf(64))
.setCommittedInfoRate(Uint32.valueOf(100000))
.build())
- .build());
- }
- return serviceAEndBuilder.build();
+ .build())
+ .build();
}
- private ConnectionType getConnectionTypePhtnc(Collection<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint> endPoints) {
- if (endPoints.stream().anyMatch(ep -> ep.getName().values().stream()
- .anyMatch(name -> name.getValue().contains("ROADM")))) {
+ private ConnectionType getConnectionTypePhtnc(
+ Collection<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .create.connectivity.service.input.EndPoint> endPoints) {
+ return endPoints.stream()
+ .anyMatch(ep -> ep.getName().values().stream().anyMatch(name -> name.getValue().contains("ROADM")))
// EndPoints are ROADMs
- return ConnectionType.RoadmLine;
- }
- // EndPoints ar not ROADMs -> XPDR, MUXPDR, SWTICHPDR
- return ConnectionType.Infrastructure;
+ ? ConnectionType.RoadmLine
+ // EndPoints are not ROADMs -> XPDR, MUXPDR, SWTICHPDR
+ : ConnectionType.Infrastructure;
}
- private ServiceFormat getServiceFormatPhtnc(Collection<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.connectivity.rev221121.create.connectivity.service.input.EndPoint> endPoints) {
- if (endPoints.stream().anyMatch(ep -> ep.getName().values().stream()
- .anyMatch(name -> name.getValue().contains("ROADM")))) {
+ private ServiceFormat getServiceFormatPhtnc(
+ Collection<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+ .create.connectivity.service.input.EndPoint> endPoints) {
+ return endPoints.stream()
+ .anyMatch(ep -> ep.getName().values().stream().anyMatch(name -> name.getValue().contains("ROADM")))
// EndPoints are ROADMs
- return ServiceFormat.OC;
- }
- // EndPoints ar not ROADMs -> XPDR, MUXPDR, SWTICHPDR
- return ServiceFormat.OTU;
+ ? ServiceFormat.OC
+ // EndPoints ar not ROADMs -> XPDR, MUXPDR, SWTICHPDR
+ : ServiceFormat.OTU;
}
private ConnectionEndPoint getAssociatediODUCep(String spcXpdrNetwork) {
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", spcXpdrNetwork.split("\\+")[0],
- TapiStringConstants.XPDR).getBytes(StandardCharsets.UTF_8))).toString());
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", spcXpdrNetwork.split("\\+")[0],
- TapiStringConstants.I_ODU, spcXpdrNetwork.split("\\+")[1]).getBytes(StandardCharsets.UTF_8)))
- .toString());
- Uuid cepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "CEP",
- spcXpdrNetwork.split("\\+")[0], TapiStringConstants.I_ODU, spcXpdrNetwork.split("\\+")[1]))
- .getBytes(StandardCharsets.UTF_8)).toString());
- return this.tapiContext.getTapiCEP(this.tapiTopoUuid, nodeUuid, nepUuid, cepUuid);
+ return this.tapiContext.getTapiCEP(
+ this.tapiTopoUuid,
+ //nodeUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+",
+ spcXpdrNetwork.split("\\+")[0],
+ TapiStringConstants.XPDR)
+ .getBytes(StandardCharsets.UTF_8))).toString()),
+ //nepUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+",
+ spcXpdrNetwork.split("\\+")[0],
+ TapiStringConstants.I_ODU,
+ spcXpdrNetwork.split("\\+")[1])
+ .getBytes(StandardCharsets.UTF_8))).toString()),
+ //cepUuid,
+ new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+",
+ "CEP",
+ spcXpdrNetwork.split("\\+")[0],
+ TapiStringConstants.I_ODU,
+ spcXpdrNetwork.split("\\+")[1]))
+ .getBytes(StandardCharsets.UTF_8)).toString()));
}
private String getAssociatedNetworkPort(String spcXpdrClient, List<String> xpdrNetworkTplist) {
private List<String> getAssociatedClientsPort(List<String> xpdrNetworkTplist) {
List<String> clientPortList = new ArrayList<>();
for (String networkPort:xpdrNetworkTplist) {
- String nodeId = String.join("-", networkPort.split("\\+")[0].split("-")[0],
+ String nodeId = String.join("-",
+ networkPort.split("\\+")[0].split("-")[0],
networkPort.split("\\+")[0].split("-")[1]);
String tpId = networkPort.split("\\+")[1];
InstanceIdentifier<Mapping> mapIID = InstanceIdentifier.builder(Network.class)
.child(Nodes.class, new NodesKey(nodeId))
.child(Mapping.class, new MappingKey(tpId)).build();
try {
- Optional<Mapping> optMapping = this.networkTransactionService.read(LogicalDatastoreType.CONFIGURATION,
- mapIID).get();
- if (!optMapping.isPresent()) {
+ Optional<Mapping> optMapping =
+ this.networkTransactionService.read(LogicalDatastoreType.CONFIGURATION, mapIID).get();
+ if (optMapping.isEmpty()) {
LOG.error("Couldnt find mapping for port {} of node {}", tpId, nodeId);
}
Mapping mapping = optMapping.orElseThrow();
LOG.info("Mapping for node+port {}+{} = {}", nodeId, tpId, mapping);
- String key = String.join("+", String.join("-", nodeId, tpId.split("\\-")[0]),
+ String key = String.join("+",
+ String.join("-", nodeId, tpId.split("\\-")[0]),
mapping.getConnectionMapLcp());
LOG.info("Key to be added to list = {}", key);
if (!clientPortList.contains(key)) {
private OpenroadmNodeType getOpenRoadmNodeType(List<String> xpdrNodelist) {
List<OpenroadmNodeType> openroadmNodeTypeList = new ArrayList<>();
for (String xpdrNode:xpdrNodelist) {
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+",xpdrNode, TapiStringConstants.XPDR))
- .getBytes(StandardCharsets.UTF_8)).toString());
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeIID = InstanceIdentifier.builder(
- Context.class).augmentation(org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.Context1.class).child(TopologyContext.class)
- .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
- .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class,
- new NodeKey(nodeUuid)).build();
+ InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .topology.Node> nodeIID =
+ InstanceIdentifier.builder(Context.class)
+ .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class)
+ .child(TopologyContext.class)
+ .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
+ .child(
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class,
+ new NodeKey(
+ //nodeUUID
+ new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+",xpdrNode, TapiStringConstants.XPDR))
+ .getBytes(StandardCharsets.UTF_8)).toString())))
+ .build();
try {
- Optional<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> optNode
- = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, nodeIID).get();
+ Optional<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> optNode =
+ this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, nodeIID).get();
if (optNode.isEmpty()) {
return null;
}
- OpenroadmNodeType openroadmNodeType = OpenroadmNodeType.forName(optNode.orElseThrow().getName().get(
- new NameKey("Node Type")).getValue());
+ OpenroadmNodeType openroadmNodeType =
+ OpenroadmNodeType.forName(optNode.orElseThrow().getName().get(new NameKey("Node Type")).getValue());
if (!openroadmNodeTypeList.contains(openroadmNodeType)) {
openroadmNodeTypeList.add(openroadmNodeType);
}
}
}
// TODO for now check that there is only one type, otherwise error
- if (openroadmNodeTypeList.size() != 1) {
- LOG.error("More than one xpdr type. List = {}", openroadmNodeTypeList);
- return null;
+ if (openroadmNodeTypeList.size() == 1) {
+ return openroadmNodeTypeList.get(0);
}
- return openroadmNodeTypeList.get(0);
+ LOG.error("More than one xpdr type. List = {}", openroadmNodeTypeList);
+ return null;
}
- private OwnedNodeEdgePoint createRoadmNep(String orNodeId, String tpId,
- boolean withSip, OperationalState operState, AdministrativeState adminState, String nepPhotonicSublayer) {
-
+ private OwnedNodeEdgePoint createRoadmNep(
+ String orNodeId, String tpId, boolean withSip,
+ OperationalState operState, AdministrativeState adminState, String nepPhotonicSublayer) {
//TODO : complete implementation with SIP
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, nepPhotonicSublayer,
- tpId)).getBytes(StandardCharsets.UTF_8)).toString());
Name nepName = new NameBuilder()
.setValueName(TapiStringConstants.PHTNC_MEDIA + "NodeEdgePoint")
.setValue(String.join("+", orNodeId, nepPhotonicSublayer, tpId))
.build();
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- if (TapiStringConstants.MC.equals(nepPhotonicSublayer)) {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIERMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- } else {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- }
- OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+ return new OwnedNodeEdgePointBuilder()
+ .setUuid(
+ new Uuid(UUID.nameUUIDFromBytes(
+ (String.join("+", orNodeId, nepPhotonicSublayer,tpId)).getBytes(StandardCharsets.UTF_8))
+ .toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifierInstances(sclpqiList)
+ .setSupportedCepLayerProtocolQualifierInstances(
+ new ArrayList<>(List.of(
+ new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(
+ TapiStringConstants.MC.equals(nepPhotonicSublayer)
+ ? PHOTONICLAYERQUALIFIERMC.VALUE
+ : PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(1))
+ .build())))
.setDirection(Direction.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED)
.build();
-
- return onep;
}
-
}
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
import org.opendaylight.transportpce.tapi.connectivity.ConnectivityUtils;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescription;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev230925.service.path.rpc.result.PathDescriptionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.ServicePathRpcResult;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescription;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev240205.service.path.rpc.result.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Context;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.networks.network.node.termination.point.PpAttributes;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.networks.network.node.termination.point.XpdrNetworkAttributes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPools;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTS;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSi;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSiMC;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.context.topology.context.topology.node.owned.node.edge.point.PhotonicMediaNodeEdgePointSpec;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.context.topology.context.topology.node.owned.node.edge.point.PhotonicMediaNodeEdgePointSpecBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.photonic.media.node.edge.point.spec.SpectrumCapabilityPacBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.AvailableSpectrum;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.AvailableSpectrumBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.AvailableSpectrumKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.OccupiedSpectrum;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.OccupiedSpectrumBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.OccupiedSpectrumKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.SupportableSpectrum;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.SupportableSpectrumBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.SupportableSpectrumKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.AvailablePayloadStructure;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.AvailablePayloadStructureBuilder;
public void convertNode(Node ietfNode, List<String> networkPorts) {
this.ietfNodeId = ietfNode.getNodeId().getValue();
- if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- == null) {
+ var ietfAug =
+ ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class);
+ if (ietfAug == null) {
return;
}
- this.ietfNodeType = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class).getNodeType();
- this.ietfNodeAdminState = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- .getAdministrativeState();
- this.ietfNodeOperState = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
- .getOperationalState();
- this.oorNetworkPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
+ this.ietfNodeType = ietfAug.getNodeType();
+ this.ietfNodeAdminState = ietfAug.getAdministrativeState();
+ this.ietfNodeOperState = ietfAug.getOperationalState();
+ var ietfAugTopo =
+ ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class);
+ this.oorNetworkPortList = ietfAugTopo.getTerminationPoint().values().stream()
.filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERNETWORK.getIntValue()
+ == OpenroadmTpType.XPONDERNETWORK.getIntValue()
&& networkPorts.contains(tp.getTpId().getValue()))
.sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
.collect(Collectors.toList());
- if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
- this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
- .values().stream().findFirst().orElseThrow();
- this.oorClientPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERCLIENT.getIntValue())
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
- } else {
+ if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
.flatMap(nbl -> nbl.getTpList().stream())
.collect(Collectors.toList());
- this.oorClientPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
+ this.oorClientPortList = ietfAugTopo.getTerminationPoint().values().stream()
.filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
+ == OpenroadmTpType.XPONDERCLIENT.getIntValue()
+ && tpList.contains(tp.getTpId()))
.sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
.collect(Collectors.toList());
this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
+ } else {
+ this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
+ .values().stream().findFirst().orElseThrow();
+ this.oorClientPortList = ietfAugTopo.getTerminationPoint().values().stream()
+ .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
+ == OpenroadmTpType.XPONDERCLIENT.getIntValue())
+ .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
+ .collect(Collectors.toList());
}
// node creation [DSR/ODU] ([DSR/ODU] and OTSI merged in R 2.4.X)
LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)).getBytes(Charset.forName("UTF-8"))).toString());
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR), nodeUuid);
- Name nameDsr = new NameBuilder().setValueName("dsr/odu node name")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
- Name namePhot = new NameBuilder().setValueName("otsi node name")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR)).build();
- Name nameNodeType = new NameBuilder().setValueName("Node Type")
- .setValue(this.ietfNodeType.getName()).build();
- Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
- LayerProtocolName.DIGITALOTN,LayerProtocolName.PHOTONICMEDIA);
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology
- .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr, namePhot.key(), namePhot,nameNodeType.key(),
- nameNodeType), dsrLayerProtocols);
- LOG.debug("XPDR Node {} should have {} NEPs and SIPs", this.ietfNodeId,
- this.oorClientPortList.size() + this.oorNetworkPortList.size());
- LOG.info("XPDR Node {} has {} NEPs and {} SIPs", this.ietfNodeId,
- dsrNode.getOwnedNodeEdgePoint().values().size(), dsrNode.getOwnedNodeEdgePoint().values().stream()
+ String nodeIdXpdr = String.join("+", this.ietfNodeId, TapiStringConstants.XPDR);
+ this.uuidMap.put(nodeIdXpdr,
+ //nodeUuid
+ new Uuid(UUID.nameUUIDFromBytes(nodeIdXpdr.getBytes(Charset.forName("UTF-8"))).toString()));
+ Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(nodeIdXpdr).build();
+ Name namePhot = new NameBuilder().setValueName("otsi node name").setValue(nodeIdXpdr).build();
+ Name nameNodeType = new NameBuilder().setValueName("Node Type").setValue(this.ietfNodeType.getName()).build();
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .topology.Node dsrNode =
+ createTapiNode(
+ Map.of(nameDsr.key(), nameDsr, namePhot.key(), namePhot,nameNodeType.key(), nameNodeType),
+ //dsrLayerProtocols
+ Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
+ LayerProtocolName.DIGITALOTN, LayerProtocolName.PHOTONICMEDIA));
+ LOG.debug("XPDR Node {} should have {} NEPs and SIPs",
+ this.ietfNodeId, this.oorClientPortList.size() + this.oorNetworkPortList.size());
+ LOG.info("XPDR Node {} has {} NEPs and {} SIPs",
+ this.ietfNodeId,
+ dsrNode.getOwnedNodeEdgePoint().values().size(),
+ dsrNode.getOwnedNodeEdgePoint().values().stream()
.filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
tapiNodes.put(dsrNode.key(), dsrNode);
}
- public Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String topoType, Uuid nodeUuid,
- String orNodeId, Collection<OwnedNodeEdgePoint> onepl) {
+ public Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(
+ String topoType, Uuid nodeUuid, String orNodeId, Collection<OwnedNodeEdgePoint> onepl) {
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
- nepMap = new HashMap<>();
+ nepMap = new HashMap<>();
for (OwnedNodeEdgePoint onep : onepl) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group
- .NodeEdgePointBuilder()
+ var nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .node.rule.group.NodeEdgePointBuilder()
.setTopologyUuid(tapiTopoUuid)
.setNodeUuid(nodeUuid)
.setNodeEdgePointUuid(onep.key().getUuid())
.build();
nepMap.put(nep.key(), nep);
}
- String rdmName =
- topoType.equals("Abstracted")
- ? "rdm infra node rule group"
- : orNodeId + " node rule group";
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Map<RuleKey, Rule> ruleList = new HashMap<>();
Rule rule = new RuleBuilder()
.setLocalId("forward")
.setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes)
+ .setRuleType(new HashSet<>(Set.of(RuleType.FORWARDING)))
.build();
- ruleList.put(rule.key(), rule);
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((rdmName)
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((
+ topoType.equals("Abstracted") ? "rdm infra node rule group" : orNodeId + " node rule group")
.getBytes(Charset.forName("UTF-8"))).toString()))
- .setRule(ruleList)
+ .setRule(new HashMap<>(Map.of(rule.key(), rule)))
.setNodeEdgePoint(nepMap)
.build();
- nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
- return nodeRuleGroupMap;
+ return new HashMap<>(Map.of(nodeRuleGroup.key(), nodeRuleGroup));
}
- public Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(int nb,
- LayerProtocolName layerProtocol, String tpId, String nodeid,
+ public Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(
+ int nb, LayerProtocolName layerProtocol, String tpId, String nodeid,
Collection<SupportedInterfaceCapability> supportedInterfaceCapability,
OperationalState operState, AdministrativeState adminState) {
// add them to SIP context
String sipName =
nb == 1
? String.join("+", "SIP", nodeid, tpId)
- : String.join("+", "SIP", nodeid, tpId,"Nber", String.valueOf(i));
+ : String.join("+", "SIP", nodeid, tpId, "Nber", String.valueOf(i));
LOG.info("SIP = {}", sipName);
Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes(sipName.getBytes(Charset.forName("UTF-8"))).toString());
MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
- .setServiceInterfacePointUuid(sipUuid).build();
- ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tpId, nodeid, supportedInterfaceCapability,
- operState, adminState);
+ .setServiceInterfacePointUuid(sipUuid)
+ .build();
+ ServiceInterfacePoint sip =
+ createSIP(sipUuid, layerProtocol, tpId, nodeid, supportedInterfaceCapability, operState, adminState);
this.tapiSips.put(sip.key(), sip);
msipl.put(msip.key(), msip);
LOG.debug("SIP created {}", sip.getUuid());
return msipl;
}
- public List<AvailablePayloadStructure> createAvailablePayloadStructureForPhtncMedia(Boolean otsiProvisioned,
- Collection<SupportedInterfaceCapability> sicList, List<OperationalModeKey> supportedOpModes) {
+ public List<AvailablePayloadStructure> createAvailablePayloadStructureForPhtncMedia(
+ Boolean otsiProvisioned,
+ Collection<SupportedInterfaceCapability> sicList,
+ List<OperationalModeKey> supportedOpModes) {
if (supportedOpModes == null || supportedOpModes.isEmpty()) {
return null;
}
nepRate = loopRate;
}
}
- CapacityBuilder capBd = new CapacityBuilder()
- .setUnit(CAPACITYUNITGBPS.VALUE);
List<AvailablePayloadStructure> aps = new ArrayList<>();
- Integer cepInstanceNber = 1;
- if (otsiProvisioned) {
- cepInstanceNber = 0;
- }
+ Integer cepInstanceNber = otsiProvisioned ? 0 : 1;
for (SupportedInterfaceCapability sic : sicList) {
- String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (ifCapType) {
+ switch (sic.getIfCapType().toString().split("\\{")[0]) {
case "IfOCHOTU4ODU4":
case "IfOCHOTU4ODU4Regen":
case "IfOCHOTU4ODU4Uniregen":
aps.add(new AvailablePayloadStructureBuilder()
.setMultiplexingSequence(Set.of(PHOTONICLAYERQUALIFIEROTSi.VALUE, ODUTYPEODU4.VALUE))
.setNumberOfCepInstances(Uint64.valueOf(cepInstanceNber))
- .setCapacity(capBd.setValue(Decimal64.valueOf(100.0 * cepInstanceNber, RoundingMode.DOWN))
- .build())
+ .setCapacity(
+ new CapacityBuilder()
+ .setUnit(CAPACITYUNITGBPS.VALUE)
+ .setValue(Decimal64.valueOf(100.0 * cepInstanceNber, RoundingMode.DOWN))
+ .build())
.build());
break;
case "IfOCHOTUCnODUCn":
ODUTYPEODUCN.VALUE, ODUTYPEODU4.VALUE))
.setNumberOfCepInstances(Uint64.valueOf(nepRate * cepInstanceNber))
.setCapacity(
- capBd.setValue(Decimal64.valueOf(nepRate * 100.0 * cepInstanceNber, RoundingMode.DOWN))
- .build())
+ new CapacityBuilder()
+ .setUnit(CAPACITYUNITGBPS.VALUE)
+ .setValue(Decimal64.valueOf(nepRate * 100.0 * cepInstanceNber, RoundingMode.DOWN))
+ .build())
.build());
break;
default:
nepRate = loopRate;
}
}
- CapacityBuilder capBd = new CapacityBuilder()
- .setUnit(CAPACITYUNITGBPS.VALUE);
List<SupportedPayloadStructure> sps = new ArrayList<>();
for (SupportedInterfaceCapability sic : sicList) {
String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
sps.add(new SupportedPayloadStructureBuilder()
.setMultiplexingSequence(Set.of(PHOTONICLAYERQUALIFIEROTSi.VALUE, ODUTYPEODU4.VALUE))
.setNumberOfCepInstances(Uint64.valueOf(1))
- .setCapacity(capBd.setValue(Decimal64.valueOf(100.0, RoundingMode.DOWN)).build())
+ .setCapacity(
+ new CapacityBuilder()
+ .setUnit(CAPACITYUNITGBPS.VALUE)
+ .setValue(Decimal64.valueOf(100.0, RoundingMode.DOWN))
+ .build())
.build());
break;
case "IfOCHOTUCnODUCn":
case "IfOCHOTUCnODUCnRegen":
case "IfOCHOTUCnODUCnUniregen":
sps.add(new SupportedPayloadStructureBuilder()
- .setMultiplexingSequence(Set.of(PHOTONICLAYERQUALIFIEROTSi.VALUE, OTUTYPEOTUCN.VALUE,
+ .setMultiplexingSequence(Set.of(
+ PHOTONICLAYERQUALIFIEROTSi.VALUE, OTUTYPEOTUCN.VALUE,
ODUTYPEODUCN.VALUE, ODUTYPEODU4.VALUE))
.setNumberOfCepInstances(Uint64.valueOf(nepRate))
- .setCapacity(capBd.setValue(Decimal64.valueOf(nepRate * 100.0, RoundingMode.DOWN)).build())
+ .setCapacity(
+ new CapacityBuilder()
+ .setUnit(CAPACITYUNITGBPS.VALUE)
+ .setValue(Decimal64.valueOf(nepRate * 100.0, RoundingMode.DOWN))
+ .build())
.build());
break;
default:
justification = "Voluntarily No break in switchcase where comment is inserted in following method")
public List<SupportedCepLayerProtocolQualifierInstances> createSupportedCepLayerProtocolQualifier(
Collection<SupportedInterfaceCapability> sicList, LayerProtocolName lpn) {
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
if (sicList == null) {
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- return sclpqiList;
+ return new ArrayList<>(List.of(
+ new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(1))
+ .build()));
}
LOG.debug("SIC list = {}", sicList);
+ List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
for (SupportedInterfaceCapability sic : sicList) {
String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
switch (lpn.getName()) {
}
public Map<Double, Double> getXpdrUsedWavelength(TerminationPoint tp) {
- if (tp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526
- .TerminationPoint1.class) == null
- || tp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm
- .network.topology.rev230526.TerminationPoint1.class).getXpdrNetworkAttributes()
- == null) {
+ var tpAug = tp.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class);
+ if (tpAug == null || tpAug.getXpdrNetworkAttributes() == null) {
return null;
}
- XpdrNetworkAttributes xnatt = tp.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class)
- .getXpdrNetworkAttributes();
- Map<Double,Double> freqWidthMap = new HashMap<>();
- if (xnatt.getWavelength() != null && xnatt.getWavelength().getFrequency() != null
- && xnatt.getWavelength().getWidth() != null) {
- freqWidthMap.put(xnatt.getWavelength().getFrequency().getValue().doubleValue(),
- xnatt.getWavelength().getWidth().getValue().doubleValue());
- return freqWidthMap;
- }
- return null;
+ var xnattWvlgth = tpAug.getXpdrNetworkAttributes().getWavelength();
+ return xnattWvlgth == null || xnattWvlgth.getFrequency() == null || xnattWvlgth.getWidth() == null
+ ? null
+ : new HashMap<>(Map.of(
+ xnattWvlgth.getFrequency().getValue().doubleValue(),
+ xnattWvlgth.getWidth().getValue().doubleValue()));
}
public Map<Double, Double> getPPUsedWavelength(TerminationPoint tp) {
PpAttributes ppAtt = tp.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class)
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class)
.getPpAttributes();
- if (ppAtt == null) {
- return null;
- }
- Map<Double,Double> freqWidthMap = new HashMap<>();
- if (ppAtt.getUsedWavelength() != null && ppAtt.getUsedWavelength().entrySet().iterator().next() != null) {
- freqWidthMap.put(ppAtt.getUsedWavelength().entrySet().iterator().next().getValue().getFrequency().getValue()
- .doubleValue(), ppAtt.getUsedWavelength().entrySet().iterator().next().getValue().getFrequency()
- .getValue().doubleValue());
- return freqWidthMap;
- }
- return null;
+ return ppAtt == null || ppAtt.getUsedWavelength() == null
+ || ppAtt.getUsedWavelength().entrySet().iterator().next() == null
+ ? null
+ : new HashMap<>(Map.of(
+ ppAtt.getUsedWavelength().entrySet().iterator().next().getValue().getFrequency().getValue().doubleValue(),
+ ppAtt.getUsedWavelength().entrySet().iterator().next().getValue().getFrequency().getValue().doubleValue()));
}
- public OwnedNodeEdgePointBuilder addPayloadStructureAndPhotSpecToOnep(String nodeId,
- Map<Double, Double> freqWidthMap, List<OperationalModeKey> operModeList,
+ public OwnedNodeEdgePointBuilder addPayloadStructureAndPhotSpecToOnep(
+ String nodeId, Map<Double, Double> freqWidthMap, List<OperationalModeKey> operModeList,
Collection<SupportedInterfaceCapability> sicColl, OwnedNodeEdgePointBuilder onepBldr, String keyword) {
- if (String.join("+", nodeId, TapiStringConstants.OTSI_MC).equals(keyword)
- || String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS).equals(keyword)) {
- //Creating OTS & OTSI_MC NEP specific attributes
- onepBldr.setSupportedPayloadStructure(createSupportedPayloadStructureForPhtncMedia(
- sicColl,operModeList));
- SpectrumCapabilityPacBuilder spectrumPac = new SpectrumCapabilityPacBuilder();
- OccupiedSpectrumBuilder ospecBd = new OccupiedSpectrumBuilder();
- if (freqWidthMap == null || freqWidthMap.isEmpty()) {
- ospecBd
- .setUpperFrequency(Uint64.valueOf(0))
- .setLowerFrequency(Uint64.valueOf(0));
- onepBldr.setAvailablePayloadStructure(createAvailablePayloadStructureForPhtncMedia(
- false, sicColl,operModeList));
- double naz = 0.01;
- AvailableSpectrum aspec = new AvailableSpectrumBuilder()
- .setUpperFrequency(Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09 + naz)))
- .setLowerFrequency(Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09
- + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06 + naz)))
- .build();
- Map<AvailableSpectrumKey, AvailableSpectrum> aspecMap = new HashMap<>();
- aspecMap.put(new AvailableSpectrumKey(aspec.getLowerFrequency(),
- aspec.getUpperFrequency()), aspec);
- spectrumPac.setAvailableSpectrum(aspecMap);
- } else {
- onepBldr.setAvailablePayloadStructure(createAvailablePayloadStructureForPhtncMedia(
- true, sicColl,operModeList));
- ospecBd
- .setUpperFrequency(Uint64.valueOf(Math.round(
- freqWidthMap.keySet().iterator().next().doubleValue() * 1E09
- + (freqWidthMap.entrySet().iterator().next().getValue().doubleValue() * 1E06) / 2)))
- .setLowerFrequency(Uint64.valueOf(Math.round(
- freqWidthMap.keySet().iterator().next().doubleValue() * 1E09
- - (freqWidthMap.entrySet().iterator().next().getValue().doubleValue() * 1E06) / 2)));
- }
- OccupiedSpectrum ospec = ospecBd.build();
- Map<OccupiedSpectrumKey, OccupiedSpectrum> ospecMap = new HashMap<>();
- ospecMap.put(new OccupiedSpectrumKey(ospec.getLowerFrequency(),
- ospec.getUpperFrequency()), ospec);
- spectrumPac.setOccupiedSpectrum(ospecMap);
- double nazz = 0.01;
- SupportableSpectrum sspec = new SupportableSpectrumBuilder()
- .setUpperFrequency(Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09 + nazz)))
- .setLowerFrequency(Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09
- + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06 + nazz)))
- .build();
- Map<SupportableSpectrumKey, SupportableSpectrum> sspecMap = new HashMap<>();
- sspecMap.put(new SupportableSpectrumKey(sspec.getLowerFrequency(),
- sspec.getUpperFrequency()), sspec);
- spectrumPac.setSupportableSpectrum(sspecMap);
- PhotonicMediaNodeEdgePointSpec pnepSpec = new PhotonicMediaNodeEdgePointSpecBuilder()
- .setSpectrumCapabilityPac(spectrumPac.build())
- .build();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.OwnedNodeEdgePoint1 onep1 =
- new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121
- .OwnedNodeEdgePoint1Builder()
- .setPhotonicMediaNodeEdgePointSpec(pnepSpec)
- .build();
- onepBldr.addAugmentation(onep1);
+ if (!String.join("+", nodeId, TapiStringConstants.OTSI_MC).equals(keyword)
+ && !String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS).equals(keyword)) {
+ return onepBldr;
+ }
+ //Creating OTS & OTSI_MC NEP specific attributes
+ double naz = 0.01;
+ Uint64 supLoFreq = Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09 + naz));
+ Uint64 supUpFreq = Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09
+ + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06 + naz));
+ boolean boolParam;
+ Uint64 upFreq;
+ Uint64 loFreq;
+ SpectrumCapabilityPacBuilder spectrumPac = new SpectrumCapabilityPacBuilder();
+ if (freqWidthMap == null || freqWidthMap.isEmpty()) {
+ upFreq = Uint64.valueOf(0);
+ loFreq = Uint64.valueOf(0);
+ boolParam = false;
+ AvailableSpectrum aspec =
+ new AvailableSpectrumBuilder().setUpperFrequency(supUpFreq).setLowerFrequency(supLoFreq).build();
+ spectrumPac.setAvailableSpectrum(new HashMap<>(Map.of(
+ new AvailableSpectrumKey(aspec.getLowerFrequency(), aspec.getUpperFrequency()), aspec)));
+ } else {
+ upFreq = Uint64.valueOf(Math.round(
+ freqWidthMap.keySet().iterator().next().doubleValue() * 1E09
+ + (freqWidthMap.entrySet().iterator().next().getValue().doubleValue() * 1E06) / 2));
+ loFreq = Uint64.valueOf(Math.round(
+ freqWidthMap.keySet().iterator().next().doubleValue() * 1E09
+ - (freqWidthMap.entrySet().iterator().next().getValue().doubleValue() * 1E06) / 2));
+ boolParam = true;
}
- return onepBldr;
+ return onepBldr
+ .setSupportedPayloadStructure(createSupportedPayloadStructureForPhtncMedia(sicColl, operModeList))
+ .setAvailablePayloadStructure(createAvailablePayloadStructureForPhtncMedia(boolParam, sicColl,operModeList))
+ .addAugmentation(
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121
+ .OwnedNodeEdgePoint1Builder()
+ .setPhotonicMediaNodeEdgePointSpec(
+ new PhotonicMediaNodeEdgePointSpecBuilder()
+ .setSpectrumCapabilityPac(
+ spectrumPac
+ .setOccupiedSpectrum(new HashMap<>(Map.of(
+ new OccupiedSpectrumKey(loFreq, upFreq),
+ new OccupiedSpectrumBuilder()
+ .setUpperFrequency(upFreq)
+ .setLowerFrequency(loFreq)
+ .build())))
+ .setSupportableSpectrum(new HashMap<>(Map.of(
+ new SupportableSpectrumKey(supLoFreq, supUpFreq),
+ new SupportableSpectrumBuilder()
+ .setUpperFrequency(supUpFreq)
+ .setLowerFrequency(supLoFreq)
+ .build())))
+ .build())
+ .build())
+ .build());
}
private OduSwitchingPools createOduSwitchingPoolForTp100G() {
Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
int count = 1;
for (TerminationPoint tp : this.oorNetworkPortList) {
- TpId tpid1 = tp.getTpId();
- TpId tpid2 = tp.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1.class)
- .getAssociatedConnectionMapTp().iterator().next();
- Set<TpId> tpList = new HashSet<>();
- tpList.add(tpid1);
- tpList.add(tpid2);
NonBlockingList nbl = new NonBlockingListBuilder()
.setNblNumber(Uint16.valueOf(count))
- .setTpList(tpList)
+ .setTpList(new HashSet<>(Set.of(
+ tp.getTpId(),
+ tp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526
+ .TerminationPoint1.class)
+ .getAssociatedConnectionMapTp().iterator().next())))
.build();
nblMap.put(nbl.key(), nbl);
count++;
.build();
}
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, Set<LayerProtocolName> layerProtocols) {
+ private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node createTapiNode(
+ Map<NameKey, Name> nodeNames, Set<LayerProtocolName> layerProtocols) {
Uuid nodeUuid = null;
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
- Map<RuleKey, Rule> ruleList = new HashMap<>();
- Set<RuleType> ruleTypes = new HashSet<>();
- ruleTypes.add(RuleType.FORWARDING);
- Rule rule = new RuleBuilder()
- .setLocalId("forward")
- .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(ruleTypes)
- .build();
- ruleList.put(rule.key(), rule);
if (layerProtocols.contains(LayerProtocolName.DSR)
|| layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
- nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
+ Rule rule = new RuleBuilder()
+ .setLocalId("forward")
+ .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
+ .setRuleType(new HashSet<>(Set.of(RuleType.FORWARDING)))
+ .build();
+ nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, new HashMap<>(Map.of(rule.key(), rule)));
} else {
- LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
- .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
+ LOG.error("Undefined LayerProtocolName for {} node {}",
+ nodeNames.get(nodeNames.keySet().iterator().next()).getValueName(),
+ nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
}
// Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
.setRiskCharacteristicName("risk characteristic")
.setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
- RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
- .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
- .build();
return new NodeBuilder()
.setUuid(nodeUuid)
.setName(nodeNames)
.setNodeRuleGroup(nodeRuleGroupList)
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
- .setRiskParameterPac(riskParamPac)
+ .setRiskParameterPac(
+ new RiskParameterPacBuilder()
+ .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
+ .build())
.setErrorCharacteristic("error")
.setLossCharacteristic("loss")
.setRepeatDeliveryCharacteristic("repeat delivery")
.build();
}
- private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
- Uuid nodeUuid;
- nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.XPDR));
+ private Uuid getNodeUuid4Dsr(
+ Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
+ Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList,
+ Map<RuleKey, Rule> ruleList) {
// client NEP DSR creation on DSR/ODU node
for (int i = 0; i < oorClientPortList.size(); i++) {
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid);
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid);
- NameBuilder nameBldr = new NameBuilder().setValue(
- String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- oorClientPortList.get(i).getTpId().getValue()));
- Name name;
- if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
- name = nameBldr.setValueName("100G-tpdr").build();
- } else {
- name = nameBldr.setValueName("NodeEdgePoint_C").build();
- }
-
- OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
- LayerProtocolName.DSR, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
- TapiStringConstants.DSR));
+ String nodeIdDsr = String.join("+",
+ this.ietfNodeId, TapiStringConstants.DSR, oorClientPortList.get(i).getTpId().getValue());
+ Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(nodeIdDsr.getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", nodeIdDsr, nepUuid);
+ this.uuidMap.put(nodeIdDsr, nepUuid);
+ Name name = new NameBuilder()
+ .setValue(nodeIdDsr)
+ .setValueName(OpenroadmNodeType.TPDR.equals(this.ietfNodeType) ? "100G-tpdr" : "NodeEdgePoint_C")
+ .build();
+ OwnedNodeEdgePoint onep = createNep(
+ oorClientPortList.get(i),
+ Map.of(name.key(), name),
+ LayerProtocolName.DSR, LayerProtocolName.DSR, true,
+ String.join("+", this.ietfNodeId, TapiStringConstants.DSR));
onepl.put(onep.key(), onep);
}
// CLIENT NEP E_ODU creation on DSR/ODU node
for (int i = 0; i < oorClientPortList.size(); i++) {
- Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid1);
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue()), nepUuid1);
+ String nodeIdEodu = String.join("+",
+ this.ietfNodeId, TapiStringConstants.E_ODU, oorClientPortList.get(i).getTpId().getValue());
+ Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(nodeIdEodu.getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", nodeIdEodu, nepUuid1);
+ this.uuidMap.put(nodeIdEodu, nepUuid1);
Name onedName = new NameBuilder()
.setValueName("eNodeEdgePoint_N")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU,
- oorClientPortList.get(i).getTpId().getValue()))
+ .setValue(nodeIdEodu)
.build();
-
- OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, false, String.join("+", this.ietfNodeId,
- TapiStringConstants.E_ODU));
+ OwnedNodeEdgePoint onep = createNep(
+ oorClientPortList.get(i),
+ Map.of(onedName.key(), onedName),
+ LayerProtocolName.ODU, LayerProtocolName.DSR, false,
+ String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU));
onepl.put(onep.key(), onep);
}
// NETWORK NEPs I_ODU creation on DSR/ODU node
for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
- LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
+ String nodeIdIodu = String.join("+",
+ this.ietfNodeId, TapiStringConstants.I_ODU, oorNetworkPortList.get(i).getTpId().getValue());
+ Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(nodeIdIodu.getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", nodeIdIodu, nepUuid1);
+ this.uuidMap.put(nodeIdIodu, nepUuid1);
Name onedName = new NameBuilder()
.setValueName("iNodeEdgePoint_N")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU,
- oorNetworkPortList.get(i).getTpId().getValue()))
+ .setValue(nodeIdIodu)
.build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
- LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
- TapiStringConstants.I_ODU));
+ OwnedNodeEdgePoint onep = createNep(
+ oorNetworkPortList.get(i),
+ Map.of(onedName.key(), onedName),
+ LayerProtocolName.ODU, LayerProtocolName.DSR, true,
+ String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU));
onepl.put(onep.key(), onep);
}
// NETWORK NEP OTS network on DSR/ODU node
for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
- .toString());
- LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
+ String nodeIdPmOts = String.join("+",
+ this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS, oorNetworkPortList.get(i).getTpId().getValue());
+ Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(nodeIdPmOts.getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", nodeIdPmOts, nepUuid2);
+ this.uuidMap.put(nodeIdPmOts, nepUuid2);
Name onedName = new NameBuilder()
.setValueName("eNodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
- oorNetworkPortList.get(i).getTpId().getValue()))
+ .setValue(nodeIdPmOts)
.build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
+ OwnedNodeEdgePoint onep = createNep(
+ oorNetworkPortList.get(i),
+ Map.of(onedName.key(), onedName),
LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
String.join("+", this.ietfNodeId, TapiStringConstants.PHTNC_MEDIA_OTS));
onepl.put(onep.key(), onep);
}
for (int i = 0; i < oorNetworkPortList.size(); i++) {
- Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
- .toString());
- LOG.info("NEP = {} has Uuid {} ", String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid3);
- this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue()), nepUuid3);
+ String nodeIdOtMc = String.join("+",
+ this.ietfNodeId, TapiStringConstants.OTSI_MC, oorNetworkPortList.get(i).getTpId().getValue());
+ Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes(nodeIdOtMc.getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("NEP = {} has Uuid {} ", nodeIdOtMc, nepUuid3);
+ this.uuidMap.put(nodeIdOtMc, nepUuid3);
Name onedName = new NameBuilder()
.setValueName("PhotMedNodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC,
- oorNetworkPortList.get(i).getTpId().getValue()))
+ .setValue(nodeIdOtMc)
.build();
-
- OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
+ OwnedNodeEdgePoint onep = createNep(
+ oorNetworkPortList.get(i),
+ Map.of(onedName.key(), onedName),
LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
String.join("+", this.ietfNodeId, TapiStringConstants.OTSI_MC));
onepl.put(onep.key(), onep);
// create NodeRuleGroup
int count = 1;
LOG.debug("ODU switching pool = {}", this.oorOduSwitchingPool.nonnullNonBlockingList().values());
+ String ietfXpdr = String.join("+", this.ietfNodeId, TapiStringConstants.XPDR);
for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
- nepList = new HashMap<>();
+ nepList = new HashMap<>();
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
- oduNepList = new HashMap<>();
+ oduNepList = new HashMap<>();
LOG.debug("UUidMap={}", this.uuidMap.keySet());
LOG.debug("TP list = {}", nbl.getTpList());
for (TpId tp : nbl.getTpList()) {
LOG.debug("TP={}", tp.getValue());
- LOG.debug("UuidKey={}", String.join("+", this.ietfNodeId,
- TapiStringConstants.E_ODU, tp.getValue()));
- if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
- tp.getValue())) || this.uuidMap.containsKey(String.join(
- "+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue()))) {
- String qual = tp.getValue().contains("CLIENT") ? TapiStringConstants.DSR
- : TapiStringConstants.I_ODU;
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
- .node.rule.group.NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- qual, tp.getValue())))
- .build();
+ String ietfEoduTp = String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU, tp.getValue());
+ LOG.debug("UuidKey={}", ietfEoduTp);
+ String ietfIoduTp = String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue());
+ if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR, tp.getValue()))
+ || this.uuidMap.containsKey(ietfIoduTp)) {
+ String qual = tp.getValue().contains("CLIENT")
+ ? TapiStringConstants.DSR : TapiStringConstants.I_ODU;
+ var nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .node.rule.group.NodeEdgePointBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(this.uuidMap.get(ietfXpdr))
+ .setNodeEdgePointUuid(this.uuidMap.get(
+ String.join("+", this.ietfNodeId, qual, tp.getValue())))
+ .build();
nepList.put(nep.key(), nep);
}
- if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId,
- TapiStringConstants.E_ODU, tp.getValue()))) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep1 = new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join(
- "+", this.ietfNodeId, TapiStringConstants.E_ODU, tp.getValue())))
- .build();
+ if (this.uuidMap.containsKey(ietfEoduTp)) {
+ var nep1 = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .node.rule.group.NodeEdgePointBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(this.uuidMap.get(ietfXpdr))
+ .setNodeEdgePointUuid(this.uuidMap.get(ietfEoduTp))
+ .build();
oduNepList.put(nep1.key(), nep1);
}
- if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId,
- TapiStringConstants.I_ODU, tp.getValue()))) {
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint
- nep2 = new org.opendaylight.yang.gen.v1.urn
- .onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointBuilder()
- .setTopologyUuid(tapiTopoUuid)
- .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
- TapiStringConstants.XPDR)))
- .setNodeEdgePointUuid(this.uuidMap.get(String.join(
- "+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue())))
- .build();
+ if (this.uuidMap.containsKey(ietfIoduTp)) {
+ // TODO already checked with DSR above -> potential factorization ?
+ var nep2 = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .node.rule.group.NodeEdgePointBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(this.uuidMap.get(ietfXpdr))
+ .setNodeEdgePointUuid(this.uuidMap.get(ietfIoduTp))
+ .build();
oduNepList.put(nep2.key(), nep2);
}
}
- LOG.debug("NEPLIST (DSR/I_ODU) of [dsr node rule group] is {}", nepList.toString());
- LOG.debug("NEPLIST (E_ODU/I_ODU) of [odu node rule group] is {}", nepList.toString());
+ LOG.debug("NEPLIST (DSR/I_ODU) of [dsr node rule group] is {}", nepList);
+ LOG.debug("NEPLIST (E_ODU/I_ODU) of [odu node rule group] is {}", nepList);
// Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
.setCostAlgorithm("Restricted Shortest Path - RSP")
nodeRuleGroupList.put(nodeRuleGroup2.key(), nodeRuleGroup2);
count++;
}
- return nodeUuid;
+ return this.uuidMap.get(ietfXpdr);
}
private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
- String key = String.join("+", keyword, oorTp.getTpId().getValue());
- AdministrativeState adminState = (oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() != null)
- ? transformAsToTapiAdminState(oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()
- .getName())
- : null;
- OperationalState operState = (oorTp.augmentation(TerminationPoint1.class).getOperationalState() != null)
- ? transformOsToTapiOperationalState(oorTp.augmentation(TerminationPoint1.class).getOperationalState()
- .getName())
- : null;
- org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.TerminationPoint1 tp1 =
- oorTp.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.otn.network.topology.rev230526.TerminationPoint1.class);
+ var tp1 = oorTp.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.TerminationPoint1.class);
if (tp1.getTpSupportedInterfaces() == null) {
LOG.warn("Tp supported interface doesnt exist on TP {}", oorTp.getTpId().getValue());
return null;
}
- Collection<SupportedInterfaceCapability> sicColl = tp1.getTpSupportedInterfaces()
- .getSupportedInterfaceCapability().values();
+ AdministrativeState adminState =
+ oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() == null
+ ? null
+ : transformAsToTapiAdminState(
+ oorTp.augmentation(TerminationPoint1.class).getAdministrativeState().getName());
+ OperationalState operState =
+ oorTp.augmentation(TerminationPoint1.class).getOperationalState() == null
+ ? null
+ : transformOsToTapiOperationalState(
+ oorTp.augmentation(TerminationPoint1.class).getOperationalState().getName());
+ Collection<SupportedInterfaceCapability> sicColl =
+ tp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values();
OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(this.uuidMap.get(key))
+ .setUuid(this.uuidMap.get(String.join("+", keyword, oorTp.getTpId().getValue())))
.setLayerProtocolName(nepProtocol)
- .setName(nepNames);
- onepBldr.setSupportedCepLayerProtocolQualifierInstances(createSupportedCepLayerProtocolQualifier(sicColl,
- nepProtocol))
+ .setName(nepNames)
+ .setSupportedCepLayerProtocolQualifierInstances(
+ createSupportedCepLayerProtocolQualifier(sicColl, nepProtocol))
.setDirection(Direction.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState)
onepBldr.setMappedServiceInterfacePoint(
createMSIP(1, nepProtocol, oorTp.getTpId().getValue(), keyword, sicColl, operState, adminState));
}
- List<OperationalModeKey> opModeList = new ArrayList<>();
if (oorTp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
- if (oorTp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526
- .TerminationPoint1.class) == null
- || oorTp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm
- .network.topology.rev230526.TerminationPoint1.class).getXpdrNetworkAttributes()
- == null) {
+ List<OperationalModeKey> opModeList = new ArrayList<>();
+ var tp11 = oorTp.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class);
+ if (tp11 == null || tp11.getXpdrNetworkAttributes() == null) {
for (SupportedInterfaceCapability sic : sicColl) {
String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
if (("IfOCHOTUCnODUCn").equals(ifCapType) || ("IfOCHOTUCnODUCnUniregen").equals(ifCapType)
|| ("IfOCHOTUCnODUCnRegen").equals(ifCapType)) {
opModeList.add(new OperationalModeKey("400G"));
- LOG.warn(TopologyUtils.NOOPMODEDECLARED + "400G rate available", oorTp.getTpId().toString());
+ LOG.warn(TopologyUtils.NOOPMODEDECLARED + "400G rate available", oorTp.getTpId());
break;
}
}
opModeList.add(new OperationalModeKey("100G"));
- LOG.warn(TopologyUtils.NOOPMODEDECLARED + "100G rate available", oorTp.getTpId().toString());
+ LOG.warn(TopologyUtils.NOOPMODEDECLARED + "100G rate available", oorTp.getTpId());
} else {
- opModeList = oorTp.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class)
- .getXpdrNetworkAttributes().getSupportedOperationalModes().getOperationalMode().keySet().stream()
- .toList();
+ opModeList = tp11.getXpdrNetworkAttributes().getSupportedOperationalModes().getOperationalMode()
+ .keySet().stream().toList();
}
- Map<Double, Double> freqWidthMap = getXpdrUsedWavelength(oorTp);
- onepBldr = addPayloadStructureAndPhotSpecToOnep(this.ietfNodeId, freqWidthMap, opModeList, sicColl,
- onepBldr, keyword);
+ onepBldr = addPayloadStructureAndPhotSpecToOnep(
+ this.ietfNodeId, getXpdrUsedWavelength(oorTp), opModeList, sicColl, onepBldr, keyword);
}
return onepBldr.build();
}
.setValueName("SIP name")
.setValue(String.join("+", nodeid, tpId))
.build();
-
return new ServiceInterfacePointBuilder()
.setUuid(sipUuid)
.setName(Map.of(sipName.key(), sipName))
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH",
justification = "Voluntarily No break in switchcase where comment is inserted in following method")
private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstances>
- createSipSupportedLayerProtocolQualifier(
- Collection<SupportedInterfaceCapability> supportedInterfaceCapability,
- LayerProtocolName lpn) {
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstances>
+ createSipSupportedLayerProtocolQualifier(
+ Collection<SupportedInterfaceCapability> supportedInterfaceCapability, LayerProtocolName lpn) {
if (supportedInterfaceCapability == null) {
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ return new ArrayList<>(List.of(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
.setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- return sclpqiList;
+ .build()));
}
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
for (SupportedInterfaceCapability sic : supportedInterfaceCapability) {
String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
switch (lpn.getName()) {
}
public AdministrativeState transformAsToTapiAdminState(String adminState) {
- if (adminState == null) {
- return null;
- }
- return adminState.equals(AdminStates.InService.getName())
- || adminState.equals(AdministrativeState.UNLOCKED.getName()) ? AdministrativeState.UNLOCKED
- : AdministrativeState.LOCKED;
+ return adminState == null
+ ? null
+ : adminState.equals(AdminStates.InService.getName())
+ || adminState.equals(AdministrativeState.UNLOCKED.getName())
+ ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
}
public OperationalState transformOsToTapiOperationalState(String operState) {
- if (operState == null) {
- return null;
- }
- return operState.equals("inService") || operState.equals(OperationalState.ENABLED.getName())
- ? OperationalState.ENABLED : OperationalState.DISABLED;
+ return operState == null
+ ? null
+ : operState.equals("inService") || operState.equals(OperationalState.ENABLED.getName())
+ ? OperationalState.ENABLED : OperationalState.DISABLED;
}
public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getTapiSips() {
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristic;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.risk.parameter.pac.RiskCharacteristicBuilder;
this.tapiLink = tapiLink;
}
- public void convertRdmToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.Link> rdmTordmLinkList) {
+ public void convertRdmToRdmLinks(
+ List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> rdmTordmLinkList) {
List<String> linksToNotConvert = new ArrayList<>();
LOG.info("creation of {} roadm to roadm links", rdmTordmLinkList.size() / 2);
- for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
- .Link link : rdmTordmLinkList) {
+ for (var link : rdmTordmLinkList) {
if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.Link oppositeLink = rdmTordmLinkList.stream()
+ var oppositeLink = rdmTordmLinkList.stream()
.filter(l -> l.getLinkId().equals(link.augmentation(Link1.class).getOppositeLink()))
.findAny().orElse(null);
-
AdminStates oppLnkAdmState = null;
State oppLnkOpState = null;
if (oppositeLink != null) {
oppLnkAdmState = oppositeLink.augmentation(Link1.class).getAdministrativeState();
oppLnkOpState = oppositeLink.augmentation(Link1.class).getOperationalState();
}
- String adminState =
- link.augmentation(Link1.class).getAdministrativeState() == null
- || oppLnkAdmState == null
- ? null
- : this.tapiLink.setTapiAdminState(
- link.augmentation(Link1.class).getAdministrativeState(), oppLnkAdmState).getName();
- String operState =
- link.augmentation(Link1.class).getOperationalState() == null
- || oppLnkOpState == null
- ? null
- : this.tapiLink.setTapiOperationalState(
- link.augmentation(Link1.class).getOperationalState(), oppLnkOpState).getName();
- Link tapLink = this.tapiLink.createTapiLink(String.join("-",
+ Link tapLink = this.tapiLink.createTapiLink(
+ String.join("-",
link.getSource().getSourceNode().getValue().split("-")[0],
link.getSource().getSourceNode().getValue().split("-")[1]),
- link.getSource().getSourceTp().getValue(), String.join("-",
+ link.getSource().getSourceTp().getValue(),
+ String.join("-",
link.getDestination().getDestNode().getValue().split("-")[0],
link.getDestination().getDestNode().getValue().split("-")[1]),
link.getDestination().getDestTp().getValue(), TapiStringConstants.OMS_RDM_RDM_LINK,
TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA,
- TapiStringConstants.PHTNC_MEDIA_OTS, TapiStringConstants.PHTNC_MEDIA_OTS, adminState, operState,
+ TapiStringConstants.PHTNC_MEDIA_OTS, TapiStringConstants.PHTNC_MEDIA_OTS,
+ //adminState,
+ link.augmentation(Link1.class).getAdministrativeState() == null || oppLnkAdmState == null
+ ? null
+ : this.tapiLink.setTapiAdminState(
+ link.augmentation(Link1.class).getAdministrativeState(), oppLnkAdmState).getName(),
+ //operState,
+ link.augmentation(Link1.class).getOperationalState() == null || oppLnkOpState == null
+ ? null
+ : this.tapiLink.setTapiOperationalState(
+ link.augmentation(Link1.class).getOperationalState(), oppLnkOpState).getName(),
Set.of(LayerProtocolName.PHOTONICMEDIA), Set.of(LayerProtocolName.PHOTONICMEDIA.getName()),
this.tapiTopoUuid);
- linksToNotConvert.add(link
- .augmentation(Link1.class)
- .getOppositeLink().getValue());
+ linksToNotConvert.add(link.augmentation(Link1.class).getOppositeLink().getValue());
tapiLinks.put(tapLink.key(), tapLink);
}
}
public void convertRoadmNode(Node roadm, Network openroadmTopo) {
this.ietfNodeId = roadm.getNodeId().getValue();
this.ietfNodeType = roadm.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class).getNodeType();
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
+ .getNodeType();
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist = new HashMap<>();
// 1. Get degree and srg nodes to map TPs into NEPs
if (openroadmTopo.getNode() == null) {
int numSips = 0;
List<Node> nodeList = new ArrayList<Node>(openroadmTopo.getNode().values());
for (Node node:nodeList) {
- if (node.getSupportingNode().values().stream().noneMatch(sp -> sp.getNodeRef().getValue()
- .equals(this.ietfNodeId))) {
- LOG.debug("Abstracted node {} is not part of {}",
- node.getNodeId().getValue(), this.ietfNodeId);
+ if (node.getSupportingNode().values().stream()
+ .noneMatch(sp -> sp.getNodeRef().getValue().equals(this.ietfNodeId))) {
+ LOG.debug("Abstracted node {} is not part of {}", node.getNodeId().getValue(), this.ietfNodeId);
continue;
}
if (node.augmentation(Node1.class) == null
- && node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.Node1.class) == null) {
+ && node.augmentation(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .Node1.class) == null) {
LOG.warn("Abstracted node {} doesnt have type of node or is not disaggregated",
node.getNodeId().getValue());
continue;
}
- OpenroadmNodeType nodeType = node.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.common.network.rev230526.Node1.class).getNodeType();
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1 node1 =
- node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.Node1.class);
+ OpenroadmNodeType nodeType = node.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.Node1.class)
+ .getNodeType();
+ var node1 = node.augmentation(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class);
LOG.info("TPs of node: {}", node1.getTerminationPoint().values());
switch (nodeType.getIntValue()) {
case 11:
// Get only external TPs of the degree
List<TerminationPoint> degPortList = node1.getTerminationPoint().values().stream()
.filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.DEGREETXRXTTP.getIntValue()
+ == OpenroadmTpType.DEGREETXRXTTP.getIntValue()
|| tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.DEGREERXTTP.getIntValue()
+ == OpenroadmTpType.DEGREERXTTP.getIntValue()
|| tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.DEGREETXTTP.getIntValue())
+ == OpenroadmTpType.DEGREETXTTP.getIntValue())
.collect(Collectors.toList());
// Convert TP List in NEPs and put it in onepl
LOG.info("Degree port List: {}", degPortList);
// Get only external TPs of the srg
List<TerminationPoint> srgPortList = node1.getTerminationPoint().values().stream()
.filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.SRGTXRXPP.getIntValue()
+ == OpenroadmTpType.SRGTXRXPP.getIntValue()
|| tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.SRGRXPP.getIntValue()
+ == OpenroadmTpType.SRGRXPP.getIntValue()
|| tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.SRGTXPP.getIntValue())
+ == OpenroadmTpType.SRGTXPP.getIntValue())
.collect(Collectors.toList());
// Convert TP List in NEPs and put it in onepl
LOG.info("Srg port List: {}", srgPortList);
}
// create tapi Node
// UUID
- Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", roadm.getNodeId().getValue(),
- TapiStringConstants.PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
- LOG.info("Creation of PHOTONIC node for {}, of Uuid {}", roadm.getNodeId().getValue(), nodeUuid.toString());
+ String nodeIdPhMed = String.join("+", roadm.getNodeId().getValue(), TapiStringConstants.PHTNC_MEDIA);
+ Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(nodeIdPhMed.getBytes(Charset.forName("UTF-8"))).toString());
+ LOG.info("Creation of PHOTONIC node for {}, of Uuid {}", roadm.getNodeId().getValue(), nodeUuid);
// Names
- Name nodeNames = new NameBuilder().setValueName("roadm node name")
- .setValue(String.join("+", roadm.getNodeId().getValue(), TapiStringConstants.PHTNC_MEDIA)).build();
- Name nameNodeType = new NameBuilder().setValueName("Node Type")
- .setValue(this.ietfNodeType.getName()).build();
+ Name nodeNames = new NameBuilder().setValueName("roadm node name").setValue(nodeIdPhMed).build();
+ Name nameNodeType = new NameBuilder().setValueName("Node Type").setValue(this.ietfNodeType.getName()).build();
// Protocol Layer
Set<LayerProtocolName> layerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
// Build tapi node
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology
- .Node roadmNode = createRoadmTapiNode(nodeUuid,
- Map.of(nodeNames.key(), nodeNames, nameNodeType.key(), nameNodeType), layerProtocols, oneplist);
+ var roadmNode = createRoadmTapiNode(
+ nodeUuid, Map.of(nodeNames.key(), nodeNames, nameNodeType.key(), nameNodeType), layerProtocols, oneplist);
// TODO add states corresponding to device config
LOG.info("ROADM node {} should have {} NEPs and {} SIPs", roadm.getNodeId().getValue(), numNeps, numSips);
- LOG.info("ROADM node {} has {} NEPs and {} SIPs", roadm.getNodeId().getValue(),
+ LOG.info("ROADM node {} has {} NEPs and {} SIPs",
+ roadm.getNodeId().getValue(),
roadmNode.nonnullOwnedNodeEdgePoint().values().size(),
roadmNode.nonnullOwnedNodeEdgePoint().values().stream()
.filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
-
tapiNodes.put(roadmNode.key(), roadmNode);
}
- private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node
- createRoadmTapiNode(Uuid nodeUuid, Map<NameKey, Name> nameMap, Set<LayerProtocolName> layerProtocols,
- Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
+ private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node createRoadmTapiNode(
+ Uuid nodeUuid, Map<NameKey, Name> nameMap, Set<LayerProtocolName> layerProtocols,
+ Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
// Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
.setCostAlgorithm("Restricted Shortest Path - RSP")
.setRiskCharacteristicName("risk characteristic")
.setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
- RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
- .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
- .build();
return new NodeBuilder()
.setUuid(nodeUuid)
.setName(nameMap)
.createNodeRuleGroupForRdmNode("Full",nodeUuid, this.ietfNodeId, oneplist.values()))
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
- .setRiskParameterPac(riskParamPac)
+ .setRiskParameterPac(
+ new RiskParameterPacBuilder()
+ .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
+ .build())
.setErrorCharacteristic("error")
.setLossCharacteristic("loss")
.setRepeatDeliveryCharacteristic("repeat delivery")
.build();
}
- private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(List<TerminationPoint> tpList,
- boolean withSip, String nepPhotonicSublayer) {
+ private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(
+ List<TerminationPoint> tpList, boolean withSip, String nepPhotonicSublayer) {
// create neps for MC and OTSiMC and Photonic Media
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
for (TerminationPoint tp:tpList) {
- // Admin and oper state common for all tps
- AdminStates admin = tp.augmentation(TerminationPoint1.class).getAdministrativeState();
- State oper = tp.augmentation(TerminationPoint1.class).getOperationalState();
// PHOTONIC MEDIA nep
- LOG.info("PHOTO NEP = {}", String.join("+", this.ietfNodeId, nepPhotonicSublayer,
- tp.getTpId().getValue()));
+ String nodeIdNepTp = String.join("+", this.ietfNodeId, nepPhotonicSublayer, tp.getTpId().getValue());
+ LOG.info("PHOTO NEP = {}", nodeIdNepTp);
Name nepName = new NameBuilder()
.setValueName(nepPhotonicSublayer + "NodeEdgePoint")
- .setValue(String.join("+", this.ietfNodeId, nepPhotonicSublayer,
- tp.getTpId().getValue()))
+ .setValue(nodeIdNepTp)
.build();
-
- List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
- sclpqiList.add(
- new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(
- TapiStringConstants.PHTNC_MEDIA_OMS.equals(nepPhotonicSublayer)
- ? PHOTONICLAYERQUALIFIEROMS.VALUE
- : PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId,
- nepPhotonicSublayer, tp.getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8"))).toString()))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes(nodeIdNepTp.getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifierInstances(sclpqiList)
+ .setSupportedCepLayerProtocolQualifierInstances(
+ new ArrayList<>(List.of(
+ new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(
+ TapiStringConstants.PHTNC_MEDIA_OMS.equals(nepPhotonicSublayer)
+ ? PHOTONICLAYERQUALIFIEROMS.VALUE
+ : PHOTONICLAYERQUALIFIEROTS.VALUE)
+ .setNumberOfCepInstances(Uint64.valueOf(1))
+ .build())))
.setDirection(Direction.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
- .setOperationalState(this.tapiLink.setTapiOperationalState(oper.getName()))
+ .setAdministrativeState(this.tapiLink.setTapiAdminState(
+ // Admin state common for all tps
+ tp.augmentation(TerminationPoint1.class).getAdministrativeState().getName()))
+ .setOperationalState(this.tapiLink.setTapiOperationalState(
+ // Oper state common for all tps
+ tp.augmentation(TerminationPoint1.class).getOperationalState().getName()))
.setLifecycleState(LifecycleState.INSTALLED)
.build();
onepMap.put(onep.key(), onep);
return onepMap;
}
- public void convertXpdrToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.Link> xpdrRdmLinkList) {
+ public void convertXpdrToRdmLinks(
+ List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+ .networks.network.Link> xpdrRdmLinkList) {
List<String> linksToNotConvert = new ArrayList<>();
LOG.info("creation of {} xpdr to roadm links", xpdrRdmLinkList.size() / 2);
// LOG.info("Link list = {}", xpdrRdmLinkList.toString());
- for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.Link link:xpdrRdmLinkList) {
+ for (var link:xpdrRdmLinkList) {
if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.Link oppositeLink = xpdrRdmLinkList.stream()
+ var oppositeLink = xpdrRdmLinkList.stream()
.filter(l -> l.getLinkId().equals(link.augmentation(Link1.class).getOppositeLink())).findAny()
.orElse(null);
-
AdminStates oppLnkAdmState = null;
State oppLnkOpState = null;
if (oppositeLink != null) {
oppLnkAdmState = oppositeLink.augmentation(Link1.class).getAdministrativeState();
oppLnkOpState = oppositeLink.augmentation(Link1.class).getOperationalState();
}
- String adminState =
- link.augmentation(Link1.class).getAdministrativeState() == null
- || oppLnkAdmState == null
- ? null
- : this.tapiLink.setTapiAdminState(
- link.augmentation(Link1.class).getAdministrativeState(), oppLnkAdmState).getName();
- String operState =
- link.augmentation(Link1.class).getOperationalState() == null
- || oppLnkOpState == null
- ? null
- : this.tapiLink.setTapiOperationalState(
- link.augmentation(Link1.class).getOperationalState(), oppLnkOpState).getName();
-
- String sourceNode = (link.getSource().getSourceNode().getValue().contains("ROADM"))
- ? getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue())
- : link.getSource().getSourceNode().getValue();
- String sourceTp = link.getSource().getSourceTp().getValue();
- String sourceNodeQual = sourceNode.contains("ROADM") ? TapiStringConstants.PHTNC_MEDIA
- : TapiStringConstants.XPDR;
- String destNode = (link.getDestination().getDestNode().getValue().contains("ROADM"))
- ? getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue())
- : link.getDestination().getDestNode().getValue();
- String destTp = link.getDestination().getDestTp().getValue();
- String destNodeQual = destNode.contains("ROADM") ? TapiStringConstants.PHTNC_MEDIA
- : TapiStringConstants.XPDR;
- Link tapLink = this.tapiLink.createTapiLink(sourceNode, sourceTp, destNode, destTp,
- TapiStringConstants.OMS_XPDR_RDM_LINK, sourceNodeQual, destNodeQual,
- TapiStringConstants.PHTNC_MEDIA_OTS, TapiStringConstants.PHTNC_MEDIA_OTS, adminState,
- operState, Set.of(LayerProtocolName.PHOTONICMEDIA),
- Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid);
+ String sourceNode =
+ link.getSource().getSourceNode().getValue().contains("ROADM")
+ ? getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue())
+ : link.getSource().getSourceNode().getValue();
+ String destNode =
+ link.getDestination().getDestNode().getValue().contains("ROADM")
+ ? getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue())
+ : link.getDestination().getDestNode().getValue();
+ Link tapLink = this.tapiLink.createTapiLink(
+ sourceNode, link.getSource().getSourceTp().getValue(),
+ destNode, link.getDestination().getDestTp().getValue(),
+ TapiStringConstants.OMS_XPDR_RDM_LINK,
+ sourceNode.contains("ROADM") ? TapiStringConstants.PHTNC_MEDIA : TapiStringConstants.XPDR,
+ destNode.contains("ROADM") ? TapiStringConstants.PHTNC_MEDIA : TapiStringConstants.XPDR,
+ TapiStringConstants.PHTNC_MEDIA_OTS, TapiStringConstants.PHTNC_MEDIA_OTS,
+ //adminState,
+ link.augmentation(Link1.class).getAdministrativeState() == null || oppLnkAdmState == null
+ ? null
+ : this.tapiLink.setTapiAdminState(
+ link.augmentation(Link1.class).getAdministrativeState(), oppLnkAdmState).getName(),
+ //operState,
+ link.augmentation(Link1.class).getOperationalState() == null || oppLnkOpState == null
+ ? null
+ : this.tapiLink.setTapiOperationalState(
+ link.augmentation(Link1.class).getOperationalState(), oppLnkOpState).getName(),
+ Set.of(LayerProtocolName.PHOTONICMEDIA), Set.of(LayerProtocolName.PHOTONICMEDIA.getName()),
+ this.tapiTopoUuid);
linksToNotConvert.add(link.augmentation(Link1.class).getOppositeLink().getValue());
this.tapiLinks.put(tapLink.key(), tapLink);
}
}
}
-
public void setTapiNodes(Map<NodeKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> nodeMap) {
this.tapiNodes.putAll(nodeMap);
</current-pm-entry>
</current-pm-list>
+ <current-pm-description xmlns="http://honeynode-simulator/pm-handling">
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:opticalTransport</triggering-interface>
+ <pm-name-prefix>opticalPowerOutput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of the first NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[TX/TXRX]-[frequency]-->
+ <!--Its value will be changed as additional NMC are created-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>0</default-current-value>
+ <max-value>21.82</max-value>
+ <min-value>-9.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>5</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:opticalTransport</triggering-interface>
+ <pm-name-prefix>opticalPowerInput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of a NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[RX/TXRX]-[frequency]-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>-17.0</default-current-value>
+ <max-value>-9.0</max-value>
+ <min-value>-25.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>10</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:openROADMOpticalMultiplex</triggering-interface>
+ <pm-name-prefix>opticalPowerOutput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of the first NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[TX/TXRX]-[frequency]-->
+ <!--Its value will be changed as additional NMC are created-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>0</default-current-value>
+ <max-value>21.82</max-value>
+ <min-value>-9.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>5</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:openROADMOpticalMultiplex</triggering-interface>
+ <pm-name-prefix>opticalPowerInput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of a NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[RX/TXRX]-[frequency]-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>-17.0</default-current-value>
+ <max-value>-9.0</max-value>
+ <min-value>-25.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>10</evolution-range>
+ </pm-generation-rules>
+ </current-pm-description>
+
</data>
</connection-ports>
</degree>
</org-openroadm-device>
- </data>
+
+ <current-pm-list xmlns="http://org/openroadm/pm">
+ <current-pm-entry>
+ <pm-resource-instance xmlns:d="http://org/openroadm/device">/d:org-openroadm-device/d:interface[d:name='OTS-DEG1-TTP-TXRX']</pm-resource-instance>
+ <pm-resource-type>interface</pm-resource-type>
+ <pm-resource-type-extension></pm-resource-type-extension>
+ <retrieval-time>2018-06-07T13:22:58+00:00</retrieval-time>
+ <current-pm>
+ <type>opticalPowerOutput</type>
+ <extension></extension>
+ <location>nearEnd</location>
+ <direction>tx</direction>
+ <measurement>
+ <granularity>15min</granularity>
+ <pmParameterValue>2.5</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ <measurement>
+ <granularity>24Hour</granularity>
+ <pmParameterValue>2.23</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ </current-pm>
+ <current-pm>
+ <type>opticalPowerInput</type>
+ <extension></extension>
+ <location>nearEnd</location>
+ <direction>rx</direction>
+ <measurement>
+ <granularity>15min</granularity>
+ <pmParameterValue>-21.1</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ <measurement>
+ <granularity>24Hour</granularity>
+ <pmParameterValue>-49.3</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ </current-pm>
+ <current-pm>
+ <type>opticalReturnLoss</type>
+ <extension></extension>
+ <location>nearEnd</location>
+ <direction>rx</direction>
+ <measurement>
+ <granularity>15min</granularity>
+ <pmParameterValue>40</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ <measurement>
+ <granularity>24Hour</granularity>
+ <pmParameterValue>44</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ </current-pm>
+ </current-pm-entry>
+ <current-pm-entry>
+ <pm-resource-instance xmlns:d="http://org/openroadm/device">/d:org-openroadm-device/d:interface[d:name='OTS-DEG2-TTP-TXRX']</pm-resource-instance>
+ <pm-resource-type>interface</pm-resource-type>
+ <pm-resource-type-extension></pm-resource-type-extension>
+ <retrieval-time>2018-06-07T13:22:58+00:00</retrieval-time>
+ <current-pm>
+ <type>opticalPowerOutput</type>
+ <extension></extension>
+ <location>nearEnd</location>
+ <direction>tx</direction>
+ <measurement>
+ <granularity>15min</granularity>
+ <pmParameterValue>2.5</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ <measurement>
+ <granularity>24Hour</granularity>
+ <pmParameterValue>2.23</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ </current-pm>
+ <current-pm>
+ <type>opticalPowerInput</type>
+ <extension></extension>
+ <location>nearEnd</location>
+ <direction>rx</direction>
+ <measurement>
+ <granularity>15min</granularity>
+ <pmParameterValue>-21.1</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ <measurement>
+ <granularity>24Hour</granularity>
+ <pmParameterValue>-49.3</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ </current-pm>
+ <current-pm>
+ <type>opticalReturnLoss</type>
+ <extension></extension>
+ <location>nearEnd</location>
+ <direction>rx</direction>
+ <measurement>
+ <granularity>15min</granularity>
+ <pmParameterValue>40</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ <measurement>
+ <granularity>24Hour</granularity>
+ <pmParameterValue>44</pmParameterValue>
+ <pmParameterUnit>dBm</pmParameterUnit>
+ <validity>complete</validity>
+ </measurement>
+ </current-pm>
+ </current-pm-entry>
+ </current-pm-list>
+
+ <current-pm-description xmlns="http://honeynode-simulator/pm-handling">
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:opticalTransport</triggering-interface>
+ <pm-name-prefix>opticalPowerOutput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of the first NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[TX/TXRX]-[frequency]-->
+ <!--Its value will be changed as additional NMC are created-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>0</default-current-value>
+ <max-value>21.82</max-value>
+ <min-value>-9.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>5</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:opticalTransport</triggering-interface>
+ <pm-name-prefix>opticalPowerInput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of a NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[RX/TXRX]-[frequency]-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>-17.0</default-current-value>
+ <max-value>-9.0</max-value>
+ <min-value>-25.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>10</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:openROADMOpticalMultiplex</triggering-interface>
+ <pm-name-prefix>opticalPowerOutput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of the first NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[TX/TXRX]-[frequency]-->
+ <!--Its value will be changed as additional NMC are created-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>0</default-current-value>
+ <max-value>21.82</max-value>
+ <min-value>-9.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>5</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:openROADMOpticalMultiplex</triggering-interface>
+ <pm-name-prefix>opticalPowerInput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of a NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[RX/TXRX]-[frequency]-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>-17.0</default-current-value>
+ <max-value>-9.0</max-value>
+ <min-value>-25.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>10</evolution-range>
+ </pm-generation-rules>
+ </current-pm-description>
+
+</data>
</current-pm-entry>
</current-pm-list>
- </data>
+ <current-pm-description xmlns="http://honeynode-simulator/pm-handling">
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:opticalTransport</triggering-interface>
+ <pm-name-prefix>opticalPowerOutput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of the first NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[TX/TXRX]-[frequency]-->
+ <!--Its value will be changed as additional NMC are created-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>0</default-current-value>
+ <max-value>21.82</max-value>
+ <min-value>-9.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>5</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:opticalTransport</triggering-interface>
+ <pm-name-prefix>opticalPowerInput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of a NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[RX/TXRX]-[frequency]-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>-17.0</default-current-value>
+ <max-value>-9.0</max-value>
+ <min-value>-25.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>10</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:openROADMOpticalMultiplex</triggering-interface>
+ <pm-name-prefix>opticalPowerOutput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of the first NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[TX/TXRX]-[frequency]-->
+ <!--Its value will be changed as additional NMC are created-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>0</default-current-value>
+ <max-value>21.82</max-value>
+ <min-value>-9.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>5</evolution-range>
+ </pm-generation-rules>
+ <pm-generation-rules>
+ <triggering-interface xmlns:org-openroadm-interfaces="http://org/openroadm/interfaces">org-openroadm-interfaces:openROADMOpticalMultiplex</triggering-interface>
+ <pm-name-prefix>opticalPowerInput</pm-name-prefix>
+ <!--This PM is generated on ROADMs on creation of a NMC (MediaChannel) interface nmc-ttp-DEGX-TTP-[RX/TXRX]-[frequency]-->
+ <analog>true</analog>
+ <!--Default value is purely indicative, the value shall be set trough pm-interact RPC according to a value calculated from span loss and Power mask -->
+ <!--The value set through the RPC will be the value to keep as a reference out of any forced mode use to simulate a failure -->
+ <default-current-value>-17.0</default-current-value>
+ <max-value>-9.0</max-value>
+ <min-value>-25.0</min-value>
+ <!--Evolution range is a percentage of the min max range expressed in dB-->
+ <evolution-range>10</evolution-range>
+ </pm-generation-rules>
+ </current-pm-description>
+
+</data>