+ return new ServicePathOutputBuilder()
+ .setSuccess(success.get())
+ .setLinkTp(otnLinkTps)
+ .setResult(
+ results.isEmpty()
+ ? "Request processed"
+ : String.join("\n", results))
+ .build();
+ }
+
+ private List<String> getInterfaces2delete(
+ String nodeId, String srcTp, String destTp, int lowerSpectralSlotNumber, int higherSpectralSlotNumber) {
+ String spectralSlotName = String.join(GridConstant.SPECTRAL_SLOT_SEPARATOR,
+ String.valueOf(lowerSpectralSlotNumber),
+ String.valueOf(higherSpectralSlotNumber));
+
+ if (destTp.contains(StringConstants.NETWORK_TOKEN)
+ || srcTp.contains(StringConstants.CLIENT_TOKEN)
+ || srcTp.contains(StringConstants.NETWORK_TOKEN)
+ || destTp.contains(StringConstants.CLIENT_TOKEN)) {
+ return getInterfacesTodelete(nodeId, srcTp, destTp, spectralSlotName);
+ }
+
+ List<String> interfacesToDelete = new LinkedList<>();
+ String connectionNumber = String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, destTp, spectralSlotName);
+ List<String> intToDelete = this.crossConnect.deleteCrossConnect(nodeId, connectionNumber, false);
+ for (String interf : intToDelete == null ? new ArrayList<String>() : intToDelete) {
+ if (!this.openRoadmInterfaceFactory.isUsedByXc(
+ nodeId, interf, connectionNumber, this.deviceTransactionManager)) {
+ interfacesToDelete.add(interf);
+ }
+ }
+ return interfacesToDelete;
+ }
+
+ private List<String> getInterfacesTodelete(String nodeId, String srcTp, String destTp, String spectralSlotName) {
+
+ OpenroadmNodeVersion nodeOpenRoadmVersion =
+ this.portMapping.getNode(nodeId).getNodeInfo().getOpenroadmVersion();
+ List<String> interfacesToDelete = new LinkedList<>();
+ Map<String, List<String>> suffixListMap =
+ nodeOpenRoadmVersion.equals(OpenroadmNodeVersion._71)
+ ? Map.of(
+ "ODU", List.of("ODUC4","ODUFLEX"),
+ // -400G added due to the change in naming convention
+ "other", List.of("OTUC4", "OTSIGROUP-400G", spectralSlotName))
+ : Map.of(
+ "ODU", List.of("ODU", "ODU4"),
+ "other", List.of("OTU", spectralSlotName));
+ // this last suffix used to be retrieved from openRoadmInterfaceFactory.createOpenRoadmOchInterfaceName
+ // i.e. String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, spectralSlotName) with
+ // common GridConstant that states NAME_PARAMETERS_SEPARATOR = "-"
+
+ if (destTp.contains(StringConstants.NETWORK_TOKEN)) {
+ try {
+ for (String suffix : suffixListMap.get("ODU")) {
+ if (this.openRoadmInterfaces.getInterface(
+ nodeId, String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix)).isPresent()) {
+ interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix));
+ }
+ }
+ }
+ catch (OpenRoadmInterfaceException e) {
+ LOG.error("impossible to get one of the interfaces {}",
+ destTp + GridConstant.NAME_PARAMETERS_SEPARATOR + String.join(
+ " or " + destTp + GridConstant.NAME_PARAMETERS_SEPARATOR,
+ suffixListMap.get("ODU")),
+ e);
+ }
+ for (String suffix : suffixListMap.get("other")) {
+ interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix));
+ }