Fix CI Cent OS 8 configuration issue (workaround)
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / topology / TapiNetworkModelServiceImpl.java
index 694200c759386033d59033b095c5fb0d80b117da..d095d92e514e44c5bbdb9d8dcbe9860e7dacf312 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,15 +25,18 @@ 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.impl.TapiProvider;
 import org.opendaylight.transportpce.tapi.utils.TapiLink;
 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;
 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.rev230526.xpdr.odu.switching.pools.OduSwitchingPools;
@@ -46,8 +50,15 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev230526.x
 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;
@@ -84,8 +95,11 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev22112
 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;
@@ -125,7 +139,6 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.tr
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristic;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.transfer.timing.pac.LatencyCharacteristicBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
@@ -141,11 +154,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private static final Logger LOG = LoggerFactory.getLogger(TapiNetworkModelServiceImpl.class);
 
-    private final Uuid tapiTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER
-            .getBytes(StandardCharsets.UTF_8)).toString());
+    private final Uuid tapiTopoUuid = TapiProvider.TAPI_TOPO_UUID;
+    private static final String TOPOLOGICAL_MODE = TapiProvider.TOPOLOGICAL_MODE;
     private final NetworkTransactionService networkTransactionService;
     private final R2RTapiLinkDiscovery linkDiscovery;
-//    private final TapiLink tapiLink;
+    private final TapiLink tapiLink;
     private final ConvertORToTapiTopology tapiFactory;
     private final NotificationPublishService notificationPublishService;
     private Map<ServiceInterfacePointKey, ServiceInterfacePoint> sipMap = new HashMap<>();
@@ -159,6 +172,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         this.linkDiscovery = new R2RTapiLinkDiscovery(networkTransactionService, deviceTransactionManager, tapiLink);
         this.notificationPublishService = notificationPublishService;
         this.tapiFactory = new ConvertORToTapiTopology(tapiTopoUuid);
+        this.tapiLink = tapiLink;
+
     }
 
     @Override
@@ -171,120 +186,184 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         }
         this.sipMap.clear();
         LOG.info("Mapping of node {}: {}", orNodeId, node.getMapping().values());
-
         // check type of device, check version and create node mapping
-        if (NodeTypes.Rdm.getIntValue() == node.getNodeInfo().getNodeType().getIntValue()) {
-            // ROADM device
-            // transform flat mapping list to per degree and per srg mapping lists
-            Map<String, List<Mapping>> mapDeg = new HashMap<>();
-            Map<String, List<Mapping>> mapSrg = new HashMap<>();
-            List<Mapping> mappingList = new ArrayList<>(node.nonnullMapping().values());
-            mappingList.sort(Comparator.comparing(Mapping::getLogicalConnectionPoint));
-
-            List<String> nodeShardList = getRoadmNodelist(mappingList);
-
-            // populate degree and srg LCP map
-            for (String str : nodeShardList) {
-                List<Mapping> interList = mappingList.stream().filter(x -> x.getLogicalConnectionPoint().contains(str))
+        switch (node.getNodeInfo().getNodeType()) {
+            case Rdm:
+                // ROADM device
+                // transform flat mapping list to per degree and per srg mapping lists
+                Map<String, List<Mapping>> mapDeg = new HashMap<>();
+                Map<String, List<Mapping>> mapSrg = new HashMap<>();
+                List<Mapping> mappingList = new ArrayList<>(node.nonnullMapping().values());
+                mappingList.sort(Comparator.comparing(Mapping::getLogicalConnectionPoint));
+                // populate degree and srg LCP map
+                for (String str : getRoadmNodelist(mappingList)) {
+                    List<Mapping> interList = mappingList.stream()
+                        .filter(x -> x.getLogicalConnectionPoint().contains(str))
                         .collect(Collectors.toList());
-                if (str.contains("DEG")) {
-                    mapDeg.put(str, interList);
-                } else if (str.contains("SRG")) {
-                    mapSrg.put(str, interList);
-                } else {
-                    LOG.error("unknown element");
+                    if (str.contains("DEG")) {
+                        mapDeg.put(str, interList);
+                    } else if (str.contains("SRG")) {
+                        mapSrg.put(str, interList);
+                    } else {
+                        LOG.error("unknown element");
+                    }
                 }
-            }
-            // 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
+                // Transform LCPs into ONEP
+                Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap =
+                    new HashMap<>(transformSrgToOnep(orNodeId, mapSrg));
+                LOG.debug("CreateTapiNode NetworkModelServiceImpl, TopologicalMode = {}", TOPOLOGICAL_MODE);
+                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 (!TOPOLOGICAL_MODE.equals("Full")) {
+                    // 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);
+                    break;
+                }
+                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()) {
+                    Map<Map<String, String>, ConnectionEndPoint> cepMap = this.tapiLink.getCepMap();
+                    addCepToOnep(onepMap, cepMap);
+                    mergeLinkinTopology(rdm2rdmLinks);
+                }
+                LOG.info("TAPI node for or node {} successfully merged", orNodeId);
+                break;
 
-            // 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);
-            }
-            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()
-                    .stream().filter(k -> k.getLogicalConnectionPoint()
-                            .contains("NETWORK")).collect(Collectors.toList());
-            Map<Integer, String> xpdrMap = new HashMap<>();
-            for (Mapping mapping : networkMappings) {
-                Integer xpdrNb = Integer.parseInt(mapping.getLogicalConnectionPoint().split("XPDR")[1].split("-")[0]);
-                String nodeId = node.getNodeId() + TapiStringConstants.XXPDR + xpdrNb;
-                if (!xpdrMap.containsKey(xpdrNb)) {
-                    List<Mapping> xpdrNetMaps = node.nonnullMapping().values()
-                        .stream().filter(k -> k.getLogicalConnectionPoint()
-                            .contains("XPDR" + xpdrNb + TapiStringConstants.NETWORK)).collect(Collectors.toList());
-                    List<Mapping> xpdrClMaps = node.nonnullMapping().values()
-                        .stream().filter(k -> k.getLogicalConnectionPoint()
-                            .contains("XPDR" + xpdrNb + TapiStringConstants.CLIENT)).collect(Collectors.toList());
+            case Xpdr:
+                Map<Integer, String> xpdrMap = new HashMap<>();
+                for (Mapping mapping : node.nonnullMapping().values().stream()
+                        .filter(k -> k.getLogicalConnectionPoint().contains("NETWORK"))
+                        .collect(Collectors.toList())) {
+                    Integer xpdrNb =
+                        Integer.parseInt(mapping.getLogicalConnectionPoint().split("XPDR")[1].split("-")[0]);
+                    String nodeId = node.getNodeId() + TapiStringConstants.XXPDR + xpdrNb;
+                    if (xpdrMap.containsKey(xpdrNb)) {
+                        continue;
+                    }
+                    List<Mapping> xpdrNetMaps = node.nonnullMapping().values().stream()
+                        .filter(k -> k.getLogicalConnectionPoint()
+                            .contains("XPDR" + xpdrNb + TapiStringConstants.NETWORK))
+                        .collect(Collectors.toList());
+                    List<Mapping> xpdrClMaps = node.nonnullMapping().values().stream()
+                        .filter(k -> k.getLogicalConnectionPoint()
+                            .contains("XPDR" + xpdrNb + TapiStringConstants.CLIENT))
+                        .collect(Collectors.toList());
                     xpdrMap.put(xpdrNb, node.getNodeId());
-
                     // create switching pool
-                    OduSwitchingPools oorOduSwitchingPool = createSwitchPoolForXpdr(
-                        mapping.getXpdrType().getIntValue(), xpdrClMaps, xpdrNetMaps, xpdrNb);
-
-                    // node transformation
-                    Map<NodeKey, Node> nodeMap = new HashMap<>(transformXpdrToTapiNode(
-                        nodeId, xpdrClMaps, xpdrNetMaps, mapping.getXpdrType(), oorOduSwitchingPool));
+                    OduSwitchingPools oorOduSwitchingPool =
+                        createSwitchPoolForXpdr(mapping.getXpdrType(), xpdrClMaps, xpdrNetMaps, xpdrNb);
                     // add nodes and sips to tapi context
-                    mergeNodeinTopology(nodeMap);
+                    mergeNodeinTopology(new HashMap<>(
+                        // node transformation
+                        transformXpdrToTapiNode(
+                            nodeId, xpdrClMaps, xpdrNetMaps, mapping.getXpdrType(), oorOduSwitchingPool)));
                     mergeSipsinContext(this.sipMap);
                 }
-            }
-            LOG.info("TAPI node for or node {} successfully merged", orNodeId);
+                LOG.info("TAPI node for or node {} successfully merged", orNodeId);
+                break;
+
+            default:
+                break;
         }
         // Device not managed yet
     }
 
     @Override
     public void updateTapiTopology(String nodeId, Mapping mapping) {
-        List<Uuid> uuids = getChangedNodeUuids(nodeId, mapping);
-
-        List<Uuid> changedOneps = updateNeps(mapping, uuids);
+        List<Uuid> changedOneps = updateNeps(mapping, getChangedNodeUuids(nodeId, mapping));
         updateLinks(changedOneps, mapping);
         sendNotification(changedOneps, mapping);
-
         LOG.info("Updated TAPI topology successfully.");
     }
 
     @SuppressWarnings("rawtypes")
     private void sendNotification(List<Uuid> changedOneps, Mapping mapping) {
-        Notification notification = new NotificationBuilder()
-            .setNotificationType(NOTIFICATIONTYPEATTRIBUTEVALUECHANGE.VALUE)
-//            .setTargetObjectType(ObjectType.NODEEDGEPOINT)
-            //TODO: Change this : modification in Models 2.4 does not provide for Object type Node EdgePoint
-            .setTargetObjectType(TOPOLOGYOBJECTTYPENODEEDGEPOINT.VALUE)
-            .setChangedAttributes(getChangedAttributes(changedOneps, mapping))
-            .setUuid(tapiTopoUuid)
-            .build();
         try {
-            notificationPublishService.putNotification(notification);
+            notificationPublishService.putNotification(
+                new NotificationBuilder()
+                    .setNotificationType(NOTIFICATIONTYPEATTRIBUTEVALUECHANGE.VALUE)
+                    // .setTargetObjectType(ObjectType.NODEEDGEPOINT)
+                    //TODO: Change this : modification in Models 2.4 does not provide for Object type Node EdgePoint
+                    .setTargetObjectType(TOPOLOGYOBJECTTYPENODEEDGEPOINT.VALUE)
+                    .setChangedAttributes(getChangedAttributes(changedOneps, mapping))
+                    .setUuid(tapiTopoUuid)
+                    .build());
         } catch (InterruptedException e) {
             LOG.error("Could not send notification");
         }
     }
 
+    private void addCepToOnep(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap,
+            Map<Map<String, String>, ConnectionEndPoint> cepMap) {
+        LOG.debug("TAPINetModServImpl332, Entering addCepToOnep, with cepMap {} and onepMapKeyList {}", cepMap,
+            onepMap.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList()));
+        for (Map.Entry<Map<String, String>, ConnectionEndPoint> cepEntry : cepMap.entrySet()) {
+            if (!onepMap.entrySet().stream().map(onep -> onep.getKey().toString()).collect(Collectors.toList())
+                    .contains(cepEntry.getKey().entrySet().stream().findFirst().orElseThrow().getKey())) {
+                continue;
+            }
+            OwnedNodeEdgePoint ownedNep = onepMap.entrySet().stream()
+                .filter(onep -> onep.getKey().getUuid().toString()
+                    .equals(cepEntry.getKey().entrySet().stream().findAny().orElseThrow().getKey()))
+                .map(Map.Entry::getValue).findFirst().orElseThrow();
+            CepList cepList = new CepListBuilder()
+                .setConnectionEndPoint(Map.of(cepEntry.getValue().key(), cepEntry.getValue())).build();
+            OwnedNodeEdgePoint1 onep1Bldr = new OwnedNodeEdgePoint1Builder().setCepList(cepList).build();
+            OwnedNodeEdgePoint newOnep = new OwnedNodeEdgePointBuilder(ownedNep)
+                    .addAugmentation(onep1Bldr)
+                    .build();
+            onepMap.put(newOnep.key(), newOnep);
+            LOG.info("TAPINetModServImpl345, getting out of addCepToOnep with no Exception");
+        }
+
+    }
+
     private Map<ChangedAttributesKey, ChangedAttributes> getChangedAttributes(List<Uuid> changedOneps,
-                                                                              Mapping mapping) {
+            Mapping mapping) {
         Map<ChangedAttributesKey, ChangedAttributes> changedAttributes = new HashMap<>();
+        String operState = mapping.getPortOperState();
+        String oldState = operState.equals("InService") ? "OutOfService" : "InService";
         for (Uuid nep : changedOneps) {
-            changedAttributes.put(new ChangedAttributesKey(nep.getValue()),
-                new ChangedAttributesBuilder().setValueName(nep.getValue())
-                    .setOldValue(mapping.getPortOperState().equals("InService") ? "OutOfService" : "InService")
-                    .setNewValue(mapping.getPortOperState())
+            String nepVal = nep.getValue();
+            changedAttributes.put(
+                new ChangedAttributesKey(nepVal),
+                new ChangedAttributesBuilder()
+                    .setValueName(nepVal)
+                    .setOldValue(oldState)
+                    .setNewValue(operState)
                     .build());
         }
         return changedAttributes;
@@ -292,33 +371,45 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private void updateLinks(List<Uuid> changedOneps, Mapping mapping) {
         try {
-            InstanceIdentifier<Topology> topoIID = InstanceIdentifier.builder(Context.class)
-                    .augmentation(Context1.class).child(TopologyContext.class)
-                    .child(Topology.class, new TopologyKey(tapiTopoUuid))
-                    .build();
-            Optional<Topology> optTopology = this.networkTransactionService
-                    .read(LogicalDatastoreType.OPERATIONAL, topoIID).get();
+            Optional<Topology> optTopology =
+                this.networkTransactionService.read(
+                        LogicalDatastoreType.OPERATIONAL,
+                        InstanceIdentifier.builder(Context.class)
+                            .augmentation(Context1.class)
+                            .child(TopologyContext.class)
+                            .child(Topology.class, new TopologyKey(tapiTopoUuid))
+                            .build())
+                    .get();
             if (optTopology.isEmpty()) {
                 LOG.error("Could not update TAPI links");
                 return;
             }
             int nbAffectedLinks = 0;
-            LOG.info("UUIDofAffectedONEPS = {} ", changedOneps.toString());
+            LOG.info("UUIDofAffectedONEPS = {} ", changedOneps);
+            AdministrativeState newAdmState = transformAdminState(mapping.getPortAdminState());
+            OperationalState newOprState = transformOperState(mapping.getPortOperState());
             for (Link link : optTopology.orElseThrow().nonnullLink().values()) {
                 List<Uuid> linkNeps = Objects.requireNonNull(link.getNodeEdgePoint()).values().stream()
-                        .map(NodeEdgePointRef::getNodeEdgePointUuid).collect(Collectors.toList());
-                LOG.info("LinkEndPointsUUID = {} for link Name {}", linkNeps.toString(), link.getName().toString());
-                if (!Collections.disjoint(changedOneps, linkNeps)) {
-                    InstanceIdentifier<Link> linkIID = InstanceIdentifier.builder(Context.class)
-                            .augmentation(Context1.class).child(TopologyContext.class)
-                            .child(Topology.class, new TopologyKey(tapiTopoUuid))
-                            .child(Link.class, new LinkKey(link.getUuid())).build();
-                    Link linkblr = new LinkBuilder().setUuid(link.getUuid())
-                            .setAdministrativeState(transformAdminState(mapping.getPortAdminState()))
-                            .setOperationalState(transformOperState(mapping.getPortOperState())).build();
-                    this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, linkIID, linkblr);
-                    nbAffectedLinks++ ;
+                        .map(NodeEdgePointRef::getNodeEdgePointUuid)
+                        .collect(Collectors.toList());
+                LOG.info("LinkEndPointsUUID = {} for link Name {}", linkNeps, link.getName());
+                if (Collections.disjoint(changedOneps, linkNeps)) {
+                    continue;
                 }
+                this.networkTransactionService.merge(
+                    LogicalDatastoreType.OPERATIONAL,
+                    InstanceIdentifier.builder(Context.class)
+                        .augmentation(Context1.class)
+                        .child(TopologyContext.class)
+                        .child(Topology.class, new TopologyKey(tapiTopoUuid))
+                        .child(Link.class, new LinkKey(link.getUuid()))
+                        .build(),
+                    new LinkBuilder()
+                        .setUuid(link.getUuid())
+                        .setAdministrativeState(newAdmState)
+                        .setOperationalState(newOprState)
+                        .build());
+                nbAffectedLinks++ ;
             }
             LOG.info("AffectedLinksNb = {} ", nbAffectedLinks);
             this.networkTransactionService.commit().get();
@@ -329,41 +420,49 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private List<Uuid> updateNeps(Mapping mapping, List<Uuid> uuids) {
         List<Uuid> changedOneps = new ArrayList<>();
+        AdministrativeState newAdmState = transformAdminState(mapping.getPortAdminState());
+        OperationalState newOprState = transformOperState(mapping.getPortOperState());
         for (Uuid nodeUuid : uuids) {
             try {
-                InstanceIdentifier<Node> nodeIID = InstanceIdentifier.builder(Context.class)
-                        .augmentation(Context1.class).child(TopologyContext.class)
-                        .child(Topology.class, new TopologyKey(tapiTopoUuid)).child(Node.class, new NodeKey(nodeUuid))
-                        .build();
-                Optional<Node> optionalNode = this.networkTransactionService.read(
-                        LogicalDatastoreType.OPERATIONAL, nodeIID).get();
-                if (optionalNode.isPresent()) {
-                    Node node = optionalNode.orElseThrow();
-                    List<OwnedNodeEdgePoint> oneps = node.getOwnedNodeEdgePoint().values().stream()
-                            .filter(onep -> ((Name) onep.getName().values().toArray()[0]).getValue()
-                                    .contains(mapping.getLogicalConnectionPoint())).collect(Collectors.toList());
-                    for (OwnedNodeEdgePoint onep : oneps) {
-                        changedOneps.add(onep.getUuid());
-                        updateSips(mapping, onep);
-                        CepList cepList = getUpdatedCeps(mapping, onep);
-                        InstanceIdentifier<OwnedNodeEdgePoint> onepIID = InstanceIdentifier.builder(Context.class)
-                                .augmentation(Context1.class).child(TopologyContext.class)
+                Optional<Node> optionalNode =
+                    this.networkTransactionService.read(
+                            LogicalDatastoreType.OPERATIONAL,
+                            InstanceIdentifier.builder(Context.class)
+                                .augmentation(Context1.class)
+                                .child(TopologyContext.class)
                                 .child(Topology.class, new TopologyKey(tapiTopoUuid))
                                 .child(Node.class, new NodeKey(nodeUuid))
-                                .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(onep.getUuid()))
-                                .build();
-                        OwnedNodeEdgePoint onepblr = new OwnedNodeEdgePointBuilder().setUuid(onep.getUuid())
-                                .addAugmentation(new OwnedNodeEdgePoint1Builder().setCepList(cepList).build())
-                                .setAdministrativeState(transformAdminState(mapping.getPortAdminState()))
-                                .setOperationalState(transformOperState(mapping.getPortOperState())).build();
-                        this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, onepIID, onepblr);
-                        LOG.info("UpdatedNEP {} of UUID {} to ADMIN {} OPER {}",
-                            onep.getName().toString(), onep.getUuid(),
-                            transformAdminState(mapping.getPortAdminState()),
-                            transformOperState(mapping.getPortOperState()));
-                    }
-                    this.networkTransactionService.commit().get();
+                                .build())
+                        .get();
+                if (optionalNode.isEmpty()) {
+                    continue;
                 }
+                for (OwnedNodeEdgePoint onep : optionalNode.orElseThrow().getOwnedNodeEdgePoint().values().stream()
+                        .filter(onep -> ((Name) onep.getName().values().toArray()[0]).getValue()
+                                .contains(mapping.getLogicalConnectionPoint()))
+                        .collect(Collectors.toList())) {
+                    changedOneps.add(onep.getUuid());
+                    updateSips(mapping, onep);
+                    this.networkTransactionService.merge(
+                        LogicalDatastoreType.OPERATIONAL,
+                        InstanceIdentifier.builder(Context.class)
+                            .augmentation(Context1.class)
+                            .child(TopologyContext.class)
+                            .child(Topology.class, new TopologyKey(tapiTopoUuid))
+                            .child(Node.class, new NodeKey(nodeUuid))
+                            .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(onep.getUuid()))
+                            .build(),
+                        new OwnedNodeEdgePointBuilder()
+                            .setUuid(onep.getUuid())
+                            .addAugmentation(
+                                new OwnedNodeEdgePoint1Builder().setCepList(getUpdatedCeps(mapping, onep)).build())
+                            .setAdministrativeState(newAdmState)
+                            .setOperationalState(newOprState)
+                            .build());
+                    LOG.info("UpdatedNEP {} of UUID {} to ADMIN {} OPER {}",
+                        onep.getName(), onep.getUuid(), newAdmState, newOprState);
+                }
+                this.networkTransactionService.commit().get();
             } catch (InterruptedException | ExecutionException e) {
                 LOG.error("Could not update TAPI NEP");
             }
@@ -373,139 +472,185 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private CepList getUpdatedCeps(Mapping mapping, OwnedNodeEdgePoint onep) {
         OwnedNodeEdgePoint1 onep1 = onep.augmentation(OwnedNodeEdgePoint1.class);
+        if (onep1 == null) {
+            return new CepListBuilder().setConnectionEndPoint(new HashMap<>()).build();
+        }
+        CepList onep1CepList = onep1.getCepList();
+        if (onep1CepList == null) {
+            return new CepListBuilder().setConnectionEndPoint(new HashMap<>()).build();
+        }
+        var onep1CepListConnEndPoint = onep1CepList.getConnectionEndPoint();
+        if (onep1CepListConnEndPoint == null) {
+            return new CepListBuilder().setConnectionEndPoint(new HashMap<>()).build();
+        }
         Map<ConnectionEndPointKey, ConnectionEndPoint> cepMap = new HashMap<>();
-        if (onep1 != null && onep1.getCepList() != null && onep1.getCepList().getConnectionEndPoint() != null) {
-            for (Map.Entry<ConnectionEndPointKey, ConnectionEndPoint> entry : onep1.getCepList().getConnectionEndPoint()
-                    .entrySet()) {
-                ConnectionEndPoint cep = new ConnectionEndPointBuilder(entry.getValue())
-                        .setOperationalState(transformOperState(mapping.getPortOperState())).build();
-                cepMap.put(entry.getKey(), cep);
-            }
+        OperationalState newOprState = transformOperState(mapping.getPortOperState());
+        for (Map.Entry<ConnectionEndPointKey, ConnectionEndPoint> entry : onep1CepListConnEndPoint.entrySet()) {
+            cepMap.put(
+                entry.getKey(),
+                new ConnectionEndPointBuilder(entry.getValue()).setOperationalState(newOprState).build());
         }
         return new CepListBuilder().setConnectionEndPoint(cepMap).build();
     }
 
     private List<Uuid> getChangedNodeUuids(String nodeId, Mapping mapping) {
-        List<Uuid> uuids = new ArrayList<>();
         if (nodeId.contains("ROADM")) {
-            uuids.add(new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA))
-                    .getBytes(StandardCharsets.UTF_8)).toString()));
-        } else if (nodeId.contains("PDR")) {
+            return new ArrayList<>(List.of(new Uuid(
+                UUID.nameUUIDFromBytes(
+                        (String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8))
+                    .toString())));
+        }
+        if (nodeId.contains("PDR")) {
             LOG.debug("ANALYSING change in {}", nodeId);
-            int xpdrNb = Integer.parseInt(mapping.getLogicalConnectionPoint().split("XPDR")[1].split("-")[0]);
-            String xpdrNodeId = nodeId + TapiStringConstants.XXPDR + xpdrNb;
-            uuids.add(new Uuid(UUID.nameUUIDFromBytes((String.join("+", xpdrNodeId, TapiStringConstants.XPDR))
-                    .getBytes(StandardCharsets.UTF_8)).toString()));
-        } else {
-            LOG.error("Updating this device is currently not supported");
-            return uuids;
+            return new ArrayList<>(List.of(new Uuid(
+                UUID.nameUUIDFromBytes(
+                        (String.join("+",
+                                //xpdrNodeId,
+                                nodeId + TapiStringConstants.XXPDR
+                                    // + xpdrNb,
+                                    + Integer.parseInt(
+                                        mapping.getLogicalConnectionPoint().split("XPDR")[1].split("-")[0]),
+                                TapiStringConstants.XPDR))
+                            .getBytes(StandardCharsets.UTF_8))
+                    .toString())));
         }
-        return uuids;
+        LOG.error("Updating this device is currently not supported");
+        return new ArrayList<>();
     }
 
     private void updateSips(Mapping mapping, OwnedNodeEdgePoint onep) {
-        if (onep.getMappedServiceInterfacePoint() == null
-                || onep.getMappedServiceInterfacePoint().size() == 0) {
+        if (onep.getMappedServiceInterfacePoint() == null) {
             return;
         }
+        AdministrativeState newAdmState = transformAdminState(mapping.getPortAdminState());
+        OperationalState newOprState = transformOperState(mapping.getPortOperState());
         for (MappedServiceInterfacePoint msip : onep.getMappedServiceInterfacePoint().values()) {
-            InstanceIdentifier<ServiceInterfacePoint> sipIID = InstanceIdentifier
+            this.networkTransactionService.merge(
+                LogicalDatastoreType.OPERATIONAL,
+                InstanceIdentifier
                     .builder(Context.class)
                     .child(ServiceInterfacePoint.class,
                             new ServiceInterfacePointKey(msip.getServiceInterfacePointUuid()))
-                    .build();
-            ServiceInterfacePoint sipblr = new ServiceInterfacePointBuilder()
+                    .build(),
+                new ServiceInterfacePointBuilder()
                     .setUuid(msip.getServiceInterfacePointUuid())
-                    .setAdministrativeState(transformAdminState(mapping.getPortAdminState()))
-                    .setOperationalState(transformOperState(mapping.getPortOperState())).build();
-            this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, sipIID, sipblr);
+                    .setAdministrativeState(newAdmState)
+                    .setOperationalState(newOprState)
+                    .build());
         }
-
     }
 
     private Map<NodeKey, Node> transformXpdrToTapiNode(String nodeId, List<Mapping> xpdrClMaps,
-                                                       List<Mapping> xpdrNetMaps, XpdrNodeTypes xponderType,
-                                                       OduSwitchingPools oorOduSwitchingPool) {
-        Map<NodeKey, Node> nodeMap = new HashMap<>();
+            List<Mapping> xpdrNetMaps, XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) {
         LOG.info("creation of a DSR/ODU node for {}", nodeId);
-        Uuid nodeUuidDsr = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, TapiStringConstants.XPDR))
-            .getBytes(StandardCharsets.UTF_8)).toString());
-        Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(
-            String.join("+", nodeId, TapiStringConstants.XPDR)).build();
-        Name nameOtsi =  new NameBuilder().setValueName("otsi node name").setValue(
-            String.join("+", nodeId, TapiStringConstants.XPDR)).build();
-        Name nameNodeType = new NameBuilder().setValueName("Node Type")
-            .setValue(getNodeType(xponderType)).build();
-        Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
-            LayerProtocolName.DIGITALOTN, LayerProtocolName.PHOTONICMEDIA);
-        Node dsrNode = createTapiXpdrNode(Map.of(nameDsr.key(), nameDsr, nameOtsi.key(), nameOtsi, nameNodeType.key(),
-            nameNodeType), dsrLayerProtocols, nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType,
-            oorOduSwitchingPool);
-
-        nodeMap.put(dsrNode.key(), dsrNode);
-        return nodeMap;
+        String nameVal = String.join("+", nodeId, TapiStringConstants.XPDR);
+        Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(nameVal).build();
+        Name nameOtsi =  new NameBuilder().setValueName("otsi node name").setValue(nameVal).build();
+        Name nameNodeType = new NameBuilder().setValueName("Node Type").setValue(getNodeType(xponderType)).build();
+        Node dsrNode = createTapiXpdrNode(
+            Map.of(nameDsr.key(), nameDsr, nameOtsi.key(), nameOtsi, nameNodeType.key(), nameNodeType),
+            Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
+                LayerProtocolName.DIGITALOTN, LayerProtocolName.PHOTONICMEDIA),
+            nodeId, new Uuid(UUID.nameUUIDFromBytes(nameVal.getBytes(StandardCharsets.UTF_8)).toString()),
+            xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool);
+        return new HashMap<>(Map.of(dsrNode.key(), dsrNode));
     }
 
-    private OduSwitchingPools createSwitchPoolForXpdr(int xpdrType, List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
-                                                      Integer xpdrNb) {
-        // todo: are switching pool correct here??
+    private OduSwitchingPools createSwitchPoolForXpdr(
+            XpdrNodeTypes xpdrType, List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps, Integer xpdrNb) {
+        //TODO are switching pool correct here??
         switch (xpdrType) {
-            case 1:
-                // Tpdr
+            case Tpdr:
                 return createTpdrSwitchPool(xpdrNetMaps);
-            case 2:
-                // Mux
+            case Mpdr:
                 return createMuxSwitchPool(xpdrClMaps, xpdrNetMaps, xpdrNb);
-            case 3:
-                // Switch
+            case Switch:
                 return createSwtchSwitchPool(xpdrClMaps, xpdrNetMaps, xpdrNb);
+            // case Regen:
+            // case RegenUni:
             default:
                 LOG.warn("Xpdr type {} not supported", xpdrType);
         }
         return null;
     }
 
-    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> transformSrgToOnep(String orNodeId,
-                                                                              Map<String, List<Mapping>> mapSrg) {
-        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
+    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> transformSrgToOnep(
+                String orNodeId, 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());
+            for (Mapping m : entry.getValue()) {
+                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 {
+                    var netTP1fromDS = getNetworkTerminationPoint1FromDatastore(overlayNodeId, tpId);
+                    if (netTP1fromDS != null) {
+                        //tpList.add(netTP1fromDS);
+                        tpMap.put(tpId, netTP1fromDS);
+                        LOG.debug("LCP {} is not empty for augmentation TP1", tpId);
+                        break;
+                    }
+                    try {
+                        Thread.sleep(1);
+                    } catch (InterruptedException e) {
+                        // TODO Auto-generated catch block
+                        LOG.debug("Waiting until PP is backported in Topology, Exception raised", e);
+                    }
+                    counter--;
+                } while (counter > 0);
+                if (counter == 0) {
+                    LOG.error("CREATENEP transformSrgToOnep, No Tp1 found in topology for LCP {}, of NodeId {} ",
+                        tpId, overlayNodeId);
+                }
+                if (getNetworkTerminationPoint11FromDatastore(overlayNodeId, tpId) == null) {
+                    LOG.error("CREATENEP transformSrgToOnep, No Tp11 found in topology for LCP {}, of NodeId {} ",
+                        tpId, overlayNodeId);
+                } else {
+                    LOG.info("LCP {} is not empty for augmentation TP11", tpId);
+                }
             }
         }
-        return onepMap;
+        LOG.debug("TransformSRGToONep for tps {}, of NodeId {} ",
+            tpMap.entrySet().stream().map(tp -> tp.getKey()).collect(Collectors.toList()), 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<>();
+    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> transformDegToOnep(
+                String orNodeId, Map<String, List<Mapping>> mapDeg) {
+        LOG.debug("CREATENEP transformDegToOnep, ListOfMapping {}, of NodeId {} ", mapDeg, 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();
+                if (!tpId.contains("TTP")) {
+                    LOG.info("LCP {} is not an external TP of DEGREE node", tpId);
+                    continue;
+                }
+                String overlayNodeId = String.join("-", orNodeId, tpId.split("\\-")[0]);
+                var netTP1fromDS = getNetworkTerminationPoint1FromDatastore(overlayNodeId, tpId);
+                if (netTP1fromDS == null) {
+                    LOG.error("CREATENEP transformDegToOnep, No Tp found in topology for LCP {}, of NodeId {} ",
+                        tpId, overlayNodeId);
                     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);
+                //tpList.add(getNetworkTerminationPointFromDatastore(overlayNodeId, tpId));
+                tpMap.put(tpId, netTP1fromDS);
+                LOG.info("LCP {} is not empty for augmentation TP1", tpId);
             }
         }
-        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) {
@@ -529,13 +674,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         // Then check SIPs and delete them. Then services and connections with SIPs and put them to another state.
         LOG.info("Deleting node {} from TAPI topology", nodeId);
         InstanceIdentifier<Topology> topologyIID = InstanceIdentifier.builder(Context.class)
-                .augmentation(Context1.class).child(TopologyContext.class).child(Topology.class,
-                        new TopologyKey(tapiTopoUuid)).build();
+                .augmentation(Context1.class)
+                .child(TopologyContext.class)
+                .child(Topology.class, new TopologyKey(tapiTopoUuid))
+                .build();
         Topology topology = null;
         try {
             Optional<Topology> optTopology =
                     this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, topologyIID).get();
-            if (!optTopology.isPresent()) {
+            if (optTopology.isEmpty()) {
                 LOG.error("No topology object present. Error deleting node {}", nodeId);
                 return;
             }
@@ -552,10 +699,17 @@ 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 (TOPOLOGICAL_MODE.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
@@ -579,9 +733,9 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         InstanceIdentifier<Context> contextIID = InstanceIdentifier.builder(Context.class).build();
         Context context = null;
         try {
-            Optional<Context> optContext = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL,
-                    contextIID).get();
-            if (!optContext.isPresent()) {
+            Optional<Context> optContext =
+                this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, contextIID).get();
+            if (optContext.isEmpty()) {
                 LOG.error("No context object present in datastore.");
                 return;
             }
@@ -594,40 +748,40 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             return;
         }
         Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips = context.getServiceInterfacePoint();
-        if (sips != null) {
-            for (ServiceInterfacePoint sip:sips.values()) {
-                if (sip.getName().values().stream().anyMatch(name -> name.getValue().contains(nodeId))) {
-                    // Update state of services that have this sip as an endpoint and also connections
-                    updateConnectivityServicesState(sip.getUuid(), nodeId);
-                    deleteSipFromTopo(sip.getUuid());
-                }
+        if (sips == null) {
+            return;
+        }
+        for (ServiceInterfacePoint sip:sips.values()) {
+            if (sip.getName().values().stream().anyMatch(name -> name.getValue().contains(nodeId))) {
+                // Update state of services that have this sip as an endpoint and also connections
+                updateConnectivityServicesState(sip.getUuid(), nodeId);
+                deleteSipFromTopo(sip.getUuid());
             }
         }
     }
 
-    private Node createTapiXpdrNode(Map<NameKey, Name> nameMap, Set<LayerProtocolName> layerProtocols,
-                                    String nodeId, Uuid nodeUuid, List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
-                                    XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) {
-
-        Map<RuleKey, Rule> ruleList = new HashMap<>();
-        Set<RuleType> ruleTypes = new HashSet<>();
-        ruleTypes.add(RuleType.FORWARDING);
+    private Node createTapiXpdrNode(
+            Map<NameKey, Name> nameMap, Set<LayerProtocolName> layerProtocols,
+            String nodeId, Uuid nodeUuid,
+            List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
+            XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) {
+        if (!layerProtocols.contains(LayerProtocolName.DSR)
+                || !layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
+            LOG.error("Undefined LayerProtocolName for {} node {}",
+                nameMap.get(nameMap.keySet().iterator().next()).getValueName(),
+                nameMap.get(nameMap.keySet().iterator().next()).getValue());
+        }
+        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl =
+            new HashMap<>(createXpdrDsrOduNeps(nodeId, xpdrClMaps, xpdrNetMaps, xponderType));
         Rule rule = new RuleBuilder()
                 .setLocalId("forward")
                 .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
-                .setRuleType(ruleTypes)
+                .setRuleType(new HashSet<>(Set.of(RuleType.FORWARDING)))
                 .build();
-        ruleList.put(rule.key(), rule);
-        if (!(layerProtocols.contains(LayerProtocolName.DSR)
-                && layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA))) {
-            LOG.error("Undefined LayerProtocolName for {} node {}", nameMap.get(nameMap.keySet().iterator().next())
-                .getValueName(), nameMap.get(nameMap.keySet().iterator().next()).getValue());
-        }
-        Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
-        onepl.putAll(createXpdrDsrOduNeps(nodeId, xpdrClMaps, xpdrNetMaps, xponderType));
-        Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = createNodeRuleGroupForDsrNode(
-                    nodeId, oorOduSwitchingPool, ruleList, onepl);
+        Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList =
+            createNodeRuleGroupForDsrNode(nodeId, oorOduSwitchingPool, new HashMap<>(Map.of(rule.key(), rule)), onepl);
         onepl.putAll(createXpdrPhtnMdNeps(nodeId, xpdrNetMaps));
+        LOG.debug("TapiNetworkModelServiceImpl line 721, total NEP map = {}", onepl);
 
         // Empty random creation of mandatory fields for avoiding errors....
         CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
@@ -649,7 +803,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)
@@ -668,161 +822,133 @@ 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()) {
+                continue;
+            }
+            var aug1 = entry.getValue().augmentationOrElseThrow(
+                                org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121
+                            .OwnedNodeEdgePoint1.class);
+            if (aug1 == null) {
+                continue;
+            }
+            var phMedNepSpec = aug1.getPhotonicMediaNodeEdgePointSpec();
+            if (phMedNepSpec != null) {
+                pmnepspecList.add(phMedNepSpec);
+            }
+        }
+        LOG.debug("TapiNetworkModelServiceImpl line 775, List of non empty PMNEPSEC is = {}", pmnepspecList);
+        return builtNode;
     }
 
-    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrPhtnMdNeps(String nodeId,
-                                                                                List<Mapping> xpdrNetMaps) {
+    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrPhtnMdNeps(
+            String nodeId, List<Mapping> xpdrNetMaps) {
         Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
-
         // eNep creation on otsi node
-        for (int i = 0; i < xpdrNetMaps.size(); i++) {
-            Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
-                (String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
-                    xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString());
-            Name onedName = new NameBuilder()
-                .setValueName("eNodeEdgePoint")
-                .setValue(String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS,
-                    xpdrNetMaps.get(i).getLogicalConnectionPoint()))
-                .build();
-
-            List<SupportedIfCapability> newSupIfCapList =
-                    new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
-
-            OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                true, String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS), newSupIfCapList,
-                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
-                transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
+        for (Mapping mapping : xpdrNetMaps) {
+            var lcp = mapping.getLogicalConnectionPoint();
+            String onedNameVal = String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS, lcp);
+            Name onedName = new NameBuilder().setValueName("eNodeEdgePoint").setValue(onedNameVal).build();
+            var supOpModes = mapping.getSupportedOperationalMode();
+            List<String> opModeList = supOpModes == null ? new ArrayList<>() : new ArrayList<>(supOpModes);
+            AdministrativeState newAdmState = transformAdminState(mapping.getPortAdminState());
+            OperationalState newOprState = transformOperState(mapping.getPortOperState());
+            OwnedNodeEdgePoint onep = createNep(
+                nodeId,
+                new Uuid(UUID.nameUUIDFromBytes(onedNameVal.getBytes(StandardCharsets.UTF_8)).toString()),
+                lcp, Map.of(onedName.key(), onedName),
+                LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
+                String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS),
+                new ArrayList<>(mapping.getSupportedInterfaceCapability()), opModeList, newOprState, newAdmState);
             onepl.put(onep.key(), onep);
-        }
         // OTSi_MC Nep creation on otsi node
-        for (int i = 0; i < xpdrNetMaps.size(); i++) {
-            Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes(
-                (String.join("+", nodeId, TapiStringConstants.OTSI_MC,
-                    xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString());
-            Name onedName = new NameBuilder()
-                .setValueName("PhotMedNodeEdgePoint")
-                .setValue(String.join("+", nodeId, TapiStringConstants.OTSI_MC,
-                    xpdrNetMaps.get(i).getLogicalConnectionPoint()))
-                .build();
-
-            List<SupportedIfCapability> newSupIfCapList =
-                    new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
-
-            OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                false, String.join("+", nodeId, TapiStringConstants.OTSI_MC), newSupIfCapList,
-                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
-                transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
-            onepl.put(onep.key(), onep);
+            String onedNameVal2 = String.join("+", nodeId, TapiStringConstants.OTSI_MC, lcp);
+            Name onedName2 = new NameBuilder().setValueName("PhotMedNodeEdgePoint").setValue(onedNameVal2).build();
+            OwnedNodeEdgePoint onep2 = createNep(
+                nodeId,
+                new Uuid(UUID.nameUUIDFromBytes(onedNameVal2.getBytes(StandardCharsets.UTF_8)).toString()),
+                lcp, Map.of(onedName2.key(), onedName2),
+                LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, false,
+                String.join("+", nodeId, TapiStringConstants.OTSI_MC),
+                new ArrayList<>(mapping.getSupportedInterfaceCapability()), opModeList, newOprState, newAdmState);
+            onepl.put(onep2.key(), onep2);
         }
         return onepl;
     }
 
-    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrDsrOduNeps(String nodeId, List<Mapping> xpdrClMaps,
-                                                                                List<Mapping> xpdrNetMaps,
-                                                                                XpdrNodeTypes xponderType) {
+    private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrDsrOduNeps(
+            String nodeId, List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps, XpdrNodeTypes xponderType) {
         Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
         // client nep creation on DSR node
-        for (int i = 0; i < xpdrClMaps.size(); i++) {
-            LOG.info("Client NEP = {}", String.join("+", nodeId, TapiStringConstants.DSR,
-                xpdrClMaps.get(i).getLogicalConnectionPoint()));
-            Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
-                (String.join("+", nodeId, TapiStringConstants.DSR,
-                    xpdrClMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString());
-            NameBuilder nameBldr = new NameBuilder().setValue(String.join("+", nodeId,
-                TapiStringConstants.DSR, xpdrClMaps.get(i).getLogicalConnectionPoint()));
-            Name name;
-            if (OpenroadmNodeType.TPDR.getName().equalsIgnoreCase(xponderType.getName())) {
-                name = nameBldr.setValueName("100G-tpdr").build();
-            } else {
-                name = nameBldr.setValueName("NodeEdgePoint_C").build();
-            }
-
-            List<SupportedIfCapability> newSupIfCapList =
-                    new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
-
-            OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
-                Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
-                String.join("+", nodeId, TapiStringConstants.DSR), newSupIfCapList,
-                transformOperState(xpdrClMaps.get(i).getPortOperState()),
-                transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
-            onepl.put(onep.key(), onep);
-        }
-        // network nep creation on I_ODU node
-        for (int i = 0; i < xpdrNetMaps.size(); i++) {
-            LOG.info("iODU NEP = {}", String.join("+", nodeId, TapiStringConstants.I_ODU,
-                xpdrNetMaps.get(i).getLogicalConnectionPoint()));
-            Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
-                (String.join("+", nodeId, TapiStringConstants.I_ODU,
-                    xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString());
-            Name onedName = new NameBuilder()
-                .setValueName("iNodeEdgePoint_N")
-                .setValue(String.join("+", nodeId, TapiStringConstants.I_ODU,
-                    xpdrNetMaps.get(i).getLogicalConnectionPoint()))
+        for (Mapping mapping : xpdrClMaps) {
+            var lcp = mapping.getLogicalConnectionPoint();
+            String nepvalue = String.join("+", nodeId, TapiStringConstants.DSR, lcp);
+            LOG.info("Client NEP = {}", nepvalue);
+            Name name = new NameBuilder()
+                .setValue(nepvalue)
+                .setValueName(OpenroadmNodeType.TPDR.getName().equalsIgnoreCase(xponderType.getName())
+                        ? "100G-tpdr" : "NodeEdgePoint_C")
                 .build();
-
-            List<SupportedIfCapability> newSupIfCapList =
-                    new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
-
-            OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                Map.of(onedName.key(), onedName),
-                LayerProtocolName.ODU, LayerProtocolName.DSR, true,
-                String.join("+", nodeId, TapiStringConstants.I_ODU), newSupIfCapList,
-                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
-                transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
+            AdministrativeState newAdmState = transformAdminState(mapping.getPortAdminState());
+            OperationalState newOprState = transformOperState(mapping.getPortOperState());
+            OwnedNodeEdgePoint onep = createNep(
+                nodeId, new Uuid(UUID.nameUUIDFromBytes(nepvalue.getBytes(StandardCharsets.UTF_8)).toString()),
+                lcp, Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
+                String.join("+", nodeId, TapiStringConstants.DSR),
+                new ArrayList<>(mapping.getSupportedInterfaceCapability()), null, newOprState, newAdmState);
             onepl.put(onep.key(), onep);
-        }
         // network nep creation on E_ODU node
-        for (int i = 0; i < xpdrClMaps.size(); i++) {
-            LOG.info("eODU NEP = {}", String.join("+", nodeId, TapiStringConstants.E_ODU,
-                xpdrClMaps.get(i).getLogicalConnectionPoint()));
-            Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
-                (String.join("+", nodeId, TapiStringConstants.E_ODU,
-                    xpdrClMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString());
-            Name onedName = new NameBuilder()
-                .setValueName("eNodeEdgePoint_N")
-                .setValue(String.join("+", nodeId, TapiStringConstants.E_ODU,
-                    xpdrClMaps.get(i).getLogicalConnectionPoint()))
-                .build();
-
-            List<SupportedIfCapability> newSupIfCapList =
-                    new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
-
-            OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
-                Map.of(onedName.key(), onedName),
-                LayerProtocolName.ODU, LayerProtocolName.DSR, true,
-                String.join("+", nodeId, TapiStringConstants.E_ODU), newSupIfCapList,
-                transformOperState(xpdrClMaps.get(i).getPortOperState()),
-                transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
+            String onedNameVal = String.join("+", nodeId, TapiStringConstants.E_ODU, lcp);
+            LOG.info("eODU NEP = {}", onedNameVal);
+            Name onedName = new NameBuilder().setValueName("eNodeEdgePoint_N").setValue(onedNameVal).build();
+            OwnedNodeEdgePoint onep2 = createNep(
+                nodeId, new Uuid(UUID.nameUUIDFromBytes(onedNameVal.getBytes(StandardCharsets.UTF_8)).toString()),
+                lcp, Map.of(onedName.key(), onedName), LayerProtocolName.ODU, LayerProtocolName.DSR, true,
+                String.join("+", nodeId, TapiStringConstants.E_ODU),
+                new ArrayList<>(mapping.getSupportedInterfaceCapability()), null, newOprState, newAdmState);
+            onepl.put(onep2.key(), onep2);
+        }
+        // network nep creation on I_ODU node
+        for (Mapping mapping : xpdrNetMaps) {
+            var lcp = mapping.getLogicalConnectionPoint();
+            String onedNameVal = String.join("+", nodeId, TapiStringConstants.I_ODU, lcp);
+            LOG.info("iODU NEP = {}", onedNameVal);
+            Name onedName = new NameBuilder().setValueName("iNodeEdgePoint_N").setValue(onedNameVal).build();
+            OwnedNodeEdgePoint onep = createNep(
+                nodeId, new Uuid(UUID.nameUUIDFromBytes(onedNameVal.getBytes(StandardCharsets.UTF_8)).toString()),
+                lcp, Map.of(onedName.key(), onedName), LayerProtocolName.ODU, LayerProtocolName.DSR, true,
+                String.join("+", nodeId, TapiStringConstants.I_ODU),
+                new ArrayList<>(mapping.getSupportedInterfaceCapability()),
+                null, transformOperState(mapping.getPortOperState()),transformAdminState(mapping.getPortAdminState()));
             onepl.put(onep.key(), onep);
         }
         return onepl;
     }
 
     private OperationalState transformOperState(String operString) {
-        State operState = org.opendaylight.transportpce.networkmodel.util.TopologyUtils.setNetworkOperState(operString);
-        return operState.equals(State.InService) ? OperationalState.ENABLED : OperationalState.DISABLED;
+        return org.opendaylight.transportpce.networkmodel.util.TopologyUtils.setNetworkOperState(operString)
+                .equals(State.InService) ? OperationalState.ENABLED : OperationalState.DISABLED;
     }
 
     private AdministrativeState transformAdminState(String adminString) {
-        AdminStates adminState = org.opendaylight.transportpce.networkmodel.util.TopologyUtils
-            .setNetworkAdminState(adminString);
-        return adminState.equals(AdminStates.InService) ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
+        return org.opendaylight.transportpce.networkmodel.util.TopologyUtils.setNetworkAdminState(adminString)
+                .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> sicList,
-                                         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<>();
         for (SupportedIfCapability supInterCapa : sicList) {
-            SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
+            sicListTemp.add(new SupportedInterfaceCapabilityBuilder()
                     .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
                     .setIfCapType(supInterCapa)
-                    .build();
-            sicListTemp.add(supIfCapa);
+                    .build());
         }
         Collection<SupportedInterfaceCapability> sicColl = sicListTemp;
         OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
@@ -830,63 +956,76 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .setLayerProtocolName(nepProtocol)
                 .setName(nepNames);
         if (withSip) {
-            onepBldr.setMappedServiceInterfacePoint(this.tapiFactory.createMSIP(1, nepProtocol, tpid, keyword,
-                    sicColl, 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(
-                this.tapiFactory.createSupportedCepLayerProtocolQualifier(sicColl, nepProtocol));
-        onepBldr.setDirection(Direction.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
-                .setAdministrativeState(adminState).setOperationalState(operState)
-                .setLifecycleState(LifecycleState.INSTALLED);
-        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))
-                .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)
+        onepBldr
+            .setSupportedCepLayerProtocolQualifierInstances(
+                this.tapiFactory.createSupportedCepLayerProtocolQualifier(sicColl, nepProtocol))
             .setDirection(Direction.BIDIRECTIONAL)
             .setLinkPortRole(PortRole.SYMMETRIC)
             .setAdministrativeState(adminState).setOperationalState(operState)
-            .setLifecycleState(LifecycleState.INSTALLED)
+            .setLifecycleState(LifecycleState.INSTALLED);
+        if (!keyword.contains(TapiStringConstants.OTSI_MC) && !keyword.contains(TapiStringConstants.PHTNC_MEDIA_OTS)) {
+            return onepBldr.build();
+        }
+        List<OperationalModeKey> keyedOpModeList = new ArrayList<>();
+        if (opModeList == null || opModeList.isEmpty()) {
+            for (SupportedInterfaceCapability sic : sicColl) {
+                switch (sic.getIfCapType().toString().split("\\{")[0]) {
+                    case "IfOCHOTUCnODUCn":
+                    case "IfOCHOTUCnODUCnUniregen":
+                    case "IfOCHOTUCnODUCnRegen":
+                        keyedOpModeList.add(new OperationalModeKey("400G"));
+                        LOG.warn(TopologyUtils.NOOPMODEDECLARED + "400G rate available", tpid);
+                        break;
+                    default:
+                        continue;
+                }
+                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) {
+            LOG.error("CREATENEP, No Tp found in topology for LCP {}, of NodeId {} ", tpid, nodeId);
+        } else {
+            freqWidthMap = tapiFactory.getXpdrUsedWavelength(getNetworkTerminationPointFromDatastore(nodeId, tpid));
+        }
+        OwnedNodeEdgePoint onep = tapiFactory.addPayloadStructureAndPhotSpecToOnep(
+                nodeId, freqWidthMap, keyedOpModeList, sicColl, onepBldr, keyword)
             .build();
-        onepMap.put(onep.key(), onep);
-        return onepMap;
+        LOG.debug("TapiNetworkServiceImpl line982, onep = {}", onep);
+        return onep;
     }
 
-    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();
+    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();
+        } else {
+            String nodeNamesVal = String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA);
+            nodeUuid = new Uuid(
+                UUID.nameUUIDFromBytes(nodeNamesVal.getBytes(StandardCharsets.UTF_8))
+                    .toString());
+            nodeNames = new NameBuilder().setValueName("roadm node name").setValue(nodeNamesVal).build();
+        }
+        Name nameNodeType =
+            new NameBuilder().setValueName("Node Type").setValue(OpenroadmNodeType.ROADM.getName()).build();
         // Protocol Layer
-        Set<LayerProtocolName> layerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
         // Empty random creation of mandatory fields for avoiding errors....
         CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
             .setCostAlgorithm("Restricted Shortest Path - RSP")
@@ -904,19 +1043,20 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setRiskCharacteristicName("risk characteristic")
             .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
             .build();
-        RiskParameterPac riskParamPac = new RiskParameterPacBuilder()
-            .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
-            .build();
+        Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap
+            = tapiFactory.createAllNodeRuleGroupForRdmNode(TOPOLOGICAL_MODE, nodeUuid, orNodeId, onepMap.values());
         return new NodeBuilder()
             .setUuid(nodeUuid)
             .setName(Map.of(nodeNames.key(), nodeNames, nameNodeType.key(), nameNodeType))
-            .setLayerProtocolName(layerProtocols)
+            .setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA))
             .setAdministrativeState(AdministrativeState.UNLOCKED)
             .setOperationalState(OperationalState.ENABLED)
             .setLifecycleState(LifecycleState.INSTALLED)
-            .setOwnedNodeEdgePoint(oneplist)
-            .setNodeRuleGroup(this.tapiFactory
-                    .createNodeRuleGroupForRdmNode("Full", nodeUuid, orNodeId, oneplist.values()))
+            .setOwnedNodeEdgePoint(onepMap)
+            .setNodeRuleGroup(nodeRuleGroupMap)
+            .setInterRuleGroup(
+                tapiFactory.createInterRuleGroupForRdmNode(TOPOLOGICAL_MODE, nodeUuid, orNodeId,
+                    nodeRuleGroupMap.entrySet().stream().map(e -> e.getKey()).collect(Collectors.toList())))
             .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
             .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
             .setErrorCharacteristic("error")
@@ -925,27 +1065,25 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setDeliveryOrderCharacteristic("delivery order")
             .setUnavailableTimeCharacteristic("unavailable time")
             .setServerIntegrityProcessCharacteristic("server integrity process")
-            .setRiskParameterPac(riskParamPac)
+            .setRiskParameterPac(
+                new RiskParameterPacBuilder()
+                    .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
+                    .build())
             .build();
     }
 
     private OduSwitchingPools createTpdrSwitchPool(List<Mapping> xpdrNetMaps) {
         Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
-        int count = 1;
         for (int i = 1; i <= xpdrNetMaps.size(); i++) {
-            LOG.info("XPDr net LCP = {}", xpdrNetMaps.get(i - 1).getLogicalConnectionPoint());
-            LOG.info("XPDr net associated LCP = {}", xpdrNetMaps.get(i - 1).getConnectionMapLcp());
-            TpId tpid1 = new TpId(xpdrNetMaps.get(i - 1).getLogicalConnectionPoint());
-            TpId tpid2 = new TpId(xpdrNetMaps.get(i - 1).getConnectionMapLcp());
-            Set<TpId> tpList = new HashSet<>();
-            tpList.add(tpid1);
-            tpList.add(tpid2);
+            String netLCP = xpdrNetMaps.get(i - 1).getLogicalConnectionPoint();
+            String netAssoLCP = xpdrNetMaps.get(i - 1).getConnectionMapLcp();
+            LOG.info("XPDr net LCP = {}", netLCP);
+            LOG.info("XPDr net associated LCP = {}", netAssoLCP);
             NonBlockingList nbl = new NonBlockingListBuilder()
-                .setNblNumber(Uint16.valueOf(count))
-                .setTpList(tpList)
+                .setNblNumber(Uint16.valueOf(i))
+                .setTpList(new HashSet<>(Set.of(new TpId(netLCP), new TpId(netAssoLCP))))
                 .build();
             nblMap.put(nbl.key(), nbl);
-            count++;
         }
         return new OduSwitchingPoolsBuilder()
             .setNonBlockingList(nblMap)
@@ -953,43 +1091,30 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .build();
     }
 
-    private OduSwitchingPools createSwtchSwitchPool(List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
-                                                    Integer xpdrNb) {
+    private OduSwitchingPools createSwtchSwitchPool(
+            List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps, Integer xpdrNb) {
         Set<TpId> tpl = new HashSet<>();
-        TpId tpId = null;
         for (int i = 1; i <= xpdrClMaps.size(); i++) {
-            tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i);
-            tpl.add(tpId);
+            tpl.add(new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i));
+            tpl.add(new TpId("XPDR" + xpdrNb + TapiStringConstants.NETWORK + i));
         }
-        for (int i = 1; i <= xpdrNetMaps.size(); i++) {
-            tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.NETWORK + i);
-            tpl.add(tpId);
-        }
-        Map<NonBlockingListKey, NonBlockingList> nbMap = new HashMap<>();
-        NonBlockingList nbl = new NonBlockingListBuilder()
-            .setNblNumber(Uint16.valueOf(1))
-            .setTpList(tpl)
-            .build();
-        nbMap.put(nbl.key(),nbl);
-
+        NonBlockingList nbl = new NonBlockingListBuilder().setNblNumber(Uint16.valueOf(1)).setTpList(tpl).build();
         return new OduSwitchingPoolsBuilder()
             .setSwitchingPoolNumber(Uint16.valueOf(1))
             .setSwitchingPoolType(SwitchingPoolTypes.NonBlocking)
-            .setNonBlockingList(nbMap)
+            .setNonBlockingList(new HashMap<>(Map.of(nbl.key(),nbl)))
             .build();
     }
 
     private OduSwitchingPools createMuxSwitchPool(List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps, Integer xpdrNb) {
         Map<NonBlockingListKey, NonBlockingList> nbMap = new HashMap<>();
         for (int i = 1; i <= xpdrClMaps.size(); i++) {
-            Set<TpId> tpList = new HashSet<>();
-            TpId tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i);
-            tpList.add(tpId);
-            tpId = new TpId("XPDR" + xpdrNb + "-NETWORK1");
-            tpList.add(tpId);
             NonBlockingList nbl = new NonBlockingListBuilder()
                 .setNblNumber(Uint16.valueOf(i))
-                .setTpList(tpList)
+                .setTpList(
+                    new HashSet<>(Set.of(
+                        new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i),
+                        new TpId("XPDR" + xpdrNb + "-NETWORK1"))))
                 .setAvailableInterconnectBandwidth(Uint32.valueOf(xpdrNetMaps.size() * 10L))
                 .setInterconnectBandwidthUnit(Uint32.valueOf(1000000000))
                 .build();
@@ -1010,33 +1135,32 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             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<>();
+        Uuid nodeUuid = new Uuid(
+            UUID.nameUUIDFromBytes((String.join("+", nodeId, TapiStringConstants.DSR)).getBytes(StandardCharsets.UTF_8))
+                .toString());
         int count = 1;
         for (NonBlockingList nbl : oorOduSwitchingPool.nonnullNonBlockingList().values()) {
             LOG.info("Non blocking list = {}", nbl);
             Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
             for (TpId tp : nbl.getTpList()) {
-                LOG.info("EDOU TP = {}", String.join("+", nodeId, TapiStringConstants.E_ODU, tp.getValue()));
-                LOG.info("DSR TP = {}", String.join("+", nodeId, TapiStringConstants.DSR, tp.getValue()));
-                Uuid tpUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId,
-                    TapiStringConstants.E_ODU, tp.getValue())).getBytes(StandardCharsets.UTF_8)).toString());
-                Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId,
-                    TapiStringConstants.DSR, tp.getValue())).getBytes(StandardCharsets.UTF_8)).toString());
+                String tpUuidSd = String.join("+", nodeId, TapiStringConstants.E_ODU, tp.getValue());
+                LOG.info("EDOU TP = {}", tpUuidSd);
+                Uuid tpUuid = new Uuid(UUID.nameUUIDFromBytes(tpUuidSd.getBytes(StandardCharsets.UTF_8)).toString());
+                String tp1UuidSd = String.join("+", nodeId, TapiStringConstants.DSR, tp.getValue());
+                LOG.info("DSR TP = {}", tp1UuidSd);
+                Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes(tp1UuidSd.getBytes(StandardCharsets.UTF_8)).toString());
                 if (onepl.containsKey(new OwnedNodeEdgePointKey(tpUuid))
                         && onepl.containsKey(new OwnedNodeEdgePointKey(tp1Uuid))) {
                     NodeEdgePoint nep1 = new NodeEdgePointBuilder()
                         .setTopologyUuid(this.tapiTopoUuid)
-                        .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes(
-                            (String.join("+", nodeId,TapiStringConstants. DSR))
-                                .getBytes(StandardCharsets.UTF_8)).toString()))
+                        .setNodeUuid(nodeUuid)
                         .setNodeEdgePointUuid(tp1Uuid)
                         .build();
                     NodeEdgePoint nep2 = new NodeEdgePointBuilder()
                         .setTopologyUuid(this.tapiTopoUuid)
-                        .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes(
-                            (String.join("+", nodeId,TapiStringConstants. DSR))
-                                .getBytes(StandardCharsets.UTF_8)).toString()))
+                        .setNodeUuid(nodeUuid)
                         .setNodeEdgePointUuid(tpUuid)
                         .build();
                     nepList.put(nep1.key(), nep1);
@@ -1077,34 +1201,34 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private String getNodeType(XpdrNodeTypes xponderType) {
-        switch (xponderType.getIntValue()) {
-            case 1:
+        switch (xponderType) {
+            case Tpdr:
                 return OpenroadmNodeType.TPDR.getName();
-            case 2:
+            case Mpdr:
                 return OpenroadmNodeType.MUXPDR.getName();
-            case 3:
+            case Switch:
                 return OpenroadmNodeType.SWITCH.getName();
+            //case Regen:
+            //case RegenUni:
             default:
                 LOG.info("XpdrType {} not supported", xponderType);
-                break;
+                return null;
         }
-        return null;
     }
 
     private void mergeNodeinTopology(Map<NodeKey, Node> nodeMap) {
         // TODO is this merge correct? Should we just merge topology by changing the nodes map??
         // TODO: verify this is correct. Should we identify the context IID with the context UUID??
         LOG.info("Creating tapi node in TAPI topology context");
-        InstanceIdentifier<Topology> topoIID = InstanceIdentifier.builder(Context.class)
-            .augmentation(Context1.class).child(TopologyContext.class)
-            .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
-            .build();
-
-        Topology topology = new TopologyBuilder().setUuid(this.tapiTopoUuid).setNode(nodeMap).build();
-
         // merge in datastore
-        this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, topoIID,
-                topology);
+        this.networkTransactionService.merge(
+            LogicalDatastoreType.OPERATIONAL,
+            InstanceIdentifier.builder(Context.class)
+                .augmentation(Context1.class)
+                .child(TopologyContext.class)
+                .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
+                .build(),
+            new TopologyBuilder().setUuid(this.tapiTopoUuid).setNode(nodeMap).build());
         try {
             this.networkTransactionService.commit().get();
         } catch (InterruptedException | ExecutionException e) {
@@ -1117,16 +1241,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         // TODO is this merge correct? Should we just merge topology by changing the nodes map??
         // TODO: verify this is correct. Should we identify the context IID with the context UUID??
         LOG.info("Creating tapi node in TAPI topology context");
-        InstanceIdentifier<Topology> topoIID = InstanceIdentifier.builder(Context.class)
-            .augmentation(Context1.class).child(TopologyContext.class)
-            .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
-            .build();
-
-        Topology topology = new TopologyBuilder().setUuid(this.tapiTopoUuid).setLink(linkMap).build();
-
         // merge in datastore
-        this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, topoIID,
-                topology);
+        this.networkTransactionService.merge(
+            LogicalDatastoreType.OPERATIONAL,
+            InstanceIdentifier.builder(Context.class)
+                .augmentation(Context1.class)
+                .child(TopologyContext.class)
+                .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
+                .build(),
+            new TopologyBuilder().setUuid(this.tapiTopoUuid).setLink(linkMap).build());
         try {
             this.networkTransactionService.commit().get();
         } catch (InterruptedException | ExecutionException e) {
@@ -1139,12 +1262,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         // TODO is this merge correct? Should we just merge topology by changing the nodes map??
         // TODO: verify this is correct. Should we identify the context IID with the context UUID??
         try {
-            ContextBuilder contextBuilder = new ContextBuilder();
-            contextBuilder.setServiceInterfacePoint(sips);
-            InstanceIdentifier<Context> contextIID = InstanceIdentifier.builder(Context.class).build();
             // merge in datastore
-            this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, contextIID,
-                    contextBuilder.build());
+            this.networkTransactionService.merge(
+                LogicalDatastoreType.OPERATIONAL,
+                InstanceIdentifier.builder(Context.class).build(),
+                new ContextBuilder().setServiceInterfacePoint(sips).build());
             this.networkTransactionService.commit().get();
             LOG.info("TAPI SIPs merged successfully.");
         } catch (InterruptedException | ExecutionException e) {
@@ -1153,12 +1275,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private void deleteLinkFromTopo(Uuid linkUuid) {
-        // TODO: check if this IID is correct
         try {
-            InstanceIdentifier<Link> linkIID = InstanceIdentifier.builder(Context.class)
-                .augmentation(Context1.class).child(TopologyContext.class).child(Topology.class,
-                    new TopologyKey(this.tapiTopoUuid)).child(Link.class, new LinkKey(linkUuid)).build();
-            this.networkTransactionService.delete(LogicalDatastoreType.OPERATIONAL, linkIID);
+            this.networkTransactionService.delete(
+                LogicalDatastoreType.OPERATIONAL,
+                // TODO: check if this IID is correct
+                InstanceIdentifier.builder(Context.class)
+                    .augmentation(Context1.class)
+                    .child(TopologyContext.class)
+                    .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
+                    .child(Link.class, new LinkKey(linkUuid)).build());
             this.networkTransactionService.commit().get();
             LOG.info("TAPI link deleted successfully.");
         } catch (InterruptedException | ExecutionException e) {
@@ -1167,12 +1292,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private void deleteNodeFromTopo(Uuid nodeUuid) {
-        // TODO: check if this IID is correct
         try {
-            InstanceIdentifier<Node> nodeIDD = InstanceIdentifier.builder(Context.class)
-                .augmentation(Context1.class).child(TopologyContext.class).child(Topology.class,
-                    new TopologyKey(this.tapiTopoUuid)).child(Node.class, new NodeKey(nodeUuid)).build();
-            this.networkTransactionService.delete(LogicalDatastoreType.OPERATIONAL, nodeIDD);
+            this.networkTransactionService.delete(
+                LogicalDatastoreType.OPERATIONAL,
+                // TODO: check if this IID is correct
+                InstanceIdentifier.builder(Context.class)
+                    .augmentation(Context1.class)
+                    .child(TopologyContext.class)
+                    .child(Topology.class, new TopologyKey(this.tapiTopoUuid))
+                    .child(Node.class, new NodeKey(nodeUuid)).build());
             this.networkTransactionService.commit().get();
             LOG.info("TAPI Node deleted successfully.");
         } catch (InterruptedException | ExecutionException e) {
@@ -1183,9 +1311,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     private void deleteSipFromTopo(Uuid sipUuid) {
         // TODO: check if this IID is correct
         try {
-            InstanceIdentifier<ServiceInterfacePoint> sipIID = InstanceIdentifier.builder(Context.class)
-                    .child(ServiceInterfacePoint.class, new ServiceInterfacePointKey(sipUuid)).build();
-            this.networkTransactionService.delete(LogicalDatastoreType.OPERATIONAL, sipIID);
+            this.networkTransactionService.delete(
+                LogicalDatastoreType.OPERATIONAL,
+                InstanceIdentifier.builder(Context.class)
+                    .child(ServiceInterfacePoint.class, new ServiceInterfacePointKey(sipUuid))
+                    .build());
             this.networkTransactionService.commit().get();
             LOG.info("TAPI SIP deleted successfully.");
         } catch (InterruptedException | ExecutionException e) {
@@ -1195,16 +1325,18 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private void updateConnectivityServicesState(Uuid sipUuid, String nodeId) {
         // TODO: check if this IID is correct
-        InstanceIdentifier<ConnectivityContext> connectivitycontextIID = InstanceIdentifier.builder(Context.class)
-            .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.Context1.class)
-            .child(ConnectivityContext.class)
-            .build();
         ConnectivityContext connContext = null;
         try {
             Optional<ConnectivityContext> optConnContext =
-                    this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, connectivitycontextIID)
-                            .get();
-            if (!optConnContext.isPresent()) {
+                this.networkTransactionService.read(
+                        LogicalDatastoreType.OPERATIONAL,
+                        InstanceIdentifier.builder(Context.class)
+                            .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+                                .Context1.class)
+                            .child(ConnectivityContext.class)
+                            .build())
+                    .get();
+            if (optConnContext.isEmpty()) {
                 LOG.error("Couldnt retrieve connectivity context from datastore");
                 return;
             }
@@ -1221,41 +1353,46 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         Map<ConnectivityServiceKey, ConnectivityService> connServMap = connContext.getConnectivityService();
         Map<ConnectionKey, Connection> connMap = connContext.getConnection();
         if (connServMap != null) {
-            for (ConnectivityService service:connServMap.values()) {
+            for (ConnectivityService service : connServMap.values()) {
                 Map<EndPointKey, EndPoint> serviceEndPoints = service.getEndPoint();
-                if (serviceEndPoints.values().stream().anyMatch(endPoint -> endPoint.getServiceInterfacePoint()
-                    .getServiceInterfacePointUuid().equals(sipUuid))) {
+                if (serviceEndPoints.values().stream()
+                            .anyMatch(endPoint -> endPoint.getServiceInterfacePoint().getServiceInterfacePointUuid()
+                        .equals(sipUuid))) {
                     LOG.info("Service using SIP of node {} identified. Update state of service", nodeId);
-                    ConnectivityService updService = new ConnectivityServiceBuilder(service)
-                        .setAdministrativeState(AdministrativeState.LOCKED)
-                        .setOperationalState(OperationalState.DISABLED)
-                        .setLifecycleState(LifecycleState.PENDINGREMOVAL)
-                        .build();
-                    updateConnectivityService(updService);
+                    updateConnectivityService(
+                        new ConnectivityServiceBuilder(service)
+                            .setAdministrativeState(AdministrativeState.LOCKED)
+                            .setOperationalState(OperationalState.DISABLED)
+                            .setLifecycleState(LifecycleState.PENDINGREMOVAL)
+                            .build());
                 }
             }
         }
         // Update state of connections
-        if (connMap != null) {
-            for (Connection connection:connMap.values()) {
-                if (connection.getName().values().stream().anyMatch(name -> name.getValue().contains(nodeId))) {
-                    Connection updConn = new ConnectionBuilder(connection)
+        if (connMap == null) {
+            return;
+        }
+        for (Connection connection:connMap.values()) {
+            if (connection.getName().values().stream().anyMatch(name -> name.getValue().contains(nodeId))) {
+                updateConnection(
+                    new ConnectionBuilder(connection)
                         .setLifecycleState(LifecycleState.PENDINGREMOVAL)
                         .setOperationalState(OperationalState.DISABLED)
-                        .build();
-                    updateConnection(updConn);
-                }
+                        .build());
             }
         }
     }
 
     private void updateConnection(Connection updConn) {
-        // TODO: check if this IID is correct
-        InstanceIdentifier<Connection> connectionIID = InstanceIdentifier.builder(Context.class)
+        this.networkTransactionService.merge(
+            LogicalDatastoreType.OPERATIONAL,
+            // TODO: check if this IID is correct
+            InstanceIdentifier.builder(Context.class)
                 .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.Context1.class)
-                .child(ConnectivityContext.class).child(Connection.class,
-                        new ConnectionKey(updConn.getUuid())).build();
-        this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, connectionIID, updConn);
+                .child(ConnectivityContext.class)
+                .child(Connection.class, new ConnectionKey(updConn.getUuid()))
+                .build(),
+            updConn);
         try {
             this.networkTransactionService.commit().get();
         } catch (InterruptedException | ExecutionException e) {
@@ -1264,16 +1401,231 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private void updateConnectivityService(ConnectivityService updService) {
-        // TODO: check if this IID is correct
-        InstanceIdentifier<ConnectivityService> connectivityserviceIID = InstanceIdentifier.builder(Context.class)
-                .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.Context1.class)
-                .child(ConnectivityContext.class).child(ConnectivityService.class,
-                        new ConnectivityServiceKey(updService.getUuid())).build();
-        this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, connectivityserviceIID, updService);
+        this.networkTransactionService.merge(
+                LogicalDatastoreType.OPERATIONAL,
+                // TODO: check if this IID is correct
+                InstanceIdentifier.builder(Context.class)
+                    .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121
+                        .Context1.class)
+                    .child(ConnectivityContext.class)
+                    .child(ConnectivityService.class, new ConnectivityServiceKey(updService.getUuid()))
+                    .build(),
+                updService);
         try {
             this.networkTransactionService.commit().get();
         } catch (InterruptedException | ExecutionException e) {
             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
+            // PHOTONIC MEDIA nep
+            String nepNameValue = String.join("+", nodeId, nepPhotonicSublayer, entry.getKey());
+            LOG.debug("PHOTO NEP = {}", nepNameValue);
+            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 (entry.getValue().getTpType()) {
+                    // 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 * 1E12,
+                                GridConstant.START_EDGE_FREQUENCY * 1E12
+                                + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E09);
+                        } else {
+                            LOG.debug("EnteringLOOPcreateOTSiMC & MC with usedFreqMap non empty {} for Node {}, tp {}",
+                                usedFreqMap, nodeId, tpMap);
+                            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,
+                    String.join("+", nodeId, nepPhotonicSublayer));
+            }
+            Name nepName =
+                new NameBuilder().setValueName(nepPhotonicSublayer + "NodeEdgePoint").setValue(nepNameValue).build();
+            OwnedNodeEdgePoint onep = onepBd
+                .setUuid(new Uuid(UUID.nameUUIDFromBytes(nepNameValue.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(entry.getValue().getAdministrativeState().getName()))
+                .setOperationalState(
+                    this.tapiLink.setTapiOperationalState(entry.getValue().getOperationalState().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.debug("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.debug("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.debug("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);
+            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;
+        }
+    }
+
 }