- ForkJoinTask forkJoinTask = forkJoinPool.submit(() ->
- nodes.parallelStream().forEach(node -> {
- String nodeId = node.getNodeId();
- LOG.info("Starting provisioning for node : {}", nodeId);
- List<String> createdEthInterfaces = new ArrayList<>();
- List<String> createdOtuInterfaces = new ArrayList<>();
- List<String> createdOduInterfaces = new ArrayList<>();
- List<String> createdOchInterfaces = new ArrayList<>();
- List<String> createdConnections = new ArrayList<>();
- int crossConnectFlag = 0;
-
- try {
- // if the node is currently mounted then proceed
- if (this.deviceTransactionManager.isDeviceMounted(nodeId)) {
- String srcTp = node.getSrcTp();
- String destTp = node.getDestTp();
-
- Long waveNumber = input.getWaveNumber();
- if ((destTp != null) && destTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) {
- crossConnectFlag++;
- // create OpenRoadm Xponder Line Interfaces
- String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
- nodeId, destTp, waveNumber, R100G.class, ModulationFormat.DpQpsk);
- createdOchInterfaces.add(supportingOchInterface);
-
- String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
- nodeId, destTp, supportingOchInterface);
- createdOtuInterfaces.add(supportingOtuInterface);
-
- createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(
- nodeId, destTp,supportingOtuInterface));
- }
- if ((srcTp != null) && srcTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) {
- crossConnectFlag++;
- // create OpenRoadm Xponder Client Interfaces
- createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId,
- srcTp));
-
-
- }
- if ((srcTp != null) && srcTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) {
- crossConnectFlag++;
- // create OpenRoadm Xponder Line Interfaces
- String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
- nodeId, srcTp, waveNumber, R100G.class, ModulationFormat.DpQpsk);
- createdOchInterfaces.add(supportingOchInterface);
-
- String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
- nodeId, srcTp, supportingOchInterface);
- createdOtuInterfaces.add(supportingOtuInterface);
-
- createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(
- nodeId, srcTp, supportingOtuInterface));
- }
- if ((destTp != null) && destTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) {
- crossConnectFlag++;
- // create OpenRoadm Xponder Client Interfaces
- createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId,
- destTp));
-
-
+ 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);
+ List<String> createdEthInterfaces = new ArrayList<>();
+ List<String> createdOtuInterfaces = new ArrayList<>();
+ List<String> createdOduInterfaces = new ArrayList<>();
+ List<String> createdOchInterfaces = new ArrayList<>();
+ List<String> createdConnections = new ArrayList<>();
+ int crossConnectFlag = 0;
+ try {
+ // if the node is currently mounted then proceed
+ if (this.deviceTransactionManager.isDeviceMounted(nodeId)) {
+ String srcTp = node.getSrcTp();
+ String destTp = node.getDestTp();
+ if ((destTp != null) && destTp.contains(StringConstants.NETWORK_TOKEN)) {
+ LOG.info("Adding supporting OCH interface for node {}, dest tp {}, spectrumInformation {}",
+ nodeId, destTp, spectrumInformation);
+ crossConnectFlag++;
+ String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
+ nodeId, destTp, spectrumInformation);
+ createdOchInterfaces.add(supportingOchInterface);
+ // Here we pass logical connection-point of z-end to set SAPI and DAPI
+ Nodes tgtNode = null;
+ if (nodeIndex + 1 == nodes.size()) {
+ // For the end node, tgtNode becomes the first node in the list
+ tgtNode = nodes.get(0);
+ } else {
+ tgtNode = nodes.get(nodeIndex + 1);