+ 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(
+ // 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"),
+ // 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",
+ 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);
+ }
+ try {
+ for (String suffix : suffixListMap.get("other")) {
+ if (this.openRoadmInterfaces.getInterface(
+ nodeId, String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix)).isPresent()) {
+ LOG.info("Deleting the interface {}",
+ String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix));
+ 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);
+ }
+ }
+ if (srcTp.contains(StringConstants.NETWORK_TOKEN)) {
+ interfacesToDelete.add(
+ String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, suffixListMap.get("ODU").get(0)));
+ for (String suffix : suffixListMap.get("other")) {
+ interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, suffix));
+ }
+ }
+
+ if (srcTp.contains(StringConstants.CLIENT_TOKEN)) {
+ interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, "ETHERNET"));