TapiLink creation refactoring
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / topology / ConvertORTopoToTapiTopo.java
index e12a6b5db12c673df5ac92770dd1777911c6b64d..ad6106b07a037b7132e54e98149aa6e8bfae7ca6 100644 (file)
@@ -11,29 +11,35 @@ import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 import java.util.UUID;
 import java.util.stream.Collectors;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.TerminationPoint1;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev181130.xpdr.odu.switching.pools.OduSwitchingPools;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev181130.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev181130.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev181130.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev181130.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.OpenroadmNodeType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.OpenroadmTpType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev181130.Link1;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev181130.Node1;
+import org.opendaylight.transportpce.tapi.TapiStringConstants;
+import org.opendaylight.transportpce.tapi.utils.TapiLink;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPools;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Node1;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LAYERPROTOCOLQUALIFIER;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
@@ -44,14 +50,12 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Port
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.TotalSizeBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.AvailableCapacityBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.TotalPotentialCapacityBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
@@ -79,21 +83,17 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.to
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey;
 import org.opendaylight.yangtools.yang.common.Uint16;
-import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
 public class ConvertORTopoToTapiTopo {
 
-    private static final String DSR = "DSR";
-    private static final String OTSI = "OTSi";
-    private static final String E_OTSI = "eOTSi";
-    private static final String I_OTSI = "iOTSi";
-    private static final String RDM_INFRA = "ROADM-infra";
     private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiTopo.class);
     private String ietfNodeId;
     private OpenroadmNodeType ietfNodeType;
+    private AdminStates ietfNodeAdminState;
+    private State ietfNodeOperState;
     private List<TerminationPoint> oorClientPortList;
     private List<TerminationPoint> oorNetworkPortList;
     private OduSwitchingPools oorOduSwitchingPool;
@@ -102,29 +102,37 @@ public class ConvertORTopoToTapiTopo {
         tapiNodes;
     private Map<LinkKey, Link> tapiLinks;
     private Map<String, Uuid> uuidMap;
+    private final TapiLink tapiLink;
 
 
-    public ConvertORTopoToTapiTopo(Uuid tapiTopoUuid) {
+    public ConvertORTopoToTapiTopo(Uuid tapiTopoUuid, TapiLink tapiLink) {
         this.tapiTopoUuid = tapiTopoUuid;
         this.tapiNodes = new HashMap<>();
         this.tapiLinks = new HashMap<>();
         this.uuidMap = new HashMap<>();
+        this.tapiLink = tapiLink;
     }
 
     public void convertNode(Node ietfNode, List<String> networkPorts) {
         this.ietfNodeId = ietfNode.getNodeId().getValue();
-        if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.Node1.class)
-            == null) {
+        if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
+                == null) {
             return;
         }
         this.ietfNodeType = ietfNode.augmentation(
-            org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.Node1.class).getNodeType();
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class).getNodeType();
+        this.ietfNodeAdminState = ietfNode.augmentation(
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
+            .getAdministrativeState();
+        this.ietfNodeOperState = ietfNode.augmentation(
+            org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
+            .getOperationalState();
         this.oorNetworkPortList = ietfNode.augmentation(
-                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
             .getTerminationPoint().values().stream()
             .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
-            == OpenroadmTpType.XPONDERNETWORK.getIntValue()
-            && networkPorts.contains(tp.getTpId().getValue()))
+                == OpenroadmTpType.XPONDERNETWORK.getIntValue()
+                && networkPorts.contains(tp.getTpId().getValue()))
             .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
             .collect(Collectors.toList());
         if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
@@ -132,22 +140,21 @@ public class ConvertORTopoToTapiTopo {
                 .values().stream().findFirst().get();
             this.oorClientPortList = ietfNode.augmentation(
                 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
-            .getTerminationPoint().values().stream()
-            .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
-            == OpenroadmTpType.XPONDERCLIENT.getIntValue())
-            .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
-            .collect(Collectors.toList());
+                .getTerminationPoint().values().stream()
+                .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
+                    == OpenroadmTpType.XPONDERCLIENT.getIntValue())
+                .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
+                .collect(Collectors.toList());
         } else {
             this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
-            List<TpId> toto = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
+            List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
                 .flatMap(nbl -> nbl.getTpList().stream())
                 .collect(Collectors.toList());
-            LOG.info("toto = {}", toto);
             this.oorClientPortList = ietfNode.augmentation(
                 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
                 .getTerminationPoint().values().stream()
                 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
-                    == OpenroadmTpType.XPONDERCLIENT.getIntValue() && toto.contains(tp.getTpId()))
+                    == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
                 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
                 .collect(Collectors.toList());
             this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
@@ -155,9 +162,9 @@ public class ConvertORTopoToTapiTopo {
 
         // node creation [DSR/ODU]
         LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
-        Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, DSR))
-            .getBytes(Charset.forName("UTF-8"))).toString());
-        this.uuidMap.put(String.join("+", this.ietfNodeId, DSR), nodeUuid);
+        Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId,
+            TapiStringConstants.DSR)).getBytes(Charset.forName("UTF-8"))).toString());
+        this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR), nodeUuid);
         Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(this.ietfNodeId).build();
         List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU);
         org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
@@ -166,9 +173,9 @@ public class ConvertORTopoToTapiTopo {
 
         // node creation [otsi]
         LOG.info("creation of an OTSi node for {}", this.ietfNodeId);
-        nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI))
+        nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, TapiStringConstants.OTSI))
             .getBytes(Charset.forName("UTF-8"))).toString());
-        this.uuidMap.put(String.join("+", this.ietfNodeId, OTSI), nodeUuid);
+        this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI), nodeUuid);
         Name nameOtsi =  new NameBuilder().setValueName("otsi node name").setValue(this.ietfNodeId).build();
         List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
         org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
@@ -180,27 +187,68 @@ public class ConvertORTopoToTapiTopo {
         createTapiTransitionalLinks();
     }
 
-    public void convertLinks(List
-        <org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link>
-        otnLinkList) {
+    public void convertLinks(Map<
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+                .LinkKey,
+            org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+                .Link> otnLinkMap) {
+        List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+            .Link> otnLinkList = new ArrayList<>(otnLinkMap.values());
+        Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue()
+            .compareTo(l2.getLinkId().getValue()));
         List<String> linksToNotConvert = new ArrayList<>();
-        LOG.info("creation of {} otn links", otnLinkList.size() / 2);
+        LOG.info("creation of {} otn links", otnLinkMap.size() / 2);
         for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
-            .Link link : otnLinkList) {
-            if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
-                Link tapiLink = createTapiLink(link);
-                linksToNotConvert.add(link
-                    .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.Link1.class)
-                    .getOppositeLink().getValue());
-                tapiLinks.put(tapiLink.key(), tapiLink);
+                .Link otnlink : otnLinkList) {
+            if (!linksToNotConvert.contains(otnlink.getLinkId().getValue())) {
+                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
+                    .network.Link oppositeLink = otnLinkMap.get(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns
+                        .yang.ietf.network.topology.rev180226.networks.network.LinkKey(otnlink.augmentation(Link1.class)
+                    .getOppositeLink()));
+
+                AdminStates oppLnkAdmState = null;
+                State oppLnkOpState = null;
+                String oppositeLinkId = null;
+                if (oppositeLink != null) {
+                    oppLnkAdmState = oppositeLink.augmentation(Link1.class).getAdministrativeState();
+                    oppLnkOpState = oppositeLink.augmentation(Link1.class).getOperationalState();
+                    oppositeLinkId = oppositeLink.getLinkId().getValue();
+                }
+                String adminState =
+                    otnlink.augmentation(Link1.class).getAdministrativeState() == null
+                        || oppLnkAdmState == null
+                    ? null
+                    : this.tapiLink.setTapiAdminState(
+                        otnlink.augmentation(Link1.class).getAdministrativeState(), oppLnkAdmState).getName();
+                String operState = otnlink.augmentation(Link1.class).getOperationalState() == null
+                        || oppLnkOpState == null
+                    ? null
+                    : this.tapiLink.setTapiOperationalState(
+                        otnlink.augmentation(Link1.class).getOperationalState(), oppLnkOpState).getName();
+
+                String prefix = otnlink.getLinkId().getValue().split("-")[0];
+                String nodesQual = prefix.equals("OTU4") ? TapiStringConstants.OTSI : TapiStringConstants.DSR;
+                String tpsQual = prefix.equals("OTU4") ? TapiStringConstants.I_OTSI : TapiStringConstants.E_ODU;
+                LayerProtocolName layerProtocolName = prefix.equals("OTU4") ? LayerProtocolName.PHOTONICMEDIA
+                    : LayerProtocolName.ODU;
+
+                Link tapLink = this.tapiLink.createTapiLink(otnlink.getSource().getSourceNode().getValue(),
+                    otnlink.getSource().getSourceTp().getValue(), otnlink.getDestination().getDestNode().getValue(),
+                    otnlink.getDestination().getDestTp().getValue(), TapiStringConstants.OTN_XPDR_XPDR_LINK, nodesQual,
+                    nodesQual, tpsQual, tpsQual, adminState, operState, List.of(layerProtocolName),
+                    List.of(layerProtocolName.getName()), this.tapiTopoUuid);
+                linksToNotConvert.add(oppositeLinkId);
+                tapiLinks.put(tapLink.key(), tapLink);
             }
         }
     }
 
     public void convertRoadmInfrastructure() {
         LOG.info("abstraction of the ROADM infrastructure towards a photonic node");
-        Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(RDM_INFRA.getBytes(Charset.forName("UTF-8"))).toString());
-        Name nodeName =  new NameBuilder().setValueName("otsi node name").setValue(RDM_INFRA).build();
+        Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.RDM_INFRA
+            .getBytes(Charset.forName("UTF-8"))).toString());
+        Name nodeName =  new NameBuilder().setValueName("otsi node name").setValue(TapiStringConstants.RDM_INFRA)
+            .build();
         List<LayerProtocolName> nodeLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
 
         List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiPhotonicNodes
@@ -239,7 +287,7 @@ public class ConvertORTopoToTapiTopo {
         for (TerminationPoint tp : this.oorNetworkPortList) {
             TpId tpid1 = tp.getTpId();
             TpId tpid2 = new TpId(tp.augmentation(
-                    org.opendaylight.yang.gen.v1.http.transportpce.topology.rev200129.TerminationPoint1.class)
+                    org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1.class)
                 .getAssociatedConnectionMapPort());
             List<TpId> tpList = new ArrayList<>();
             tpList.add(tpid1);
@@ -258,7 +306,7 @@ public class ConvertORTopoToTapiTopo {
     }
 
     private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
-        pruneTapiPhotonicNodes() {
+            pruneTapiPhotonicNodes() {
         List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
             prunedTapiPhotonicNodes = new ArrayList<>();
         List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiPhotonicNodes
@@ -266,12 +314,11 @@ public class ConvertORTopoToTapiTopo {
                 .filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().get(0)))
                 .collect(Collectors.toList());
         for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node
-            : tapiPhotonicNodes) {
+                : tapiPhotonicNodes) {
             Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepM = new HashMap<>();
             for (Map.Entry<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> entry : node.getOwnedNodeEdgePoint().entrySet()) {
                 if (entry.getValue().getName().values().stream()
-                    .filter(name -> name.getValueName().startsWith("eNodeEdgePoint"))
-                    .count() > 0) {
+                        .filter(name -> name.getValueName().startsWith("eNodeEdgePoint")).count() > 0) {
                     onepM.put(entry.getKey(), entry.getValue());
                 }
             }
@@ -283,7 +330,7 @@ public class ConvertORTopoToTapiTopo {
     }
 
     private Map<String, String> convertListNodeWithListNepToMapForUuidAndName(
-        List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> nodes) {
+            List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> nodes) {
         Map<String, String> uuidNameMap = new HashMap<>();
         for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node : nodes) {
             for (OwnedNodeEdgePoint nep : node.nonnullOwnedNodeEdgePoint().values()) {
@@ -299,7 +346,7 @@ public class ConvertORTopoToTapiTopo {
     }
 
     private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
-        createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
+            createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
         Uuid nodeUuid = null;
         Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
         Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
@@ -319,29 +366,29 @@ public class ConvertORTopoToTapiTopo {
                 .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
         }
         return new NodeBuilder()
-                .setUuid(nodeUuid)
-                .setName(nodeNames)
-                .setLayerProtocolName(layerProtocols)
-                .setAdministrativeState(AdministrativeState.UNLOCKED)
-                .setOperationalState(OperationalState.ENABLED)
-                .setLifecycleState(LifecycleState.INSTALLED)
-                .setOwnedNodeEdgePoint(onepl)
-                .setNodeRuleGroup(nodeRuleGroupList)
-                .build();
+            .setUuid(nodeUuid)
+            .setName(nodeNames)
+            .setLayerProtocolName(layerProtocols)
+            .setAdministrativeState(this.tapiLink.setTapiAdminState(this.ietfNodeAdminState.getName()))
+            .setOperationalState(this.tapiLink.setTapiOperationalState(this.ietfNodeOperState.getName()))
+            .setLifecycleState(LifecycleState.INSTALLED)
+            .setOwnedNodeEdgePoint(onepl)
+            .setNodeRuleGroup(nodeRuleGroupList)
+            .build();
     }
 
     private Uuid getNodeUuid4Photonic(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
-        Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
+            Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
         Uuid nodeUuid;
-        nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI));
+        nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI));
         // iNep creation on otsi node
         for (int i = 0; i < oorNetworkPortList.size(); i++) {
             Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
-                    (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
-                    .getBytes(Charset.forName("UTF-8")))
+                (String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI,
+                    oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
                 .toString());
-            this.uuidMap.put(String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
-                nepUuid1);
+            this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI,
+                oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
             Name onedName = new NameBuilder()
                 .setValueName("iNodeEdgePoint")
                 .setValue(oorNetworkPortList.get(i).getTpId().getValue())
@@ -349,17 +396,17 @@ public class ConvertORTopoToTapiTopo {
 
             OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
                 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
-                String.join("+", this.ietfNodeId, I_OTSI));
+                String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI));
             onepl.put(onep.key(), onep);
         }
         // eNep creation on otsi node
         for (int i = 0; i < oorNetworkPortList.size(); i++) {
             Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
-                    (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
-                    .getBytes(Charset.forName("UTF-8")))
+                (String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI,
+                    oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
                 .toString());
-            this.uuidMap.put(String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
-                nepUuid2);
+            this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI,
+                oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
             Name onedName = new NameBuilder()
                 .setValueName("eNodeEdgePoint")
                 .setValue(oorNetworkPortList.get(i).getTpId().getValue())
@@ -367,7 +414,7 @@ public class ConvertORTopoToTapiTopo {
 
             OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
                 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
-                String.join("+", this.ietfNodeId, E_OTSI));
+                String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI));
             onepl.put(onep.key(), onep);
         }
         // create NodeRuleGroup
@@ -380,24 +427,25 @@ public class ConvertORTopoToTapiTopo {
                 .NodeEdgePoint inep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
                 .node.rule.group.NodeEdgePointBuilder()
                 .setTopologyUuid(tapiTopoUuid)
-                .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
+                .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)))
                 .setNodeEdgePointUuid(
-                    this.uuidMap.get(String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue())))
-                .build();
+                    this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI,
+                        tp.getTpId().getValue()))).build();
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
                 .NodeEdgePoint enep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
                 .node.rule.group.NodeEdgePointBuilder()
                 .setTopologyUuid(tapiTopoUuid)
-                .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
+                .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)))
                 .setNodeEdgePointUuid(
-                    this.uuidMap.get(String.join("+", this.ietfNodeId, E_OTSI, tp.getTpId().getValue())))
+                    this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI,
+                        tp.getTpId().getValue())))
                 .build();
             nepList.put(inep.key(), inep);
             nepList.put(enep.key(), enep);
             NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
                 .setUuid(new Uuid(
-                        UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
-                    .toString()))
+                    UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
+                        .toString()))
                 .setRule(ruleList)
                 .setNodeEdgePoint(nepList)
                 .build();
@@ -408,16 +456,16 @@ public class ConvertORTopoToTapiTopo {
     }
 
     private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
-        Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
+            Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
         Uuid nodeUuid;
-        nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, DSR));
+        nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.DSR));
         // client nep creation on DSR/ODU node
         for (int i = 0; i < oorClientPortList.size(); i++) {
             Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
-                (String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()))
-                .getBytes(Charset.forName("UTF-8"))).toString());
-            this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()),
-                nepUuid);
+                (String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+                    oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
+            this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+                oorClientPortList.get(i).getTpId().getValue()), nepUuid);
             NameBuilder nameBldr = new NameBuilder().setValue(oorClientPortList.get(i).getTpId().getValue());
             Name name;
             if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
@@ -427,23 +475,25 @@ public class ConvertORTopoToTapiTopo {
             }
 
             OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
-                LayerProtocolName.ETH, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
+                LayerProtocolName.ETH, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
+                    TapiStringConstants.DSR));
             onepl.put(onep.key(), onep);
         }
         // network nep creation on DSR/ODU node
         for (int i = 0; i < oorNetworkPortList.size(); i++) {
             Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
-                (String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()))
-                .getBytes(Charset.forName("UTF-8"))).toString());
-            this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()),
-                nepUuid);
+                (String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+                    oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
+            this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+                oorNetworkPortList.get(i).getTpId().getValue()), nepUuid);
             Name onedName = new NameBuilder()
                 .setValueName("NodeEdgePoint_N")
                 .setValue(oorNetworkPortList.get(i).getTpId().getValue())
                 .build();
 
             OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
-                LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
+                LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId,
+                    TapiStringConstants.DSR));
             onepl.put(onep.key(), onep);
         }
         // create NodeRuleGroup
@@ -453,21 +503,25 @@ public class ConvertORTopoToTapiTopo {
                 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
                 nepList = new HashMap<>();
             for (TpId tp : nbl.getTpList()) {
-                if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, DSR, tp.getValue()))) {
+                if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR,
+                    tp.getValue()))) {
+
                     org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
                         nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
                         .NodeEdgePointBuilder()
                         .setTopologyUuid(tapiTopoUuid)
-                        .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
-                        .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR, tp.getValue())))
+                        .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
+                            TapiStringConstants.DSR)))
+                        .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId,
+                            TapiStringConstants.DSR, tp.getValue())))
                         .build();
                     nepList.put(nep.key(), nep);
                 }
             }
             NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
                 .setUuid(new Uuid(
-                        UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8")))
-                    .toString()))
+                    UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8")))
+                        .toString()))
                 .setRule(ruleList)
                 .setNodeEdgePoint(nepList)
                 .build();
@@ -478,20 +532,31 @@ public class ConvertORTopoToTapiTopo {
     }
 
     private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
-        LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
+            LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
         String key = String.join("+", keyword, oorTp.getTpId().getValue());
+        AdministrativeState adminState = (oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() != null)
+            ? this.tapiLink.setTapiAdminState(oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()
+                .getName())
+            : null;
+        OperationalState operState = (oorTp.augmentation(TerminationPoint1.class).getOperationalState() != null)
+            ? this.tapiLink.setTapiOperationalState(oorTp.augmentation(TerminationPoint1.class).getOperationalState()
+                .getName())
+            : null;
         OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
             .setUuid(this.uuidMap.get(key))
             .setLayerProtocolName(nepProtocol)
-            .setName(nepNames);
+            .setName(nepNames)
+            .setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol))
+            .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
+            .setLinkPortRole(PortRole.SYMMETRIC)
+            .setAdministrativeState(adminState)
+            .setOperationalState(operState)
+            .setLifecycleState(LifecycleState.INSTALLED)
+            .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+            .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
         if (withSip) {
-            onepBldr.setMappedServiceInterfacePoint(createSIP(1));
+            onepBldr.setMappedServiceInterfacePoint(createSIP(1, oorTp, keyword));
         }
-        onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol));
-        onepBldr.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
-                .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
-                .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
-                .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
         return onepBldr.build();
     }
 
@@ -520,7 +585,7 @@ public class ConvertORTopoToTapiTopo {
     }
 
     private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
-        Collection<OwnedNodeEdgePoint> onepl) {
+            Collection<OwnedNodeEdgePoint> onepl) {
         Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
             nepMap = new HashMap<>();
@@ -552,42 +617,62 @@ public class ConvertORTopoToTapiTopo {
         return nodeRuleGroupMap;
     }
 
-    private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(int nb) {
+    private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(int nb, TerminationPoint tp,
+            String nodeId) {
         Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
         for (int i = 0; i < nb; i++) {
             MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
-                .setServiceInterfacePointUuid(new Uuid(UUID.randomUUID().toString())).build();
+                .setServiceInterfacePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeId,
+                    tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
+                .build();
             msipl.put(msip.key(), msip);
         }
         return msipl;
     }
 
     private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedCepLayerProtocolQualifier(TerminationPoint tp,
-        LayerProtocolName lpn) {
-        List<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new ArrayList<>();
+            LayerProtocolName lpn) {
+        Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
         List<SupportedInterfaceCapability> sicList = new ArrayList<>(
-            tp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm
-            .otn.network.topology.rev181130.TerminationPoint1.class).getTpSupportedInterfaces()
-            .getSupportedInterfaceCapability().values());
+            tp.augmentation(org.opendaylight.yang.gen.v1.http
+                .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class).getTpSupportedInterfaces()
+                .getSupportedInterfaceCapability().values());
         for (SupportedInterfaceCapability sic : sicList) {
             switch (lpn.getName()) {
                 case "DSR":
-                    if (sic.getIfCapType().getSimpleName().equals("If10GEODU2e")) {
-                        sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
-                        sclpqList.add(ODUTYPEODU2E.class);
-                    } else if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")) {
-                        sclpqList.add(ODUTYPEODU4.class);
-                    } else if (sic.getIfCapType().getSimpleName().equals("If100GEODU4")) {
-                        sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
-                        sclpqList.add(ODUTYPEODU4.class);
-                    } else if (sic.getIfCapType().getSimpleName().equals("If100GE")) {
-                        sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
+                    switch (sic.getIfCapType().getSimpleName()) {
+                        case "If10GEODU2e":
+                            sclpqSet.add(ODUTYPEODU2E.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            break;
+                        case "If10GEODU2":
+                            sclpqSet.add(ODUTYPEODU2.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            break;
+                        case "If10GE":
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            break;
+                        case "If100GEODU4":
+                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+                            sclpqSet.add(ODUTYPEODU4.class);
+                            break;
+                        case "If100GE":
+                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+                            break;
+                        case "IfOCHOTU4ODU4":
+                        case "IfOCH":
+                            sclpqSet.add(ODUTYPEODU4.class);
+                            break;
+                        default:
+                            LOG.error("IfCapability type not managed");
+                            break;
                     }
                     break;
                 case "PHOTONIC_MEDIA":
-                    if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")) {
-                        sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.class);
-                        sclpqList.add(PHOTONICLAYERQUALIFIEROMS.class);
+                    if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
+                            || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
+                        sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
+                        sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
                     }
                     break;
                 default:
@@ -595,146 +680,22 @@ public class ConvertORTopoToTapiTopo {
                     break;
             }
         }
-        return sclpqList;
+        return new ArrayList<>(sclpqSet);
     }
 
     private void createTapiTransitionalLinks() {
         for (TerminationPoint tp : this.oorNetworkPortList) {
-            Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
-            String sourceKey = String.join("+", this.ietfNodeId, DSR, tp.getTpId().getValue());
-            Uuid sourceUuidTp = this.uuidMap.get(sourceKey);
-            String destKey = String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue());
-            Uuid destUuidTp = this.uuidMap.get(destKey);
-            NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
-                .setTopologyUuid(this.tapiTopoUuid)
-                .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
-                .setNodeEdgePointUuid(sourceUuidTp)
-                .build();
-            nepList.put(sourceNep.key(), sourceNep);
-            NodeEdgePoint destNep = new NodeEdgePointBuilder()
-                .setTopologyUuid(this.tapiTopoUuid)
-                .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
-                .setNodeEdgePointUuid(destUuidTp)
-                .build();
-            nepList.put(destNep.key(), destNep);
-            Name linkName = new NameBuilder().setValueName("transitional link name")
-                .setValue(String.join("--", this.ietfNodeId, sourceKey, destKey))
-                .build();
-            Link transiLink = new LinkBuilder()
-                .setUuid(new Uuid(
-                        UUID.nameUUIDFromBytes((String.join("--", this.ietfNodeId, sourceKey, destKey))
-                            .getBytes(Charset.forName("UTF-8")))
-                    .toString()))
-                .setName(Map.of(linkName.key(), linkName))
-                .setTransitionedLayerProtocolName(Arrays.asList(LayerProtocolName.ODU.getName(),
-                    LayerProtocolName.PHOTONICMEDIA.getName()))
-                .setNodeEdgePoint(nepList)
-                .setDirection(ForwardingDirection.BIDIRECTIONAL)
-                .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
-                    new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build()).build())
-                .build();
+            Link transiLink = tapiLink.createTapiLink(this.ietfNodeId, tp.getTpId().getValue(), this.ietfNodeId,
+                tp.getTpId().getValue(), TapiStringConstants.TRANSITIONAL_LINK, TapiStringConstants.DSR,
+                TapiStringConstants.OTSI, TapiStringConstants.DSR, TapiStringConstants.I_OTSI,
+                "inService", "inService", Arrays.asList(LayerProtocolName.ODU,
+                    LayerProtocolName.PHOTONICMEDIA),
+                Arrays.asList(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
+                this.tapiTopoUuid);
             this.tapiLinks.put(transiLink.key(), transiLink);
         }
     }
 
-    private Link createTapiLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
-        .networks.network.Link link) {
-        String prefix = link.getLinkId().getValue().split("-")[0];
-        String sourceNode = link.getSource().getSourceNode().getValue();
-        String sourceTp = link.getSource().getSourceTp().toString();
-        String destNode = link.getDestination().getDestNode().getValue();
-        String destTp = link.getDestination().getDestTp().toString();
-        Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
-        Uuid sourceUuidTp;
-        Uuid sourceUuidNode;
-        Uuid destUuidTp;
-        Uuid destUuidNode;
-        Name linkName;
-        switch (prefix) {
-            case "OTU4":
-                sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, I_OTSI, sourceTp));
-                sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, OTSI));
-                NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
-                    .setTopologyUuid(this.tapiTopoUuid)
-                    .setNodeUuid(sourceUuidNode)
-                    .setNodeEdgePointUuid(sourceUuidTp)
-                    .build();
-                nepList.put(sourceNep.key(), sourceNep);
-                destUuidTp = this.uuidMap.get(String.join("+", destNode, I_OTSI, destTp));
-                destUuidNode = this.uuidMap.get(String.join("+", destNode, OTSI));
-                NodeEdgePoint destNep = new NodeEdgePointBuilder()
-                    .setTopologyUuid(this.tapiTopoUuid)
-                    .setNodeUuid(destUuidNode)
-                    .setNodeEdgePointUuid(destUuidTp)
-                    .build();
-                nepList.put(destNep.key(), destNep);
-                linkName = new NameBuilder().setValueName("otn link name")
-                    .setValue(link.getLinkId().getValue())
-                    .build();
-                return new LinkBuilder()
-                    .setUuid(new Uuid(
-                        UUID.nameUUIDFromBytes((link.getLinkId().getValue())
-                            .getBytes(Charset.forName("UTF-8")))
-                    .toString()))
-                .setName(Map.of(linkName.key(), linkName))
-                .setLayerProtocolName(Arrays.asList(LayerProtocolName.PHOTONICMEDIA))
-                .setAdministrativeState(AdministrativeState.UNLOCKED)
-                .setOperationalState(OperationalState.ENABLED)
-                .setDirection(ForwardingDirection.BIDIRECTIONAL)
-                .setNodeEdgePoint(nepList)
-                .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
-                    new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
-                        .setValue(Uint64.valueOf(100)).build()).build())
-                .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
-                    new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
-                        .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
-                    .build())
-                .build();
-            case "ODU4":
-                sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, DSR, sourceTp));
-                sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR));
-                NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder()
-                    .setTopologyUuid(this.tapiTopoUuid)
-                    .setNodeUuid(sourceUuidNode)
-                    .setNodeEdgePointUuid(sourceUuidTp)
-                    .build();
-                nepList.put(sourceNep2.key(), sourceNep2);
-                destUuidTp = this.uuidMap.get(String.join("+", destNode, DSR, destTp));
-                destUuidNode = this.uuidMap.get(String.join("+", destNode, DSR));
-                NodeEdgePoint destNep2 = new NodeEdgePointBuilder()
-                    .setTopologyUuid(this.tapiTopoUuid)
-                    .setNodeUuid(destUuidNode)
-                    .setNodeEdgePointUuid(destUuidTp)
-                    .build();
-                nepList.put(destNep2.key(), destNep2);
-                linkName = new NameBuilder().setValueName("otn link name")
-                    .setValue(link.getLinkId().getValue())
-                    .build();
-                return new LinkBuilder()
-                    .setUuid(new Uuid(
-                        UUID.nameUUIDFromBytes((link.getLinkId().getValue())
-                            .getBytes(Charset.forName("UTF-8")))
-                    .toString()))
-                .setName(Map.of(linkName.key(), linkName))
-                .setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU))
-                .setAdministrativeState(AdministrativeState.UNLOCKED)
-                .setOperationalState(OperationalState.ENABLED)
-                .setDirection(ForwardingDirection.BIDIRECTIONAL)
-                .setNodeEdgePoint(nepList)
-                .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
-                    new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
-                        .setValue(Uint64.valueOf(100)).build()).build())
-                .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
-                    new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
-                        .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
-                    .build())
-                .build();
-            default:
-                LOG.error("OTN link of type {} not managed yet", prefix);
-                return null;
-        }
-    }
-
     private void createTapiOmsLinks(Map<String, String> photonicNepUuisMap, Map<String, String> rdmInfraNepUuisMap) {
         Iterator<Entry<String, String>> it1 = photonicNepUuisMap.entrySet().iterator();
         Iterator<Entry<String, String>> it2 = rdmInfraNepUuisMap.entrySet().iterator();
@@ -763,9 +724,9 @@ public class ConvertORTopoToTapiTopo {
                 .build();
             Link omsLink = new LinkBuilder()
                 .setUuid(new Uuid(
-                      UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
-                          .getBytes(Charset.forName("UTF-8")))
-                  .toString()))
+                    UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
+                        .getBytes(Charset.forName("UTF-8")))
+                        .toString()))
                 .setName(Map.of(linkName.key(), linkName))
                 .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
                 .setNodeEdgePoint(nepMap)
@@ -776,7 +737,7 @@ public class ConvertORTopoToTapiTopo {
     }
 
     public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
-        getTapiNodes() {
+            getTapiNodes() {
         return tapiNodes;
     }