Adapt renderer to manage 100GE service on Switch 01/97801/6
authorGilles Thouenon <gilles.thouenon@orange.com>
Thu, 9 Sep 2021 13:41:39 +0000 (15:41 +0200)
committerGilles Thouenon <gilles.thouenon@orange.com>
Thu, 18 Nov 2021 07:41:17 +0000 (07:41 +0000)
- Add new method in OpenRoadmInterface221 to create ODU4 interface as
an HighOrder interface (to support 100GE flow)
- manage the creation/deletion of Ethernet, ODU4-Client, ODU4-Network
and odu-connection to support the 100GE service over an OTN switch
- manage the new 100GE_S service-type in OtnDeviceRendererService
- propagate the service-type inside the renderer in order to have to
determine it only once at the highest renderer level
(RendererServiceOperations)

JIRA: TRNSPRTPCE-499
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: I23f4df43a66f3d4de8f75687219d3ffa0c148ba5

renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface221.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterfaceFactory.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/OtnDeviceRendererService.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/OtnDeviceRendererServiceImpl.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/tasks/OtnDeviceRenderingTask.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/rpcs/DeviceRendererRPCImpl.java

index 35ad1e63f9f4fd994c3834155a65d8d903f58907..6e4bb91c6a960b700964a28dc2f82cb0750a3522 100644 (file)
@@ -53,8 +53,11 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interface
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019.OtsAttributes;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019.ots.container.OtsBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODU4;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODUCTP;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODUTTP;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODUTTPCTP;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.OTU4;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.OduFunctionIdentity;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.PayloadTypeDef;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.OduAttributes;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.odu.container.OduBuilder;
@@ -239,6 +242,39 @@ public class OpenRoadmInterface221 {
         return ochInterfaceBldr.getName();
     }
 
+    public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isNetworkPort,
+            String supportingInterface) throws OpenRoadmInterfaceException {
+        Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
+        if (mapping == null) {
+            throw new OpenRoadmInterfaceException(
+                    String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+        }
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+            logicalConnPoint + "-ODU4");
+        if (supportingInterface != null) {
+            oduInterfaceBldr.setSupportingInterface(supportingInterface);
+        }
+
+        // ODU interface specific data
+        Class<? extends OduFunctionIdentity> oduFunction = isNetworkPort ? ODUCTP.class : ODUTTPCTP.class;
+        // TODO look at imports of different versions of class
+        oduInterfaceBldr.addAugmentation(
+            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
+                .setOdu(new OduBuilder()
+                    .setRate(ODU4.class)
+                    .setOduFunction(oduFunction)
+                    .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
+                    .setOpu(
+                        new OpuBuilder()
+                        .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07")).build()).build())
+                .build());
+
+        // Post interface on the device
+        openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
+        return oduInterfaceBldr.getName();
+    }
+
     public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
         throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
index 9e49ca1d13fa679dc32190604e8d9f7899528475..35c031975270a64990c053719c670badc604340f 100644 (file)
@@ -168,6 +168,31 @@ public class OpenRoadmInterfaceFactory {
         }
     }
 
+    /**
+     * This methods creates an ODU interface on the given termination point.
+     *
+     * @param nodeId                 node ID
+     * @param logicalConnPoint       logical connection point
+     * @param isNetworkPort          to distinguish a CTP from a TTP
+     * @param supportingInterface supporting OTU4 or 100GE interface
+     * @return Name of the interface if successful, otherwise return null.
+     * @throws OpenRoadmInterfaceException OpenRoadm interface exception
+     */
+
+    public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isNetworkPort,
+            String supportingInterface) throws OpenRoadmInterfaceException {
+        switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+            case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+                LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+                return null;
+            case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+                return openRoadmInterface221.createOpenRoadmOdu4HOInterface(nodeId, logicalConnPoint, isNetworkPort,
+                    supportingInterface);
+            default:
+                return null;
+        }
+    }
+
     /**
      * This methods creates an OTU interface on the given termination point.
      *
index 25c2e85ffc8debf3d66563c7eb5d65ff617e84bf..d022ee9dce6b215b54698a4f77657625a5cdb9ec 100644 (file)
@@ -11,7 +11,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.re
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathOutput;
 
 public interface OtnDeviceRendererService {
-    OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input);
+    OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input, String serviceType);
 
-    OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input);
+    OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input, String serviceType);
 }
index 69266d599ce43a40a40c2f6aa22ce685a410920a..c6c409b77251a50c86571f059c746892ab0361a4 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.transportpce.renderer.provisiondevice;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -25,7 +26,6 @@ import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
-import org.opendaylight.transportpce.common.service.ServiceTypes;
 import org.opendaylight.transportpce.networkmodel.service.NetworkModelService;
 import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathInput;
@@ -65,7 +65,7 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
 
 //TODO Align log messages and returned results messages
     @Override
-    public OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input) {
+    public OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input, String serviceType) {
         LOG.info("Calling setup otn-service path");
         if (input.getServiceFormat() == null || input.getServiceRate() == null) {
             return new OtnServicePathOutputBuilder()
@@ -75,7 +75,6 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
         }
         List<NodeInterface> nodeInterfaces = new ArrayList<>();
         CopyOnWriteArrayList<LinkTp> otnLinkTps = new CopyOnWriteArrayList<>();
-        String serviceType = ServiceTypes.getOtnServiceType(input.getServiceFormat(), input.getServiceRate());
         try {
             switch (serviceType) {
                 case StringConstants.SERVICE_TYPE_1GE:
@@ -96,6 +95,13 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
                 case StringConstants.SERVICE_TYPE_ODUC4:
                     createOduc4TtpInterface(input, nodeInterfaces, otnLinkTps);
                     break;
+                case StringConstants.SERVICE_TYPE_100GE_S:
+                    LOG.info("Calling Node interface for service-type {}", serviceType);
+                    if (input.getNodes() != null) {
+                        createHighOrderInterfaces(input, nodeInterfaces, otnLinkTps);
+                        LOG.info("Node interfaces created");
+                    }
+                    break;
                 default:
                     LOG.error("Service-type {} not managed yet", serviceType);
                     return new OtnServicePathOutputBuilder()
@@ -140,7 +146,7 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
     // 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
-    public OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input) {
+    public OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input, String serviceType) {
         if (input.getNodes() == null) {
             LOG.error("Unable to delete otn service path. input nodes = null");
             return new OtnServicePathOutputBuilder()
@@ -174,34 +180,34 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
             // if the node is currently mounted then proceed.
             List<String> interfacesToDelete = new LinkedList<>();
             String connectionNumber = "";
-            switch (input.getServiceRate().intValue()) {
-                case 100:
-                    if ("ODU".equals(input.getServiceFormat())) {
-                        interfacesToDelete.add(networkTp + "-ODU4");
-                        if (node.getNetwork2Tp() != null) {
-                            interfacesToDelete.add(node.getNetwork2Tp() + "-ODU4");
-                        }
-                    } else if ("Ethernet".equals(input.getServiceFormat())) {
-                        connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU4");
+            switch (serviceType) {
+                case StringConstants.SERVICE_TYPE_100GE_S:
+                    connectionNumber = getConnectionNumber(null, node, networkTp, "ODU4");
+                    break;
+                case StringConstants.SERVICE_TYPE_100GE_M:
+                    connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU4");
+                    break;
+                case StringConstants.SERVICE_TYPE_ODU4:
+                    interfacesToDelete.add(networkTp + "-ODU4");
+                    if (node.getNetwork2Tp() != null) {
+                        interfacesToDelete.add(node.getNetwork2Tp() + "-ODU4");
                     }
                     break;
-                case 400:
-                    if ("ODU".equals(input.getServiceFormat())) {
-                        interfacesToDelete.add(networkTp + "-ODUC4");
-                        if (node.getNetwork2Tp() != null) {
-                            interfacesToDelete.add(node.getNetwork2Tp() + "-ODUC4");
-                        }
+                case StringConstants.SERVICE_TYPE_ODUC4:
+                    interfacesToDelete.add(networkTp + "-ODUC4");
+                    if (node.getNetwork2Tp() != null) {
+                        interfacesToDelete.add(node.getNetwork2Tp() + "-ODUC4");
                     }
                     break;
-                case 10:
+                case StringConstants.SERVICE_TYPE_10GE:
                     connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU2e");
                     break;
-                case 1:
+                case StringConstants.SERVICE_TYPE_1GE:
                     connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU0");
                     break;
                 default:
-                    LOG.error("service rate {} not managed yet", input.getServiceRate());
-                    String result = input.getServiceRate() + " is not supported";
+                    LOG.error("service-type {} not managed yet", serviceType);
+                    String result = serviceType + " is not supported";
                     results.add(result);
                     success.set(false);
                     return;
@@ -212,14 +218,12 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
                         this.deviceTransactionManager)) {
                     interfacesToDelete.add(interf);
                     String supportedInterface = this.openRoadmInterfaces.getSupportedInterface(nodeId, interf);
-                    if (input.getServiceRate().intValue() == 100) {
-                        if (!supportedInterface.contains("ODUC4")) {
-                            interfacesToDelete.add(supportedInterface);
-                        }
-                    } else {
-                        if (!supportedInterface.contains("ODU4")) {
-                            interfacesToDelete.add(supportedInterface);
-                        }
+                    if (supportedInterface == null) {
+                        continue;
+                    }
+                    if ((input.getServiceRate().intValue() == 100 && !supportedInterface.contains("ODUC4"))
+                        || (input.getServiceRate().intValue() != 100 && !supportedInterface.contains("ODU4"))) {
+                        interfacesToDelete.add(supportedInterface);
                     }
                 }
             }
@@ -266,13 +270,23 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
     }
 
     private String getConnectionNumber(String serviceName, Nodes node, String networkTp, String oduType) {
+        List<String> list1 = new ArrayList<>();
+        List<String> list2 = new ArrayList<>(Arrays.asList("x"));
         if (node.getClientTp() != null) {
-            return String.join("-", node.getClientTp(), oduType, serviceName, "x", networkTp, oduType, serviceName);
+            list1.addAll(Arrays.asList(node.getClientTp(), oduType));
+            list2.addAll(Arrays.asList(networkTp, oduType));
         } else if (node.getNetwork2Tp() != null) {
-            return String.join("-", networkTp, oduType, serviceName, "x", node.getNetwork2Tp(), oduType, serviceName);
+            list1.addAll(Arrays.asList(networkTp, oduType));
+            list2.addAll(Arrays.asList(node.getNetwork2Tp(), oduType));
         } else {
             return "";
         }
+        if (serviceName != null) {
+            list1.add(serviceName);
+            list2.add(serviceName);
+        }
+        list1.addAll(list2);
+        return String.join("-", list1);
     }
 
     private Optional<String> postCrossConnect(List<String> createdOduInterfaces, Nodes node)
@@ -397,6 +411,59 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
         }
     }
 
+    private void createHighOrderInterfaces(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
+            CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
+        for (Nodes node : input.getNodes()) {
+            // check if the node is mounted or not?
+            List<String> createdEthInterfaces = new ArrayList<>();
+            List<String> createdOduInterfaces = new ArrayList<>();
+            switch (input.getServiceRate().intValue()) {
+                case 100:
+                    LOG.info("Input service is 100G");
+                    if (node.getClientTp() != null) {
+                        String supEthInter = openRoadmInterfaceFactory.createOpenRoadmEth100GInterface(
+                                node.getNodeId(), node.getClientTp());
+                        createdEthInterfaces.add(supEthInter);
+                        createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
+                                node.getNodeId(), node.getClientTp(), false, supEthInter));
+                    }
+                    createdOduInterfaces.add(
+                        // supporting interface? payload ?
+                        openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(node.getNodeId(), node.getNetworkTp(),
+                                true, null));
+                    linkTpList.add(
+                        new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+                    if (node.getNetwork2Tp() != null) {
+                        createdOduInterfaces.add(
+                            // supporting interface? payload ?
+                            openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(node.getNodeId(),
+                                node.getNetwork2Tp(), true, null));
+                        linkTpList.add(
+                            new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+                    }
+                    break;
+                default:
+                    LOG.error("service rate {} not managed yet", input.getServiceRate());
+                    return;
+            }
+
+            // implement cross connect
+            List<String> createdConnections = new ArrayList<>();
+            if (!createdOduInterfaces.isEmpty()) {
+                Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
+                createdConnections.add(connectionNameOpt.get());
+                LOG.info("Created cross connects");
+            }
+            nodeInterfaces.add(new NodeInterfaceBuilder()
+                    .withKey(new NodeInterfaceKey(node.getNodeId()))
+                    .setNodeId(node.getNodeId())
+                    .setConnectionId(createdConnections)
+                    .setEthInterfaceId(createdEthInterfaces)
+                    .setOduInterfaceId(createdOduInterfaces)
+                    .build());
+        }
+    }
+
     private void createOduc4TtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
         CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
         if (input.getNodes() == null) {
index 8b07c40097d80ef713e9ee6ee41446567faf6e60..ab36c85c4b3fad46e654fc6347bd56e7a1a99ccc 100644 (file)
@@ -48,6 +48,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev21
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownOutput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.get.pm.output.Measurements;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.mapping.Mapping;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210618.RendererRpcResultSp;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210618.RendererRpcResultSpBuilder;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210618.ServiceDeleteInput;
@@ -151,6 +152,7 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
                     case StringConstants.SERVICE_TYPE_1GE:
                     case StringConstants.SERVICE_TYPE_10GE:
                     case StringConstants.SERVICE_TYPE_100GE_M:
+                    case StringConstants.SERVICE_TYPE_100GE_S:
                     case StringConstants.SERVICE_TYPE_ODU4:
                     case StringConstants.SERVICE_TYPE_ODUC4:
                         if (!manageOtnServicePathCreation(input, serviceType, serviceRate)) {
@@ -191,9 +193,10 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
                             OPERATION_FAILED);
                 }
                 PathDescription pathDescription = pathDescriptionOpt.get();
+                Mapping mapping = portMapping.getMapping(service.getServiceAEnd().getNodeId().getValue(),
+                    service.getServiceAEnd().getTxDirection().getPort().getPortName());
                 String serviceType = ServiceTypes.getServiceType(service.getServiceAEnd().getServiceFormat().getName(),
-                    service.getServiceAEnd().getServiceRate(), portMapping.getMapping(service.getServiceAEnd()
-                        .getNodeId().getValue(), service.getServiceAEnd().getTxDirection().getPort().getPortName()));
+                    service.getServiceAEnd().getServiceRate(), mapping);
                 switch (serviceType) {
                     case StringConstants.SERVICE_TYPE_100GE_T:
                     case StringConstants.SERVICE_TYPE_400GE:
@@ -207,6 +210,7 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
                     case StringConstants.SERVICE_TYPE_1GE:
                     case StringConstants.SERVICE_TYPE_10GE:
                     case StringConstants.SERVICE_TYPE_100GE_M:
+                    case StringConstants.SERVICE_TYPE_100GE_S:
                     case StringConstants.SERVICE_TYPE_ODU4:
                     case StringConstants.SERVICE_TYPE_ODUC4:
                         if (!manageOtnServicePathDeletion(serviceName, pathDescription, service, serviceType)) {
@@ -346,19 +350,19 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
         value = "UPM_UNCALLED_PRIVATE_METHOD",
         justification = "call in call() method")
     private List<OtnDeviceRenderingResult> otnDeviceRendering(RollbackProcessor rollbackProcessor,
-        OtnServicePathInput otnServicePathAtoZ, OtnServicePathInput otnServicePathZtoA) {
+        OtnServicePathInput otnServicePathAtoZ, OtnServicePathInput otnServicePathZtoA, String serviceType) {
         LOG.info(RENDERING_DEVICES_A_Z_MSG);
         sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
             otnServicePathAtoZ.getServiceName(), RpcStatusEx.Pending,
             RENDERING_DEVICES_A_Z_MSG);
         ListenableFuture<OtnDeviceRenderingResult> atozrenderingFuture =
-            this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathAtoZ));
+            this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathAtoZ, serviceType));
         LOG.info(RENDERING_DEVICES_Z_A_MSG);
         sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
             otnServicePathZtoA.getServiceName(), RpcStatusEx.Pending,
             RENDERING_DEVICES_Z_A_MSG);
         ListenableFuture<OtnDeviceRenderingResult> ztoarenderingFuture =
-            this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathZtoA));
+            this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathZtoA, serviceType));
         ListenableFuture<List<OtnDeviceRenderingResult>> renderingCombinedFuture =
             Futures.allAsList(atozrenderingFuture, ztoarenderingFuture);
         List<OtnDeviceRenderingResult> otnRenderingResults = new ArrayList<>(2);
@@ -639,7 +643,7 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
         // Rollback should be same for all conditions, so creating a new one
         RollbackProcessor rollbackProcessor = new RollbackProcessor();
         List<OtnDeviceRenderingResult> renderingResults =
-            otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA);
+            otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA, serviceType);
         if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
             rollbackProcessor.rollbackAll();
             sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
@@ -679,7 +683,7 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
 
         RollbackProcessor rollbackProcessor = new RollbackProcessor();
         List<OtnDeviceRenderingResult> renderingResults =
-            otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA);
+            otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA, serviceType);
 
         List<LinkTp> otnLinkTerminationPoints = new ArrayList<>();
         renderingResults.forEach(rr -> otnLinkTerminationPoints.addAll(rr.getOtnLinkTps()));
index 221f8a3606a7d87097e8703fb5f8af37f645c368..59296db118e5bbc4168991f5352bce0f5c05270d 100644 (file)
@@ -22,11 +22,13 @@ public class OtnDeviceRenderingTask implements Callable<OtnDeviceRenderingResult
 
     private final OtnDeviceRendererService otnDeviceRenderer;
     private final OtnServicePathInput otnServicePathInput;
+    private final String serviceType;
 
     public OtnDeviceRenderingTask(OtnDeviceRendererService otnDeviceRendererService,
-            OtnServicePathInput otnServicePathInput) {
+            OtnServicePathInput otnServicePathInput, String serviceType) {
         this.otnDeviceRenderer = otnDeviceRendererService;
         this.otnServicePathInput = otnServicePathInput;
+        this.serviceType = serviceType;
     }
 
     @Override
@@ -36,11 +38,11 @@ public class OtnDeviceRenderingTask implements Callable<OtnDeviceRenderingResult
         switch (this.otnServicePathInput.getOperation()) {
             case Create:
                 operation = "setup";
-                output = this.otnDeviceRenderer.setupOtnServicePath(this.otnServicePathInput);
+                output = this.otnDeviceRenderer.setupOtnServicePath(this.otnServicePathInput, this.serviceType);
                 break;
             case Delete:
                 operation = "delete";
-                output = this.otnDeviceRenderer.deleteOtnServicePath(this.otnServicePathInput);
+                output = this.otnDeviceRenderer.deleteOtnServicePath(this.otnServicePathInput, this.serviceType);
                 break;
             default:
                 return OtnDeviceRenderingResult.failed("Device rendering failed - unknown operation");
index 5a709d6ab7387551b0fcc2cb04ba00e082880089..d9387cddab95d05832596314356ca84a20afa761 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.transportpce.renderer.rpcs;
 
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
+import org.opendaylight.transportpce.common.service.ServiceTypes;
 import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
 import org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererService;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.CreateOtsOmsInput;
@@ -84,15 +85,16 @@ public class DeviceRendererRPCImpl implements TransportpceDeviceRendererService
 
     @Override
     public ListenableFuture<RpcResult<OtnServicePathOutput>> otnServicePath(OtnServicePathInput input) {
-        if (input.getOperation() != null) {
+        if (input.getOperation() != null && input.getServiceFormat() != null && input.getServiceRate() != null) {
+            String serviceType = ServiceTypes.getOtnServiceType(input.getServiceFormat(), input.getServiceRate());
             if (input.getOperation().getIntValue() == 1) {
                 LOG.info("Create operation request received");
                 return RpcResultBuilder.success(this.otnDeviceRendererService
-                        .setupOtnServicePath(input)).buildFuture();
+                        .setupOtnServicePath(input, serviceType)).buildFuture();
             } else if (input.getOperation().getIntValue() == 2) {
                 LOG.info("Delete operation request received");
                 return RpcResultBuilder.success(this.otnDeviceRendererService
-                        .deleteOtnServicePath(input)).buildFuture();
+                        .deleteOtnServicePath(input, serviceType)).buildFuture();
             }
         }
         return RpcResultBuilder.success(new OtnServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();