Refactor TAPI 2.4
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / topology / TapiNetworkModelServiceImpl.java
index 65953989eace4c755b6cb10cd044fc24e5b66bec..8706dc301dc4fea8194387c18ee171fce8a4a2d0 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.transportpce.tapi.topology;
 
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -24,13 +25,16 @@ import java.util.concurrent.ExecutionException;
 import java.util.stream.Collectors;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.transportpce.common.NetworkUtils;
 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
+import org.opendaylight.transportpce.common.fixedflex.GridConstant;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.tapi.R2RTapiLinkDiscovery;
 import org.opendaylight.transportpce.tapi.TapiStringConstants;
 import org.opendaylight.transportpce.tapi.utils.TapiLink;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.network.Nodes;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev231221.network.Nodes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.NodeTypes;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes;
@@ -41,13 +45,21 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.re
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmNodeType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.OpenroadmTpType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityKey;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev230526.SupportedIfCapability;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev191129.SwitchingPoolTypes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev230526.xpdr.mode.attributes.supported.operational.modes.OperationalModeKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1;
 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.rev221121.AdministrativeState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Context;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.ContextBuilder;
@@ -57,8 +69,6 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Life
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.PortRole;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.AvailableCapacityBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.capacity.pac.TotalPotentialCapacityBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameKey;
@@ -81,27 +91,24 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev22112
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepList;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU0;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU2E;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.digital.otn.rev221121.ODUTYPEODU4;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE100GigE;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPE10GigELAN;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev221121.DIGITALSIGNALTYPEGigE;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.NOTIFICATIONTYPEATTRIBUTEVALUECHANGE;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.NotificationBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.notification.ChangedAttributes;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.notification.ChangedAttributesBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.notification.ChangedAttributesKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIERMC;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROMS;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTS;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.PHOTONICLAYERQUALIFIEROTSiMC;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.context.topology.context.topology.node.owned.node.edge.point.PhotonicMediaNodeEdgePointSpec;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.NodeEdgePointRef;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.TOPOLOGYOBJECTTYPENODEEDGEPOINT;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.InterRuleGroup;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.InterRuleGroupKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupKey;
@@ -111,8 +118,6 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.no
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPac;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.RiskParameterPacBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePoint;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointBuilder;
-import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.MappedServiceInterfacePointKey;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstances;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.edge.point.SupportedCepLayerProtocolQualifierInstancesBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint;
@@ -158,6 +163,9 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     private final NetworkTransactionService networkTransactionService;
     private final R2RTapiLinkDiscovery linkDiscovery;
     private final TapiLink tapiLink;
+    private final ConvertORToTapiTopology tapiFactory;
+    private String topologicalMode;
+    private final ConvertORTopoToTapiFullTopo tapiFullFactory;
     private final NotificationPublishService notificationPublishService;
     private Map<ServiceInterfacePointKey, ServiceInterfacePoint> sipMap = new HashMap<>();
 
@@ -168,8 +176,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             @Reference final NotificationPublishService notificationPublishService) {
         this.networkTransactionService = networkTransactionService;
         this.linkDiscovery = new R2RTapiLinkDiscovery(networkTransactionService, deviceTransactionManager, tapiLink);
-        this.tapiLink = tapiLink;
         this.notificationPublishService = notificationPublishService;
+        this.tapiFactory = new ConvertORToTapiTopology(tapiTopoUuid);
+        this.tapiLink = tapiLink;
+        this.tapiFullFactory = new ConvertORTopoToTapiFullTopo(tapiTopoUuid, tapiLink);
+        this.topologicalMode = tapiFullFactory.getTopologicalMode();
     }
 
     @Override
@@ -208,23 +219,51 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             }
             // Transform LCPs into ONEP
             Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap =
-                new HashMap<>(transformDegToOnep(orNodeId, mapDeg));
-            onepMap.putAll(transformSrgToOnep(orNodeId, mapSrg));
-
-            // create tapi Node
-            Node roadmNode = createRoadmTapiNode(orNodeId, onepMap);
-            mergeNodeinTopology(Map.of(roadmNode.key(), roadmNode));
-            mergeSipsinContext(this.sipMap);
-            // TODO add states corresponding to device config -> based on mapping.
-            //  This should be possible after Gilles work is merged
-
-            // rdm to rdm link creation if neighbour roadm is mounted
-            LOG.info("checking if neighbor roadm exists");
-            Map<LinkKey, Link> rdm2rdmLinks = this.linkDiscovery.readLLDP(new NodeId(orNodeId), orNodeVersion,
-                this.tapiTopoUuid);
-            if (!rdm2rdmLinks.isEmpty()) {
-                mergeLinkinTopology(rdm2rdmLinks);
+                new HashMap<>(transformSrgToOnep(orNodeId, mapSrg));
+            LOG.debug("CreateTapiNode NetworkModelServiceImpl, TopologicalMode = {}", topologicalMode);
+            LOG.debug("TAPINETWORKMODELSERVICEIMPL call transformSRGtoONEP (OrNodeId {} ", orNodeId);
+            LOG.debug("TAPINETWORKMODELSERVICEIMPL SRG OTSNode of retrieved OnepMap {} ",
+                onepMap.entrySet().stream().filter(e -> e.getValue()
+                    .getSupportedCepLayerProtocolQualifierInstances()
+                        .contains(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+                            .setNumberOfCepInstances(Uint64.valueOf(1))
+                            .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+                        .build()))
+                .collect(Collectors.toList()));
+            if (topologicalMode.equals("Full")) {
+                onepMap.putAll(transformDegToOnep(orNodeId, mapDeg));
+                LOG.debug("TAPINETWORKMODELSERVICEIMPL DEG+SRG OTSNode of retrieved OnepMap {} ",
+                    onepMap.entrySet().stream().filter(e -> e.getValue()
+                        .getSupportedCepLayerProtocolQualifierInstances()
+                            .contains(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+                                .setNumberOfCepInstances(Uint64.valueOf(1))
+                                .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
+                            .build()))
+                    .collect(Collectors.toList()));
+                LOG.debug("TAPINETWORKMODELSERVICEIMPL DEG+SRG complete retrieved OnepMap {} ", onepMap);
+                // create tapi Node
+                Node roadmNode = createRoadmTapiNode(orNodeId, onepMap);
+                mergeNodeinTopology(Map.of(roadmNode.key(), roadmNode));
+                mergeSipsinContext(this.sipMap);
+                // TODO add states corresponding to device config -> based on mapping.
+                //  This should be possible after Gilles work is merged
+
+                // rdm to rdm link creation if neighbour roadm is mounted
+                LOG.info("checking if neighbor roadm exists");
+                Map<LinkKey, Link> rdm2rdmLinks = this.linkDiscovery.readLLDP(new NodeId(orNodeId), orNodeVersion,
+                    this.tapiTopoUuid);
+                if (!rdm2rdmLinks.isEmpty()) {
+                    mergeLinkinTopology(rdm2rdmLinks);
+                }
+            } else {
+                // create tapi Node
+                Node roadmNode = createRoadmTapiNode("ROADMINFRA", onepMap);
+                mergeNodeinTopology(Map.of(roadmNode.key(), roadmNode));
+                mergeSipsinContext(this.sipMap);
+                // TODO add states corresponding to device config -> based on mapping.
+                //  This should be possible after Gilles work is merged
             }
+
             LOG.info("TAPI node for or node {} successfully merged", orNodeId);
         } else if (NodeTypes.Xpdr.getIntValue() ==  node.getNodeInfo().getNodeType().getIntValue()) {
             List<Mapping> networkMappings = node.nonnullMapping().values()
@@ -477,46 +516,79 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> transformSrgToOnep(String orNodeId,
-                                                                              Map<String, List<Mapping>> mapSrg) {
-        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
+                Map<String, List<Mapping>> mapSrg) {
+        LOG.debug("CREATENEP transformSrgToOnep, ListOfMapping {}, of NodeId {} ", mapSrg, orNodeId);
+        Map<String, TerminationPoint1> tpMap = new HashMap<>();
+        //List<TerminationPoint> tpList = new ArrayList<>();
         for (Map.Entry<String, List<Mapping>> entry : mapSrg.entrySet()) {
             // For each srg node. Loop through the LCPs and create neps and sips for PP
             for (Mapping m:entry.getValue()) {
-                if (!m.getLogicalConnectionPoint().contains("PP")) {
-                    LOG.info("LCP {} is not an external TP of SRG node", m.getLogicalConnectionPoint());
+                String tpId = m.getLogicalConnectionPoint();
+                String overlayNodeId = String.join("-", orNodeId, tpId.split("\\-")[0]);
+                if (!tpId.contains("PP")) {
+                    LOG.info("LCP {} is not an external TP of SRG node", tpId);
                     continue;
                 }
-                Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> srgNeps =
-                    createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), true,
-                            transformOperState(m.getPortOperState()), transformAdminState(m.getPortAdminState()),
-                            TapiStringConstants.PHTNC_MEDIA_OTS);
-                onepMap.putAll(srgNeps);
+                int counter = 50;
+                do {
+                    counter--;
+                    try {
+                        Thread.sleep(1);
+                    } catch (InterruptedException e) {
+                        // TODO Auto-generated catch block
+                        LOG.debug("Waiting until PP is backported in Topology, Exception raised", e);
+                    }
+                } while (getNetworkTerminationPoint1FromDatastore(overlayNodeId, tpId) == null && counter != 0);
+                if (getNetworkTerminationPoint1FromDatastore(overlayNodeId, tpId) != null) {
+                    //tpList.add(getNetworkTerminationPointFromDatastore(overlayNodeId, tpId));
+                    tpMap.put(tpId, getNetworkTerminationPoint1FromDatastore(overlayNodeId, tpId));
+                    LOG.debug("LCP {} is not empty for augmentation TP1", tpId);
+                } else {
+                    LOG.error("CREATENEP transformSrgToOnep, No Tp1 found in topology for LCP {}, of NodeId {} ",
+                        tpId, overlayNodeId);
+                }
+                if (getNetworkTerminationPoint11FromDatastore(overlayNodeId, tpId) != null) {
+                    LOG.info("LCP {} is not empty for augmentation TP11", tpId);
+                } else {
+                    LOG.error("CREATENEP transformSrgToOnep, No Tp11 found in topology for LCP {}, of NodeId {} ",
+                        tpId, overlayNodeId);
+                }
             }
         }
-        return onepMap;
+        LOG.debug("TransformSRGToONep for tps {}, of NodeId {} ",
+            tpMap.entrySet().stream().map(tp -> tp.getKey()).collect(Collectors.toList()).toString(), orNodeId);
+        return populateNepsForRdmNode(orNodeId, tpMap, false, TapiStringConstants.PHTNC_MEDIA_OTS);
     }
 
     private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> transformDegToOnep(String orNodeId,
-                                                                              Map<String, List<Mapping>> mapDeg) {
-        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
+                Map<String, List<Mapping>> mapDeg) {
+        LOG.debug("CREATENEP transformDegToOnep, ListOfMapping {}, of NodeId {} ",
+            mapDeg.toString(), orNodeId);
+        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> degOnepMap = new HashMap<>();
+        Map<String, TerminationPoint1> tpMap = new HashMap<>();
+        //List<TerminationPoint> tpList = new ArrayList<>();
         for (Map.Entry<String, List<Mapping>> entry : mapDeg.entrySet()) {
             // For each degree node. Loop through the LCPs and create neps and sips for TTP
             for (Mapping m:entry.getValue()) {
-                if (!m.getLogicalConnectionPoint().contains("TTP")) {
-                    LOG.info("LCP {} is not an external TP of DEGREE node", m.getLogicalConnectionPoint());
+                String tpId = m.getLogicalConnectionPoint();
+                String overlayNodeId = String.join("-", orNodeId, tpId.split("\\-")[0]);
+                if (!tpId.contains("TTP")) {
+                    LOG.info("LCP {} is not an external TP of DEGREE node", tpId);
                     continue;
                 }
-                Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> degNeps =
-                    createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), false,
-                            transformOperState(m.getPortOperState()), transformAdminState(m.getPortAdminState()),
-                            TapiStringConstants.PHTNC_MEDIA_OTS);
-                degNeps.putAll(createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), false,
-                        transformOperState(m.getPortOperState()), transformAdminState(m.getPortAdminState()),
-                        TapiStringConstants.PHTNC_MEDIA_OMS));
-                onepMap.putAll(degNeps);
+                if (getNetworkTerminationPoint1FromDatastore(overlayNodeId, tpId) != null) {
+                    //tpList.add(getNetworkTerminationPointFromDatastore(overlayNodeId, tpId));
+                    tpMap.put(tpId, getNetworkTerminationPoint1FromDatastore(overlayNodeId, tpId));
+                    LOG.info("LCP {} is not empty for augmentation TP1", tpId);
+                } else {
+                    LOG.error("CREATENEP transformDegToOnep, No Tp found in topology for LCP {}, of NodeId {} ",
+                        tpId, overlayNodeId);
+                }
             }
         }
-        return onepMap;
+        degOnepMap.putAll(populateNepsForRdmNode(orNodeId, tpMap, false, TapiStringConstants.PHTNC_MEDIA_OTS));
+        degOnepMap.putAll(populateNepsForRdmNode(orNodeId, tpMap, false, TapiStringConstants.PHTNC_MEDIA_OMS));
+        return degOnepMap;
     }
 
     private List<String> getRoadmNodelist(List<Mapping> mappingList) {
@@ -563,10 +635,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             return;
         }
         if (nodeId.contains("ROADM")) {
-            // Node is in photonic media layer and UUID can be built from nodeId + PHTN_MEDIA
-            Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId,
-                TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8)).toString());
-            deleteNodeFromTopo(nodeUuid);
+            if (topologicalMode.equals("Full")) {
+             // Node is in photonic media layer and UUID can be built from nodeId + PHTN_MEDIA
+                Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId,
+                    TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8)).toString());
+                deleteNodeFromTopo(nodeUuid);
+            } else {
+                LOG.info("Abstracted Topo Mode in TAPI topology Datastore for OR topology representation. Node"
+                    + " {} is not represented in the abstraction and will not be deleted", nodeId);
+            }
         }
         if (nodeId.contains("XPDR") || nodeId.contains("SPDR") || nodeId.contains("MXPDR")) {
             // Node is either XPDR, MXPDR or SPDR. Retrieve nodes from topology and check names
@@ -639,6 +716,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = createNodeRuleGroupForDsrNode(
                     nodeId, oorOduSwitchingPool, ruleList, onepl);
         onepl.putAll(createXpdrPhtnMdNeps(nodeId, xpdrNetMaps));
+        LOG.debug("TapiNetworkModelServiceImpl line 721, total NEP map = {}", onepl.toString());
 
         // Empty random creation of mandatory fields for avoiding errors....
         CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
@@ -660,7 +738,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
             .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
             .build();
-        return new NodeBuilder()
+        Node builtNode = new NodeBuilder()
             .setUuid(nodeUuid)
             .setName(nameMap)
             .setLayerProtocolName(layerProtocols)
@@ -679,10 +757,27 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setServerIntegrityProcessCharacteristic("server integrity process")
             .setRiskParameterPac(riskParamPac)
             .build();
+        List<PhotonicMediaNodeEdgePointSpec> pmnepspecList = new ArrayList<>();
+        for (Map.Entry<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> entry :
+                builtNode.getOwnedNodeEdgePoint().entrySet()) {
+            if (!entry.getValue().getSupportedCepLayerProtocolQualifierInstances().stream()
+                        .filter(sclpqi -> sclpqi.getLayerProtocolQualifier().equals(PHOTONICLAYERQUALIFIEROTS.VALUE))
+                        .collect(Collectors.toList()).isEmpty()
+                    && entry.getValue().augmentationOrElseThrow(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang
+                        .tapi.photonic.media.rev221121.OwnedNodeEdgePoint1.class) != null
+                    && entry.getValue().augmentationOrElseThrow(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi
+                        .photonic.media.rev221121.OwnedNodeEdgePoint1.class).getPhotonicMediaNodeEdgePointSpec()
+                        != null) {
+                pmnepspecList.add(entry.getValue().augmentationOrElseThrow(org.opendaylight.yang.gen.v1.urn.onf.otcc
+                    .yang.tapi.photonic.media.rev221121.OwnedNodeEdgePoint1.class).getPhotonicMediaNodeEdgePointSpec());
+            }
+        }
+        LOG.debug("TapiNetworkModelServiceImpl line 775, List of non empty PMNEPSEC is = {}", pmnepspecList);
+        return builtNode;
     }
 
     private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrPhtnMdNeps(String nodeId,
-                                                                                List<Mapping> xpdrNetMaps) {
+            List<Mapping> xpdrNetMaps) {
         Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
 
         // eNep creation on otsi node
@@ -697,11 +792,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .build();
 
             List<SupportedIfCapability> newSupIfCapList =
-                    new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
+                new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
+            List<String> opModeList = new ArrayList<>();
+            if (xpdrNetMaps.get(i).getSupportedOperationalMode() != null) {
+                opModeList.addAll(xpdrNetMaps.get(i).getSupportedOperationalMode());
+            }
 
-            OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
+            OwnedNodeEdgePoint onep = createNep(nodeId, nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                true, String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS), newSupIfCapList,
+                true, String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS), newSupIfCapList, opModeList,
                 transformOperState(xpdrNetMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -719,10 +818,14 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
             List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
+            List<String> opModeList = new ArrayList<>();
+            if (xpdrNetMaps.get(i).getSupportedOperationalMode() != null) {
+                opModeList.addAll(xpdrNetMaps.get(i).getSupportedOperationalMode());
+            }
 
-            OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
+            OwnedNodeEdgePoint onep = createNep(nodeId, nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                false, String.join("+", nodeId, TapiStringConstants.OTSI_MC), newSupIfCapList,
+                false, String.join("+", nodeId, TapiStringConstants.OTSI_MC), newSupIfCapList, opModeList,
                 transformOperState(xpdrNetMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -753,9 +856,9 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
 
-            OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
+            OwnedNodeEdgePoint onep = createNep(nodeId, nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
-                String.join("+", nodeId, TapiStringConstants.DSR), newSupIfCapList,
+                String.join("+", nodeId, TapiStringConstants.DSR), newSupIfCapList, null,
                 transformOperState(xpdrClMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -775,11 +878,10 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
             List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
-
-            OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
+            OwnedNodeEdgePoint onep = createNep(nodeId, nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName),
                 LayerProtocolName.ODU, LayerProtocolName.DSR, true,
-                String.join("+", nodeId, TapiStringConstants.I_ODU), newSupIfCapList,
+                String.join("+", nodeId, TapiStringConstants.I_ODU), newSupIfCapList, null,
                 transformOperState(xpdrNetMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -800,10 +902,10 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
 
-            OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
+            OwnedNodeEdgePoint onep = createNep(nodeId, nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName),
                 LayerProtocolName.ODU, LayerProtocolName.DSR, true,
-                String.join("+", nodeId, TapiStringConstants.E_ODU), newSupIfCapList,
+                String.join("+", nodeId, TapiStringConstants.E_ODU), newSupIfCapList, null,
                 transformOperState(xpdrClMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -822,112 +924,81 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         return adminState.equals(AdminStates.InService) ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
     }
 
-    private OwnedNodeEdgePoint createNep(Uuid nepUuid, String tpid, Map<NameKey, Name> nepNames,
-                                         LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
-                                         String keyword,
-                                         List<SupportedIfCapability> supportedInterfaceCapability,
-                                         OperationalState operState, AdministrativeState adminState) {
+    private OwnedNodeEdgePoint createNep(String nodeId, Uuid nepUuid, String tpid, Map<NameKey, Name> nepNames,
+            LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword,
+            List<SupportedIfCapability> sicList, List<String> opModeList,
+            OperationalState operState, AdministrativeState adminState) {
+        List<SupportedInterfaceCapability> sicListTemp = new ArrayList<>();
+        List<OperationalModeKey> keyedOpModeList = new ArrayList<>();
+        for (SupportedIfCapability supInterCapa : sicList) {
+            SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
+                    .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
+                    .setIfCapType(supInterCapa)
+                    .build();
+            sicListTemp.add(supIfCapa);
+        }
+        Collection<SupportedInterfaceCapability> sicColl = sicListTemp;
         OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
                 .setUuid(nepUuid)
                 .setLayerProtocolName(nepProtocol)
                 .setName(nepNames);
         if (withSip) {
-            onepBldr.setMappedServiceInterfacePoint(createMSIP(1, nepProtocol, tpid, keyword,
-                    supportedInterfaceCapability, operState, adminState));
+            onepBldr.setMappedServiceInterfacePoint(this.tapiFactory.createMSIP(1, nepProtocol, tpid, keyword,
+                    sicColl, operState, adminState));
+            this.sipMap.putAll(tapiFactory.getTapiSips());
         }
         LOG.debug("Node layer {}", nodeProtocol.getName());
-        onepBldr.setSupportedCepLayerProtocolQualifierInstances(createSupportedLayerProtocolQualifier(
-                supportedInterfaceCapability, nepProtocol));
+        onepBldr.setSupportedCepLayerProtocolQualifierInstances(
+                this.tapiFactory.createSupportedCepLayerProtocolQualifier(sicColl, nepProtocol));
         onepBldr.setDirection(Direction.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
                 .setAdministrativeState(adminState).setOperationalState(operState)
                 .setLifecycleState(LifecycleState.INSTALLED);
+        if (keyword.contains(TapiStringConstants.OTSI_MC) || keyword.contains(TapiStringConstants.PHTNC_MEDIA_OTS)) {
+            if (opModeList == null || opModeList.isEmpty()) {
+                for (SupportedInterfaceCapability sic : sicColl) {
+                    String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
+                    if (("IfOCHOTUCnODUCn").equals(ifCapType) || ("IfOCHOTUCnODUCnUniregen").equals(ifCapType)
+                            || ("IfOCHOTUCnODUCnRegen").equals(ifCapType)) {
+                        keyedOpModeList.add(new OperationalModeKey("400G"));
+                        LOG.warn(TopologyUtils.NOOPMODEDECLARED + "400G rate available", tpid);
+                        break;
+                    }
+                }
+                keyedOpModeList.add(new OperationalModeKey("100G"));
+                LOG.warn(TopologyUtils.NOOPMODEDECLARED + "100G rate available", tpid);
+            } else {
+                for (String opMode : opModeList) {
+                    keyedOpModeList.add(new OperationalModeKey(opMode));
+                }
+            }
+            Map<Double, Double> freqWidthMap = new HashMap<>();
+            if (getNetworkTerminationPointFromDatastore(nodeId, tpid) != null) {
+                freqWidthMap = tapiFactory.getXpdrUsedWavelength(getNetworkTerminationPointFromDatastore(nodeId, tpid));
+            } else {
+                LOG.error("CREATENEP, No Tp found in topology for LCP {}, of NodeId {} ", tpid, nodeId);
+            }
+            onepBldr = tapiFactory.addPayloadStructureAndPhotSpecToOnep(nodeId, freqWidthMap, keyedOpModeList,
+                sicColl, onepBldr, keyword);
+            LOG.debug("TapiNetworkServiceImpl line982, onep = {}", onepBldr.build());
+        }
         return onepBldr.build();
     }
 
-    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createRoadmNeps(String orNodeId, String tpId,
-            boolean withSip, OperationalState operState, AdministrativeState adminState, String nepPhotonicSublayer) {
-        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
-        // PHOTONIC MEDIA nep
-        Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId,
-            nepPhotonicSublayer, tpId)).getBytes(StandardCharsets.UTF_8)).toString());
-        Name nepName = new NameBuilder()
-                .setValueName(TapiStringConstants.PHTNC_MEDIA + "NodeEdgePoint")
-                .setValue(String.join("+", orNodeId, nepPhotonicSublayer, tpId))
+    private Node createRoadmTapiNode(String orNodeId, Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap) {
+        // UUID and Node Names
+        Uuid nodeUuid;
+        Name nodeNames;
+        if (orNodeId.equals("ROADMINFRA")) {
+            nodeUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.RDM_INFRA
+                .getBytes(Charset.forName("UTF-8"))).toString());
+            nodeNames =  new NameBuilder().setValueName("roadm node name").setValue(TapiStringConstants.RDM_INFRA)
                 .build();
-        List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
-        sclpqiList.add(
-            new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                .setLayerProtocolQualifier(
-                    TapiStringConstants.PHTNC_MEDIA_OMS.equals(nepPhotonicSublayer)
-                        ? PHOTONICLAYERQUALIFIEROMS.VALUE
-                        : PHOTONICLAYERQUALIFIEROTS.VALUE)
-                .setNumberOfCepInstances(Uint64.valueOf(1))
-                .build());
-        OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
-            .setUuid(nepUuid)
-            .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
-            .setName(Map.of(nepName.key(), nepName))
-            .setSupportedCepLayerProtocolQualifierInstances(sclpqiList)
-            .setDirection(Direction.BIDIRECTIONAL)
-            .setLinkPortRole(PortRole.SYMMETRIC)
-            .setAdministrativeState(adminState).setOperationalState(operState)
-            .setLifecycleState(LifecycleState.INSTALLED)
-            .build();
-        onepMap.put(onep.key(), onep);
-        return onepMap;
-    }
-
-    private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint>
-            createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
-                   List<SupportedIfCapability> supportedInterfaceCapability,
-                   OperationalState operState, AdministrativeState adminState) {
-        Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
-        for (int i = 0; i < nb; i++) {
-            Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeid,
-                    tpid)).getBytes(StandardCharsets.UTF_8)).toString());
-            MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
-                    .setServiceInterfacePointUuid(sipUuid).build();
-            ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tpid, nodeid, supportedInterfaceCapability,
-                operState, adminState);
-            this.sipMap.put(sip.key(), sip);
-            // this.tapiSips.put(sip.key(), sip);
-            msipl.put(msip.key(), msip);
-            LOG.info("SIP created {}", sip.getUuid());
-            LOG.info("This SIP corresponds to SIP+nodeId {} + TpId {}", nodeid, tpid);
+        } else {
+            nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId,
+                TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8)).toString());
+            nodeNames =  new NameBuilder().setValueName("roadm node name")
+                .setValue(String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA)).build();
         }
-        return msipl;
-    }
-
-    private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpid, String nodeid,
-                                            List<SupportedIfCapability> supportedInterfaceCapability,
-                                            OperationalState operState, AdministrativeState adminState) {
-        // TODO: what value should be set in total capacity and available capacity
-        LOG.info("SIP name = {}", String.join("+", nodeid, tpid));
-        Name sipName = new NameBuilder()
-                .setValueName("SIP name")
-                .setValue(String.join("+", nodeid, tpid))
-                .build();
-        return new ServiceInterfacePointBuilder()
-                .setUuid(sipUuid)
-                .setName(Map.of(sipName.key(), sipName))
-                .setLayerProtocolName(layerProtocol)
-                .setAdministrativeState(adminState)
-                .setOperationalState(operState)
-                .setLifecycleState(LifecycleState.INSTALLED)
-                .setAvailableCapacity(new AvailableCapacityBuilder().build())
-                .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
-                .setSupportedCepLayerProtocolQualifierInstances(createSipSupportedLayerProtocolQualifier(
-                        supportedInterfaceCapability, layerProtocol))
-                .build();
-    }
-
-    private Node createRoadmTapiNode(String orNodeId, Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
-        // UUID
-        Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId,
-            TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8)).toString());
-        // Names
-        Name nodeNames =  new NameBuilder().setValueName("roadm node name")
-            .setValue(String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA)).build();
         Name nameNodeType = new NameBuilder().setValueName("Node Type")
             .setValue(OpenroadmNodeType.ROADM.getName()).build();
         // Protocol Layer
@@ -952,6 +1023,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
             .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
             .build();
+        Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap
+            = tapiFactory.createAllNodeRuleGroupForRdmNode(topologicalMode, nodeUuid, orNodeId, onepMap.values());
+        Map<InterRuleGroupKey, InterRuleGroup> interRuleGroupMap
+            = tapiFactory.createInterRuleGroupForRdmNode(topologicalMode, nodeUuid, orNodeId,
+                nodeRuleGroupMap.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toList()));
         return new NodeBuilder()
             .setUuid(nodeUuid)
             .setName(Map.of(nodeNames.key(), nodeNames, nameNodeType.key(), nameNodeType))
@@ -959,8 +1035,9 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setAdministrativeState(AdministrativeState.UNLOCKED)
             .setOperationalState(OperationalState.ENABLED)
             .setLifecycleState(LifecycleState.INSTALLED)
-            .setOwnedNodeEdgePoint(oneplist)
-            .setNodeRuleGroup(createNodeRuleGroupForRdmNode(orNodeId, nodeUuid, oneplist.values()))
+            .setOwnedNodeEdgePoint(onepMap)
+            .setNodeRuleGroup(nodeRuleGroupMap)
+            .setInterRuleGroup(interRuleGroupMap)
             .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
             .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
             .setErrorCharacteristic("error")
@@ -973,38 +1050,6 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .build();
     }
 
-    private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String orNodeId, Uuid nodeUuid,
-                                                                               Collection<OwnedNodeEdgePoint> onepl) {
-        Map<NodeEdgePointKey, NodeEdgePoint>
-                nepMap = new HashMap<>();
-        for (OwnedNodeEdgePoint onep : onepl) {
-            NodeEdgePoint nep = new NodeEdgePointBuilder()
-                .setTopologyUuid(this.tapiTopoUuid)
-                .setNodeUuid(nodeUuid)
-                .setNodeEdgePointUuid(onep.key().getUuid())
-                .build();
-            nepMap.put(nep.key(), nep);
-        }
-        Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
-        Map<RuleKey, Rule> ruleList = new HashMap<>();
-        Set<RuleType> ruleTypes = new HashSet<>();
-        ruleTypes.add(RuleType.FORWARDING);
-        Rule rule = new RuleBuilder()
-                .setLocalId("forward")
-                .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
-                .setRuleType(ruleTypes)
-                .build();
-        ruleList.put(rule.key(), rule);
-        NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
-                .setUuid(new Uuid(UUID.nameUUIDFromBytes((orNodeId + " node rule group")
-                        .getBytes(StandardCharsets.UTF_8)).toString()))
-                .setRule(ruleList)
-                .setNodeEdgePoint(nepMap)
-                .build();
-        nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
-        return nodeRuleGroupMap;
-    }
-
     private OduSwitchingPools createTpdrSwitchPool(List<Mapping> xpdrNetMaps) {
         Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
         int count = 1;
@@ -1079,16 +1124,14 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForDsrNode(String nodeId,
-                                                                               OduSwitchingPools oorOduSwitchingPool,
-                                                                               Map<RuleKey, Rule> ruleList,
-                                                                               Map<OwnedNodeEdgePointKey,
-                                                                                       OwnedNodeEdgePoint> onepl) {
+            OduSwitchingPools oorOduSwitchingPool, Map<RuleKey, Rule> ruleList,
+            Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl) {
         // create NodeRuleGroup
         if (oorOduSwitchingPool == null) {
             LOG.info("No switching pool created for node = {}", nodeId);
             return new HashMap<>();
         }
-        LOG.info("ONEPL = {}", onepl.values());
+        LOG.debug("ONEPL = {}", onepl.values());
         Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
         int count = 1;
         for (NonBlockingList nbl : oorOduSwitchingPool.nonnullNonBlockingList().values()) {
@@ -1154,320 +1197,6 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         return nodeRuleGroupMap;
     }
 
-    private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-            .service._interface.point.SupportedCepLayerProtocolQualifierInstances>
-            createSipSupportedLayerProtocolQualifier(List<SupportedIfCapability> sicList, LayerProtocolName lpn) {
-        List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                .service._interface.point.SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
-        if (sicList == null) {
-            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                    .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROMS.VALUE)
-                .setNumberOfCepInstances(Uint64.valueOf(1))
-                .build());
-            return sclpqiList;
-        }
-        Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
-        LOG.info("SIC list = {}", sicList);
-        for (SupportedIfCapability supInterCapa : sicList) {
-            SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
-                    .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
-                    .setIfCapType(supInterCapa)
-                    .build();
-            supIfMap.put(supIfCapa.key(), supIfCapa);
-        }
-        for (SupportedInterfaceCapability sic : supIfMap.values()) {
-            String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
-            switch (lpn.getName()) {
-                case "DSR":
-                    switch (ifCapType) {
-                        // TODO: it may be needed to add more cases clauses if the interface capabilities of a
-                        //  port are extended in the config file
-                        case "If1GEODU0":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                    .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2e":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GE":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If100GEODU4":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If100GE":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "IfOCHOTU4ODU4":
-                        case "IfOCH":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        default:
-                            LOG.error("IfCapability type not managed");
-                            break;
-                    }
-                    break;
-                case "ODU":
-                    switch (ifCapType) {
-                        // TODO: it may be needed to add more cases clauses if the interface capabilities of a
-                        //  port are extended in the config file
-                        case "If1GEODU0":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2e":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2":
-                        case "If10GE":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If100GEODU4":
-                        case "If100GE":
-                        case "IfOCHOTU4ODU4":
-                        case "IfOCH":
-                            sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                                .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        default:
-                            LOG.error("IfCapability type not managed");
-                            break;
-                    }
-                    break;
-                case "PHOTONIC_MEDIA":
-                    if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
-                        sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                            .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                            .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
-                            .setNumberOfCepInstances(Uint64.valueOf(0))
-                            .build());
-                        sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
-                            .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
-                            .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
-                            .setNumberOfCepInstances(Uint64.valueOf(0))
-                            .build());
-                    }
-                    break;
-                default:
-                    LOG.error("Layer Protocol Name is unknown {}", lpn.getName());
-                    break;
-            }
-        }
-        return sclpqiList;
-    }
-
-    private List<SupportedCepLayerProtocolQualifierInstances> createSupportedLayerProtocolQualifier(
-            List<SupportedIfCapability> sicList, LayerProtocolName lpn) {
-        List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
-        if (sicList == null) {
-            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROMS.VALUE)
-                .setNumberOfCepInstances(Uint64.valueOf(1))
-                .build());
-            return sclpqiList;
-        }
-        Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
-        LOG.info("SIC list = {}", sicList);
-        for (SupportedIfCapability supInterCapa : sicList) {
-            SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
-                    .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
-                    .setIfCapType(supInterCapa)
-                    .build();
-            supIfMap.put(supIfCapa.key(), supIfCapa);
-        }
-        for (SupportedInterfaceCapability sic : supIfMap.values()) {
-            String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
-            switch (lpn.getName()) {
-                case "DSR":
-                    switch (ifCapType) {
-                        // TODO: it may be needed to add more cases clauses if the interface capabilities of a
-                        //  port are extended in the config file
-                        case "If1GEODU0":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2e":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GE":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If100GEODU4":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If100GE":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "IfOCHOTU4ODU4":
-                        case "IfOCH":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        default:
-                            LOG.error("IfCapability type not managed");
-                            break;
-                    }
-                    break;
-                case "ODU":
-                    switch (ifCapType) {
-                        // TODO: it may be needed to add more cases clauses if the interface capabilities of a
-                        //  port are extended in the config file
-                        case "If1GEODU0":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2e":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If10GEODU2":
-                        case "If10GE":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        case "If100GEODU4":
-                        case "If100GE":
-                        case "IfOCHOTU4ODU4":
-                        case "IfOCH":
-                            sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                                .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
-                                .setNumberOfCepInstances(Uint64.valueOf(0))
-                                .build());
-                            break;
-                        default:
-                            LOG.error("IfCapability type not managed");
-                            break;
-                    }
-                    break;
-                case "PHOTONIC_MEDIA":
-                    if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
-                        sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                            .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
-                            .setNumberOfCepInstances(Uint64.valueOf(0))
-                            .build());
-                        sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
-                            .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
-                            .setNumberOfCepInstances(Uint64.valueOf(0))
-                            .build());
-                    }
-                    break;
-                default:
-                    LOG.error("Layer Protocol Name is unknown {}", lpn.getName());
-                    break;
-            }
-        }
-        return sclpqiList;
-    }
-
     private String getNodeType(XpdrNodeTypes xponderType) {
         switch (xponderType.getIntValue()) {
             case 1:
@@ -1668,4 +1397,224 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             LOG.error("Error committing into datastore", e);
         }
     }
+
+    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(String nodeId,
+            Map<String, TerminationPoint1> tpMap, boolean withSip, String nepPhotonicSublayer) {
+        // create neps for MC and and Photonic Media OTS/OMS
+        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
+        for (Map.Entry<String, TerminationPoint1> entry : tpMap.entrySet()) {
+            // Admin and oper state common for all tps
+            OpenroadmTpType tpType = entry.getValue().getTpType();
+            // PHOTONIC MEDIA nep
+            LOG.debug("PHOTO NEP = {}", String.join("+", nodeId, nepPhotonicSublayer,
+                entry.getKey()));
+            SupportedCepLayerProtocolQualifierInstancesBuilder sclpqiBd =
+                new SupportedCepLayerProtocolQualifierInstancesBuilder()
+                    .setNumberOfCepInstances(Uint64.valueOf(1));
+            switch (nepPhotonicSublayer) {
+                case TapiStringConstants.PHTNC_MEDIA_OMS:
+                    sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROMS.VALUE);
+                    break;
+                case TapiStringConstants.PHTNC_MEDIA_OTS:
+                    sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE);
+                    break;
+                case TapiStringConstants.MC:
+                    sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIERMC.VALUE);
+                    break;
+                case TapiStringConstants.OTSI_MC:
+                    sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE);
+                    break;
+                default:
+                    break;
+            }
+
+            List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>(List.of(sclpqiBd.build()));
+            OwnedNodeEdgePointBuilder onepBd = new OwnedNodeEdgePointBuilder();
+            if (!nepPhotonicSublayer.equals(TapiStringConstants.MC)
+                    && !nepPhotonicSublayer.equals(TapiStringConstants.OTSI_MC)) {
+                Map<Double,Double> usedFreqMap = new HashMap<>();
+                Map<Double,Double> availableFreqMap = new HashMap<>();
+                switch (tpType) {
+                    // Whatever is the TP and its type we consider that it is handled in a bidirectional way :
+                    // same wavelength(s) used in both direction.
+                    case SRGRXPP:
+                    case SRGTXPP:
+                    case SRGTXRXPP:
+                        usedFreqMap = tapiFactory.getPP11UsedWavelength(
+                            getNetworkTerminationPoint11FromDatastore(nodeId, entry.getKey()));
+                        if (usedFreqMap == null || usedFreqMap.isEmpty()) {
+                            availableFreqMap.put(GridConstant.START_EDGE_FREQUENCY * 1E09,
+                                GridConstant.START_EDGE_FREQUENCY * 1E09
+                                + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06);
+                        } else {
+                            LOG.debug("EnteringLOOPcreateOTSiMC & MC with usedFreqMap non empty {} for Node {}, tp {}",
+                                usedFreqMap.toString(), nodeId, tpMap.toString());
+                            onepMap.putAll(populateNepsForRdmNode(nodeId,
+                                new HashMap<>(Map.of(entry.getKey(), entry.getValue())),
+                                true, TapiStringConstants.MC));
+                            onepMap.putAll(populateNepsForRdmNode(nodeId,
+                                new HashMap<>(Map.of(entry.getKey(), entry.getValue())),
+                                true, TapiStringConstants.OTSI_MC));
+                        }
+                        break;
+                    case DEGREERXTTP:
+                    case DEGREETXTTP:
+                    case DEGREETXRXTTP:
+                        usedFreqMap = tapiFactory.getTTP11UsedFreqMap(
+                            getNetworkTerminationPoint11FromDatastore(nodeId, entry.getKey()));
+                        availableFreqMap = tapiFactory.getTTP11AvailableFreqMap(
+                            getNetworkTerminationPoint11FromDatastore(nodeId, entry.getKey()));
+                        break;
+                    default:
+                        break;
+                }
+                LOG.debug("calling add Photonic NEP spec for Roadm");
+                onepBd = tapiFactory.addPhotSpecToRoadmOnep(nodeId, usedFreqMap, availableFreqMap, onepBd,
+                    nepPhotonicSublayer);
+            }
+            AdminStates admin = entry.getValue().getAdministrativeState();
+            State oper = entry.getValue().getOperationalState();
+            Name nepName = new NameBuilder()
+                .setValueName(nepPhotonicSublayer + "NodeEdgePoint")
+                .setValue(String.join("+", nodeId, nepPhotonicSublayer,
+                    entry.getKey()))
+                .build();
+            OwnedNodeEdgePoint onep = onepBd
+                .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId,
+                    nepPhotonicSublayer, entry.getKey()))
+                    .getBytes(Charset.forName("UTF-8"))).toString()))
+                .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+                .setName(Map.of(nepName.key(), nepName))
+                .setSupportedCepLayerProtocolQualifierInstances(sclpqiList)
+                .setDirection(Direction.BIDIRECTIONAL)
+                .setLinkPortRole(PortRole.SYMMETRIC)
+                .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
+                .setOperationalState(this.tapiLink.setTapiOperationalState(oper.getName()))
+                .setLifecycleState(LifecycleState.INSTALLED)
+                .build();
+            LOG.debug("ROADMNEPPopulation TapiNetworkModelServiceImpl populate NEP {} for Node {}",
+                onep.getName().entrySet(), nodeId);
+            onepMap.put(onep.key(), onep);
+        }
+        LOG.debug("ROADMNEPPopulation FINISH for Node {}", nodeId);
+        return onepMap;
+    }
+
+    /**
+     * Get a network termination point for nodeId and tpId.
+     * @param nodeId String
+     * @param tpId String
+     * @return network termination point, null otherwise
+     */
+    private TerminationPoint getNetworkTerminationPointFromDatastore(String nodeId, String tpId) {
+        InstanceIdentifier<TerminationPoint> tpIID = InstanceIdentifier.builder(Networks.class)
+            .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)))
+            .child(
+                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226
+                    .networks.network.Node.class,
+                new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226
+                    .networks.network.NodeKey(new NodeId(nodeId)))
+            .augmentation(Node1.class)
+            .child(
+                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+                    .networks.network.node.TerminationPoint.class,
+                new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+                    .networks.network.node.TerminationPointKey(new TpId(tpId)))
+            .build();
+        try {
+            Optional<TerminationPoint> tpOptional =
+                networkTransactionService.read(LogicalDatastoreType.CONFIGURATION, tpIID).get();
+            if (tpOptional.isEmpty()) {
+                LOG.error("readMdSal: Error reading tp {} , empty list",tpIID);
+                return null;
+            }
+            LOG.debug("SUCCES getting LCP TP for NodeId {} TpId {} while creating NEP in TapiNetworkModelServiceImpl",
+                nodeId, tpId);
+            LOG.debug(" The Tp in Datastore is as follows {}", tpOptional);
+            return tpOptional.orElseThrow();
+        } catch (ExecutionException | InterruptedException e) {
+            LOG.warn("Exception while getting termination {} for node id {} point from {} topology",
+                    tpId, nodeId, NetworkUtils.OVERLAY_NETWORK_ID, e);
+            return null;
+        }
+    }
+
+    /**
+     * Get a network termination point with Common TerminationPoint1 augmentation for nodeId and tpId.
+     * @param nodeId String
+     * @param tpId String
+     * @return network termination point, null otherwise
+     */
+    private TerminationPoint1 getNetworkTerminationPoint1FromDatastore(String nodeId, String tpId) {
+        InstanceIdentifier<TerminationPoint1> tpIID = InstanceIdentifier.builder(Networks.class)
+            .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)))
+            .child(
+                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226
+                    .networks.network.Node.class,
+                new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226
+                    .networks.network.NodeKey(new NodeId(nodeId)))
+            .augmentation(Node1.class)
+            .child(
+                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+                    .networks.network.node.TerminationPoint.class,
+                new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+                    .networks.network.node.TerminationPointKey(new TpId(tpId)))
+            .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526
+                .TerminationPoint1.class)
+            .build();
+        try {
+            Optional<TerminationPoint1> tpOptional =
+                networkTransactionService.read(LogicalDatastoreType.CONFIGURATION, tpIID).get();
+            if (tpOptional.isEmpty()) {
+                LOG.error("readMdSal: Error reading tp {} , empty list",tpIID);
+                return null;
+            }
+            LOG.debug("SUCCES getting LCP TP1 for NodeId {} TpId {} while creating NEP in TapiNetworkModelServiceImpl",
+                nodeId, tpId);
+            LOG.debug(" The Tp in Datastore is as follows {}", tpOptional);
+            return tpOptional.orElseThrow();
+        } catch (ExecutionException | InterruptedException e) {
+            LOG.warn("Exception while getting termination {} for node id {} point from {} topology",
+                    tpId, nodeId, NetworkUtils.OVERLAY_NETWORK_ID, e);
+            return null;
+        }
+    }
+
+    private org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1
+        getNetworkTerminationPoint11FromDatastore(String nodeId, String tpId) {
+        InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1>
+                tpIID = InstanceIdentifier.builder(Networks.class)
+            .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)))
+            .child(
+                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226
+                    .networks.network.Node.class,
+                new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226
+                    .networks.network.NodeKey(new NodeId(nodeId)))
+            .augmentation(Node1.class)
+            .child(
+                org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+                    .networks.network.node.TerminationPoint.class,
+                new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
+                    .networks.network.node.TerminationPointKey(new TpId(tpId)))
+            .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1
+                .class)
+            .build();
+        try {
+            Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1>
+                tpOptional = networkTransactionService.read(LogicalDatastoreType.CONFIGURATION, tpIID).get();
+            if (tpOptional.isEmpty()) {
+                LOG.error("readMdSal: Error reading tp {} , empty list",tpIID);
+                return null;
+            }
+            LOG.debug("SUCCESS getting LCP TP11 for NodeId {} TpId {} while creating NEP in TapiNetworkModelServiceImpl"
+                + " The Tp in Datastore is as follows {}",
+                nodeId, tpId, tpOptional.toString());
+            return tpOptional.orElseThrow();
+        } catch (ExecutionException | InterruptedException e) {
+            LOG.warn("Exception while getting termination {} for node id {} point from {} topology",
+                    tpId, nodeId, NetworkUtils.OVERLAY_NETWORK_ID, e);
+            return null;
+        }
+    }
+
 }