Merge "Fix functional tests 2.2.1 sequence"
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / topology / TapiNetworkModelServiceImpl.java
index 37ed3914aac715e3dea3c3d608d4dff72b499557..eee0ba1fbeb8ef921ca1a43f524a6ae21f743f92 100644 (file)
@@ -24,8 +24,10 @@ import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.tapi.R2RTapiLinkDiscovery;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.mapping.Mapping;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.network.Nodes;
+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.rev200327.xpdr.odu.switching.pools.OduSwitchingPools;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
@@ -82,6 +84,8 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18121
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPEGigE;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
@@ -203,6 +207,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             // create tapi Node
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.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
 
@@ -210,8 +216,6 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             LOG.info("checking if neighbor roadm exists");
             Map<LinkKey, Link> rdm2rdmLinks = this.linkDiscovery.readLLDP(new NodeId(orNodeId), orNodeVersion,
                 this.tapiTopoUuid);
-            mergeNodeinTopology(Map.of(roadmNode.key(), roadmNode));
-            mergeSipsinContext(this.sipMap);
             if (!rdm2rdmLinks.isEmpty()) {
                 mergeLinkinTopology(rdm2rdmLinks);
             }
@@ -239,9 +243,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
                     // node transformation
                     Map<NodeKey, Node> nodeMap = new HashMap<>(transformXpdrToTapiNode(
-                        nodeId, xpdrClMaps, xpdrNetMaps, mapping.getXponderType(), oorOduSwitchingPool,
-                        mapping.getSupportedInterfaceCapability()));
-
+                        nodeId, xpdrClMaps, xpdrNetMaps, mapping.getXponderType(), oorOduSwitchingPool));
                     // add nodes and sips to tapi context
                     mergeNodeinTopology(nodeMap);
                     mergeSipsinContext(this.sipMap);
@@ -253,9 +255,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private Map<NodeKey, Node> transformXpdrToTapiNode(String nodeId, List<Mapping> xpdrClMaps,
                                                        List<Mapping> xpdrNetMaps, XpdrNodeTypes xponderType,
-                                                       OduSwitchingPools oorOduSwitchingPool,
-                                                       List<Class<? extends SupportedIfCapability>>
-                                                           supportedInterfaceCapability) {
+                                                       OduSwitchingPools oorOduSwitchingPool) {
         Map<NodeKey, Node> nodeMap = new HashMap<>();
         LOG.info("creation of a DSR/ODU node for {}", nodeId);
         Uuid nodeUuidDsr = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, DSR))
@@ -266,8 +266,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             LayerProtocolName.ODU);
         org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
             .Node dsrNode = createTapiXpdrNode(Map.of(nameDsr.key(), nameDsr), dsrLayerProtocols,
-            nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool,
-            supportedInterfaceCapability);
+            nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool);
 
         nodeMap.put(dsrNode.key(), dsrNode);
 
@@ -280,8 +279,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
         org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
             .Node otsiNode = createTapiXpdrNode(Map.of(nameOtsi.key(), nameOtsi), otsiLayerProtocols,
-            nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null,
-            supportedInterfaceCapability);
+            nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null);
 
         nodeMap.put(otsiNode.key(), otsiNode);
 
@@ -324,7 +322,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     continue;
                 }
                 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> srgNeps =
-                    createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), true);
+                    createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), true,
+                            transformOperState(m.getPortOperState()), transformAdminState(m.getPortAdminState()));
                 onepMap.putAll(srgNeps);
             }
         }
@@ -342,7 +341,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     continue;
                 }
                 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> degNeps =
-                    createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), false);
+                    createRoadmNeps(orNodeId, m.getLogicalConnectionPoint(), false,
+                            transformOperState(m.getPortOperState()), transformAdminState(m.getPortAdminState()));
                 onepMap.putAll(degNeps);
             }
         }
@@ -448,8 +448,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private Node createTapiXpdrNode(Map<NameKey, Name> nameMap, List<LayerProtocolName> layerProtocols,
                                     String nodeId, Uuid nodeUuid, List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
-                                    XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool,
-                                    List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+                                    XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) {
         Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
         Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
         Map<RuleKey, Rule> ruleList = new HashMap<>();
@@ -462,13 +461,13 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         if (layerProtocols.contains(LayerProtocolName.DSR)) {
             // neps for dsr/odu layer
             Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> dsroduNeps =
-                    createXpdrDsrOduNeps(nodeId, xpdrClMaps, xpdrNetMaps, xponderType, supportedInterfaceCapability);
+                    createXpdrDsrOduNeps(nodeId, xpdrClMaps, xpdrNetMaps, xponderType);
             onepl.putAll(dsroduNeps);
             nodeRuleGroupList = createNodeRuleGroupForDsrNode(nodeId, oorOduSwitchingPool, ruleList, onepl);
         } else if (layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
             // neps for photonic layer
             Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> phtmdNeps =
-                    createXpdrPhtnMdNeps(nodeId, xpdrNetMaps, supportedInterfaceCapability);
+                    createXpdrPhtnMdNeps(nodeId, xpdrNetMaps);
             onepl.putAll(phtmdNeps);
             nodeRuleGroupList = createNodeRuleGroupForOtsiNode(nodeId, xpdrNetMaps, ruleList);
         } else {
@@ -509,7 +508,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrPhtnMdNeps(String nodeId,
-            List<Mapping> xpdrNetMaps, List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+                                                                                List<Mapping> xpdrNetMaps) {
         Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
 
         // iNep creation on otsi node
@@ -524,8 +523,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     .build();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                    Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                    true, String.join("+", nodeId, I_OTSI), supportedInterfaceCapability);
+                Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
+                true, String.join("+", nodeId, I_OTSI),
+                xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+                transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
         }
         // eNep creation on otsi node
@@ -539,8 +541,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     .build();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                    Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                    false, String.join("+", nodeId, E_OTSI), supportedInterfaceCapability);
+                Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
+                false, String.join("+", nodeId, E_OTSI),
+                xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+                transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
         }
         // Photonic Media Nep creation on otsi node
@@ -554,16 +559,19 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     .build();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                    Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                    false, String.join("+", nodeId, PHTNC_MEDIA), supportedInterfaceCapability);
+                Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
+                false, String.join("+", nodeId, PHTNC_MEDIA),
+                xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+                transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
         }
         return onepl;
     }
 
     private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createXpdrDsrOduNeps(String nodeId, List<Mapping> xpdrClMaps,
-            List<Mapping> xpdrNetMaps, XpdrNodeTypes xponderType,
-            List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+                                                                                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++) {
@@ -581,8 +589,10 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             }
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
-                    Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
-                    String.join("+", nodeId, DSR), supportedInterfaceCapability);
+                Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
+                String.join("+", nodeId, DSR), xpdrClMaps.get(i).getSupportedInterfaceCapability(),
+                transformOperState(xpdrClMaps.get(i).getPortOperState()),
+                transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
         }
         // network nep creation on I_ODU node
@@ -597,14 +607,17 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     .build();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                    Map.of(onedName.key(), onedName),
-                    LayerProtocolName.ODU, LayerProtocolName.DSR, false,
-                    String.join("+", nodeId, I_ODU), supportedInterfaceCapability);
+                Map.of(onedName.key(), onedName),
+                LayerProtocolName.ODU, LayerProtocolName.DSR, false,
+                String.join("+", nodeId, I_ODU), xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+                transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
         }
         // network nep creation on E_ODU node
         for (int i = 0; i < xpdrNetMaps.size(); i++) {
-            LOG.info("eODU NEP = {}", String.join("+", nodeId, E_ODU, xpdrNetMaps.get(i).getLogicalConnectionPoint()));
+            LOG.info("eODU NEP = {}", String.join("+", nodeId, E_ODU,
+                xpdrNetMaps.get(i).getLogicalConnectionPoint()));
             Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
                     (String.join("+", nodeId, E_ODU, xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                             .getBytes(Charset.forName("UTF-8"))).toString());
@@ -614,57 +627,72 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     .build();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
-                    Map.of(onedName.key(), onedName),
-                    LayerProtocolName.ODU, LayerProtocolName.DSR, true,
-                    String.join("+", nodeId, E_ODU), supportedInterfaceCapability);
+                Map.of(onedName.key(), onedName),
+                LayerProtocolName.ODU, LayerProtocolName.DSR, true,
+                String.join("+", nodeId, E_ODU), xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                transformOperState(xpdrNetMaps.get(i).getPortOperState()),
+                transformAdminState(xpdrNetMaps.get(i).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;
+    }
+
+    private AdministrativeState transformAdminState(String adminString) {
+        AdminStates adminState = org.opendaylight.transportpce.networkmodel.util.TopologyUtils
+                .setNetworkAdminState(adminString);
+        return adminState.equals(AdminStates.InService) ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
+    }
+
     private OwnedNodeEdgePoint createNep(Uuid nepUuid, String tpid, Map<NameKey, Name> nepNames,
                                          LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
                                          String keyword,
-                                         List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+                                         List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+                                         OperationalState operState, AdministrativeState adminState) {
         OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
                 .setUuid(nepUuid)
                 .setLayerProtocolName(nepProtocol)
                 .setName(nepNames);
         if (withSip) {
             onepBldr.setMappedServiceInterfacePoint(createMSIP(1, nepProtocol, tpid, keyword,
-                    supportedInterfaceCapability));
+                    supportedInterfaceCapability, operState, adminState));
         }
         LOG.debug("Node layer {}", nodeProtocol.getName());
         onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedLayerProtocolQualifier(
                 supportedInterfaceCapability, nodeProtocol));
         onepBldr.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
-                .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
+                .setAdministrativeState(adminState).setOperationalState(operState)
                 .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
                 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
         return onepBldr.build();
     }
 
     private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createRoadmNeps(String orNodeId, String tpId,
-                                                                           boolean withSip) {
+                                                                           boolean withSip, OperationalState operState,
+                                                                           AdministrativeState adminState) {
         Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
         // PHOTONIC MEDIA nep
         Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, PHTNC_MEDIA, tpId))
                 .getBytes(Charset.forName("UTF-8")))
                 .toString());
         Name nepName = new NameBuilder()
-                .setValueName("NodeEdgePoint name")
+                .setValueName(PHTNC_MEDIA + "NodeEdgePoint")
                 .setValue(String.join("+", orNodeId, PHTNC_MEDIA, tpId))
                 .build();
-        OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
-                .setUuid(nepUuid)
-                .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
-                .setName(Map.of(nepName.key(), nepName))
-                .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
-                .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
-                .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
-                .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
-                .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
-        OwnedNodeEdgePoint onep = onepBldr.build();
+        OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
+            .setUuid(nepUuid)
+            .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+            .setName(Map.of(nepName.key(), nepName))
+            .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+            .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
+            .setAdministrativeState(adminState).setOperationalState(operState)
+            .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+            .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+            .build();
         onepMap.put(onep.key(), onep);
 
         // MC nep
@@ -672,7 +700,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .getBytes(Charset.forName("UTF-8")))
                 .toString());
         Name nepName1 = new NameBuilder()
-                .setValueName("NodeEdgePoint name")
+                .setValueName(MC + "NodeEdgePoint")
                 .setValue(String.join("+", orNodeId, MC, tpId))
                 .build();
         OwnedNodeEdgePointBuilder onepBldr1 = new OwnedNodeEdgePointBuilder()
@@ -681,12 +709,12 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .setName(Map.of(nepName1.key(), nepName1))
                 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
                 .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
-                .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
+                .setAdministrativeState(adminState).setOperationalState(operState)
                 .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
                 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
         if (withSip) {
             onepBldr1.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
-                    tpId, String.join("+", orNodeId, MC), null));
+                    tpId, String.join("+", orNodeId, MC), null, operState, adminState));
         }
         OwnedNodeEdgePoint onep1 = onepBldr1.build();
         onepMap.put(onep1.key(), onep1);
@@ -696,26 +724,28 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .getBytes(Charset.forName("UTF-8")))
                 .toString());
         Name nepName2 = new NameBuilder()
-                .setValueName("NodeEdgePoint name")
+                .setValueName(OTSI_MC + "NodeEdgePoint")
                 .setValue(String.join("+", orNodeId, OTSI_MC, tpId))
                 .build();
-        OwnedNodeEdgePointBuilder onepBldr2 = new OwnedNodeEdgePointBuilder()
-                .setUuid(nepUuid2)
-                .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
-                .setName(Map.of(nepName2.key(), nepName2))
-                .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
-                .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
-                .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
-                .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
-                .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
-        OwnedNodeEdgePoint onep2 = onepBldr2.build();
+
+        OwnedNodeEdgePoint onep2 = new OwnedNodeEdgePointBuilder()
+            .setUuid(nepUuid2)
+            .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+            .setName(Map.of(nepName2.key(), nepName2))
+            .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+            .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
+            .setAdministrativeState(adminState).setOperationalState(operState)
+            .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+            .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+            .build();
         onepMap.put(onep2.key(), onep2);
         return onepMap;
     }
 
-    private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(int nb,
-                                            LayerProtocolName layerProtocol, String tpid, String nodeid,
-                                            List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+    private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint>
+            createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
+                   List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+                   OperationalState operState, AdministrativeState adminState) {
         Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
         for (int i = 0; i < nb; i++) {
             Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeid,
@@ -723,7 +753,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
                     .setServiceInterfacePointUuid(sipUuid).build();
             org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePoint sip
-                    = createSIP(sipUuid, layerProtocol, tpid, nodeid, supportedInterfaceCapability);
+                    = createSIP(sipUuid, layerProtocol, tpid, nodeid, supportedInterfaceCapability,
+                    operState, adminState);
             this.sipMap.put(sip.key(), sip);
             LOG.info("SIP created {}", sip.getUuid());
             // this.tapiSips.put(sip.key(), sip);
@@ -733,7 +764,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpid, String nodeid,
-                                            List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability) {
+                                            List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+                                            OperationalState operState, AdministrativeState adminState) {
         // TODO: what value should be set in total capacity and available capacity
         LOG.info("SIP name = {}", String.join("+", nodeid, tpid));
         Name sipName = new NameBuilder()
@@ -744,8 +776,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .setUuid(sipUuid)
                 .setName(Map.of(sipName.key(), sipName))
                 .setLayerProtocolName(layerProtocol)
-                .setAdministrativeState(AdministrativeState.UNLOCKED)
-                .setOperationalState(OperationalState.ENABLED)
+                .setAdministrativeState(adminState)
+                .setOperationalState(operState)
                 .setLifecycleState(LifecycleState.INSTALLED)
                 .setAvailableCapacity(new AvailableCapacityBuilder().build())
                 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
@@ -785,7 +817,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setOperationalState(OperationalState.ENABLED)
             .setLifecycleState(LifecycleState.INSTALLED)
             .setOwnedNodeEdgePoint(oneplist)
-            .setNodeRuleGroup(createNodeRuleGroupForRdmNode(nodeUuid, oneplist.values()))
+            .setNodeRuleGroup(createNodeRuleGroupForRdmNode(orNodeId, nodeUuid, oneplist.values()))
             .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
             .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
             .setErrorCharacteristic("error")
@@ -797,7 +829,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .build();
     }
 
-    private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
+    private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String orNodeId, Uuid nodeUuid,
                                                                                Collection<OwnedNodeEdgePoint> onepl) {
         Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
                 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
@@ -821,7 +853,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .build();
         ruleList.put(rule.key(), rule);
         NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
-                .setUuid(new Uuid(UUID.nameUUIDFromBytes(("rdm infra node rule group")
+                .setUuid(new Uuid(UUID.nameUUIDFromBytes((orNodeId + " node rule group")
                         .getBytes(Charset.forName("UTF-8"))).toString()))
                 .setRule(ruleList)
                 .setNodeEdgePoint(nepMap)
@@ -896,8 +928,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
                     .setRestorationPolicy(RestorationPolicy.NA)
                     .build())
-                .setAdministrativeState(AdministrativeState.UNLOCKED)
-                .setOperationalState(OperationalState.ENABLED)
+                .setAdministrativeState(transformAdminState(mapping.getPortAdminState()))
+                .setOperationalState(transformOperState(mapping.getPortOperState()))
                 .setLifecycleState(LifecycleState.INSTALLED)
                 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
                     new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build())
@@ -1133,6 +1165,12 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 case "DSR":
                 case "ODU":
                     switch (sic.getIfCapType().getSimpleName()) {
+                        // TODO: it may be needed to add more cases clauses if the interface capabilities of a
+                        //  port are extended in the config file
+                        case "If1GEODU0":
+                            sclpqList.add(ODUTYPEODU0.class);
+                            sclpqList.add(DIGITALSIGNALTYPEGigE.class);
+                            break;
                         case "If10GEODU2e":
                             sclpqList.add(ODUTYPEODU2E.class);
                             sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
@@ -1222,7 +1260,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         } catch (InterruptedException | ExecutionException e) {
             LOG.error("Error populating TAPI topology: ", e);
         }
-        LOG.info("Roadm Node added succesfully.");
+        LOG.info("Node added succesfully.");
     }
 
     private void mergeLinkinTopology(Map<LinkKey, Link> linkMap) {