X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Frenderer%2Fprovisiondevice%2FDeviceRendererServiceImpl.java;h=39be93c61ee928291fc2fde5d4a7ab1096b397ee;hb=2fc5888c2ab34c93317242a23e46b8d6c35c0292;hp=6a6480e79e8d28dfc3cb625060f93242c6b4f74f;hpb=c2a7990d648d10fd9c5688e717998e0d633fe663;p=transportpce.git diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java index 6a6480e79..39be93c61 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java @@ -10,7 +10,9 @@ package org.opendaylight.transportpce.renderer.provisiondevice; import com.google.common.collect.Sets; import com.google.common.util.concurrent.FluentFuture; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -42,7 +44,6 @@ import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation; import org.opendaylight.transportpce.common.mapping.PortMapping; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces; -import org.opendaylight.transportpce.networkmodel.service.NetworkModelService; import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory; import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServiceListTopology; import org.opendaylight.transportpce.renderer.provisiondevice.servicepath.ServicePathDirection; @@ -63,19 +64,19 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.re 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; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.OpenroadmNodeVersion; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.mapping.Mapping; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.Topology; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceList; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTp; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTpBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterface; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterfaceBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterfaceKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.optical.renderer.nodes.Nodes; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.OpenroadmNodeVersion; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.Topology; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceList; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesKey; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.link.tp.LinkTp; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.link.tp.LinkTpBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.node.interfaces.NodeInterface; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.node.interfaces.NodeInterfaceBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.node.interfaces.NodeInterfaceKey; +import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev220926.optical.renderer.nodes.Nodes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -91,18 +92,16 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { private final OpenRoadmInterfaces openRoadmInterfaces; private final CrossConnect crossConnect; private final PortMapping portMapping; - private final NetworkModelService networkModelService; public DeviceRendererServiceImpl(DataBroker dataBroker, DeviceTransactionManager deviceTransactionManager, OpenRoadmInterfaceFactory openRoadmInterfaceFactory, OpenRoadmInterfaces openRoadmInterfaces, - CrossConnect crossConnect, PortMapping portMapping, NetworkModelService networkModelService) { + CrossConnect crossConnect, PortMapping portMapping) { this.dataBroker = dataBroker; this.deviceTransactionManager = deviceTransactionManager; this.openRoadmInterfaceFactory = openRoadmInterfaceFactory; this.openRoadmInterfaces = openRoadmInterfaces; this.crossConnect = crossConnect; this.portMapping = portMapping; - this.networkModelService = networkModelService; } @SuppressWarnings("rawtypes") @@ -130,8 +129,6 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { ForkJoinPool forkJoinPool = new ForkJoinPool(); ForkJoinTask forkJoinTask = forkJoinPool.submit(() -> nodes.parallelStream().forEach(node -> { String nodeId = node.getNodeId(); - // take the index of the node - int nodeIndex = nodes.indexOf(node); LOG.info("Starting provisioning for node : {}", nodeId); AEndApiInfo apiInfoA = null; ZEndApiInfo apiInfoZ = null; @@ -141,11 +138,11 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(nodeId)) { apiInfoZ = input.getZEndApiInfo(); } - List createdEthInterfaces = new ArrayList<>(); - List createdOtuInterfaces = new ArrayList<>(); - List createdOduInterfaces = new ArrayList<>(); - List createdOchInterfaces = new ArrayList<>(); - List createdConnections = new ArrayList<>(); + Set createdEthInterfaces = new HashSet<>(); + Set createdOtuInterfaces = new HashSet<>(); + Set createdOduInterfaces = new HashSet<>(); + Set createdOchInterfaces = new HashSet<>(); + Set createdConnections = new HashSet<>(); int crossConnectFlag = 0; try { // if the node is currently mounted then proceed @@ -158,15 +155,23 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { crossConnectFlag++; String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface( nodeId, destTp, spectrumInformation); - 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("#"); + createdOchInterfaces = Set.of(listOfSuppOchInf); + // Taking the last element + supportingOchInterface = listOfSuppOchInf[createdOchInterfaces.size() - 1]; String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface( nodeId, destTp, supportingOchInterface, apiInfoA, apiInfoZ); createdOtuInterfaces.add(supportingOtuInterface); if (srcTp == null) { otnLinkTps.add(new LinkTpBuilder().setNodeId(nodeId).setTpId(destTp).build()); } else { - createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface( - nodeId, destTp, false, apiInfoA, apiInfoZ, PT_07)); + // 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("#")); } } if ((srcTp != null) && srcTp.contains(StringConstants.CLIENT_TOKEN)) { @@ -184,6 +189,13 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface( nodeId, srcTp, spectrumInformation); 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("#"); + List tmpCreatedOchInterfaces = Arrays.asList(listOfSuppOchInf); + createdOchInterfaces.addAll(tmpCreatedOchInterfaces); + // Taking the last element + supportingOchInterface = tmpCreatedOchInterfaces.get(tmpCreatedOchInterfaces.size() - 1); String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface( nodeId, srcTp, supportingOchInterface, apiInfoA, apiInfoZ); createdOtuInterfaces.add(supportingOtuInterface); @@ -395,11 +407,11 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { ? Map.of( // We don't need ODUC2, ODUC3 here, since they are handled in OTN service-path // This has to be in an order of deletion - "ODU", List.of("ODU4", "ODUFLEX", "ODUC4"), + "ODU", List.of("ODU4", "ODUFLEX", "ODUC4", "ODUC1"), // Add intermediate OTUCn rates (OTUC2, OTUC3) // OTU4 is used in 100G service on 7.1 model - "other", List.of("OTU4", "OTUC2", "OTUC3", "OTUC4", - "OTSIGROUP-400G", "OTSIGROUP-300G", "OTSIGROUP-200G", + "other", List.of("OTU4", "OTUC1", "OTUC2", "OTUC3", "OTUC4", + "OTSIGROUP-400G", "OTSIGROUP-300G", "OTSIGROUP-200G", "OTSIGROUP-100G", spectralSlotName)) : Map.of( "ODU", List.of("ODU", "ODU4"), @@ -467,7 +479,7 @@ public class DeviceRendererServiceImpl implements DeviceRendererService { boolean success = true; Map failedToRollbackList = new HashMap<>(); for (NodeInterface nodeInterfaces : input.nonnullNodeInterface().values()) { - List failedInterfaces = new ArrayList<>(); + Set failedInterfaces = new HashSet<>(); String nodeId = nodeInterfaces.getNodeId(); for (String connectionId : nodeInterfaces.getConnectionId()) { List listInter = this.crossConnect.deleteCrossConnect(nodeId, connectionId, false);