Adapt TransportPCE code to Sulfur
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / topology / TapiNetworkModelServiceImpl.java
index deb9fc40c5ca4d01e6dd0aa2bd4a356609c0c6ad..c41b17b3ddc8a8b59000f079125d24e7be0af134 100644 (file)
@@ -9,13 +9,14 @@ package org.opendaylight.transportpce.tapi.topology;
 
 import java.nio.charset.Charset;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
 import java.util.stream.Collectors;
@@ -24,31 +25,22 @@ import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.tapi.R2RTapiLinkDiscovery;
 import org.opendaylight.transportpce.tapi.TapiStringConstants;
 import org.opendaylight.transportpce.tapi.utils.TapiLink;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.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.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.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;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityKey;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If100GE;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If100GEODU4;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If10GE;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If10GEODU2;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If10GEODU2e;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If1GE;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If1GEODU0;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.IfOCH;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.IfOCHOTU4ODU4;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.SupportedIfCapability;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.OduSwitchingPools;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmNodeType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev191129.SwitchingPoolTypes;
 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.topology.rev180226.TpId;
@@ -244,10 +236,11 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .getBytes(Charset.forName("UTF-8"))).toString());
         Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(
             String.join("+", nodeId, TapiStringConstants.DSR)).build();
-        List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR,
-            LayerProtocolName.ODU);
-        Node dsrNode = createTapiXpdrNode(Map.of(nameDsr.key(), nameDsr), dsrLayerProtocols,
-            nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool);
+        Name nameNodeType = new NameBuilder().setValueName("Node Type")
+            .setValue(getNodeType(xponderType)).build();
+        Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU);
+        Node dsrNode = createTapiXpdrNode(Map.of(nameDsr.key(), nameDsr, nameNodeType.key(), nameNodeType),
+            dsrLayerProtocols, nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool);
 
         nodeMap.put(dsrNode.key(), dsrNode);
 
@@ -257,9 +250,9 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .getBytes(Charset.forName("UTF-8"))).toString());
         Name nameOtsi =  new NameBuilder().setValueName("otsi node name").setValue(
             String.join("+", nodeId, TapiStringConstants.OTSI)).build();
-        List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
-        Node otsiNode = createTapiXpdrNode(Map.of(nameOtsi.key(), nameOtsi), otsiLayerProtocols,
-            nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null);
+        Set<LayerProtocolName> otsiLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
+        Node otsiNode = createTapiXpdrNode(Map.of(nameOtsi.key(), nameOtsi, nameNodeType.key(), nameNodeType),
+            otsiLayerProtocols, nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null);
 
         nodeMap.put(otsiNode.key(), otsiNode);
 
@@ -278,7 +271,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         switch (xpdrType) {
             case 1:
                 // Tpdr
-                return createTpdrSwitchPool();
+                return createTpdrSwitchPool(xpdrNetMaps);
             case 2:
                 // Mux
                 return createMuxSwitchPool(xpdrClMaps, xpdrNetMaps, xpdrNb);
@@ -426,7 +419,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         }
     }
 
-    private Node createTapiXpdrNode(Map<NameKey, Name> nameMap, List<LayerProtocolName> layerProtocols,
+    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<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
@@ -502,10 +495,12 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
+            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+                    new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
+
             OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
-                true, String.join("+", nodeId, TapiStringConstants.I_OTSI),
-                xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                true, String.join("+", nodeId, TapiStringConstants.I_OTSI), newSupIfCapList,
                 transformOperState(xpdrNetMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -521,10 +516,12 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
+            List<Class<? extends 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,
-                false, String.join("+", nodeId, TapiStringConstants.E_OTSI),
-                xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                false, String.join("+", nodeId, TapiStringConstants.E_OTSI), newSupIfCapList,
                 transformOperState(xpdrNetMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -540,10 +537,12 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
+            List<Class<? extends 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.PHTNC_MEDIA),
-                xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                false, String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA), newSupIfCapList,
                 transformOperState(xpdrNetMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -571,10 +570,12 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 name = nameBldr.setValueName("NodeEdgePoint_C").build();
             }
 
+            List<Class<? extends 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),
-                xpdrClMaps.get(i).getSupportedInterfaceCapability(),
+                String.join("+", nodeId, TapiStringConstants.DSR), newSupIfCapList,
                 transformOperState(xpdrClMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -592,11 +593,13 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
+            List<Class<? extends 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),
-                xpdrNetMaps.get(i).getSupportedInterfaceCapability(),
+                String.join("+", nodeId, TapiStringConstants.I_ODU), newSupIfCapList,
                 transformOperState(xpdrNetMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrNetMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -614,11 +617,13 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrClMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
+            List<Class<? extends 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, false,
-                String.join("+", nodeId, TapiStringConstants.E_ODU),
-                xpdrClMaps.get(i).getSupportedInterfaceCapability(),
+                String.join("+", nodeId, TapiStringConstants.E_ODU), newSupIfCapList,
                 transformOperState(xpdrClMaps.get(i).getPortOperState()),
                 transformAdminState(xpdrClMaps.get(i).getPortAdminState()));
             onepl.put(onep.key(), onep);
@@ -675,7 +680,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setUuid(nepUuid)
             .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
             .setName(Map.of(nepName.key(), nepName))
-            .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+            .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
             .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
             .setAdministrativeState(adminState).setOperationalState(operState)
             .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
@@ -694,7 +699,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .setUuid(nepUuid1)
                 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
                 .setName(Map.of(nepName1.key(), nepName1))
-                .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
                 .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
                 .setAdministrativeState(adminState).setOperationalState(operState)
                 .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
@@ -719,7 +724,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setUuid(nepUuid2)
             .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
             .setName(Map.of(nepName2.key(), nepName2))
-            .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+            .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
             .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
             .setAdministrativeState(adminState).setOperationalState(operState)
             .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
@@ -779,8 +784,10 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         // Names
         Name nodeNames =  new NameBuilder().setValueName("roadm node name")
             .setValue(String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA)).build();
+        Name nameNodeType = new NameBuilder().setValueName("Node Type")
+            .setValue(OpenroadmNodeType.ROADM.getName()).build();
         // Protocol Layer
-        List<LayerProtocolName> layerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
+        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")
@@ -796,7 +803,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .build();
         return new NodeBuilder()
             .setUuid(nodeUuid)
-            .setName(Map.of(nodeNames.key(), nodeNames))
+            .setName(Map.of(nodeNames.key(), nodeNames, nameNodeType.key(), nameNodeType))
             .setLayerProtocolName(layerProtocols)
             .setAdministrativeState(AdministrativeState.UNLOCKED)
             .setOperationalState(OperationalState.ENABLED)
@@ -851,9 +858,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             Link transiLink = tapiLink.createTapiLink(nodeId, mapping.getLogicalConnectionPoint(), nodeId,
                 mapping.getLogicalConnectionPoint(), TapiStringConstants.TRANSITIONAL_LINK, TapiStringConstants.DSR,
                 TapiStringConstants.OTSI, TapiStringConstants.I_ODU, TapiStringConstants.I_OTSI,
-                "inService", "inService", Arrays.asList(LayerProtocolName.ODU,
-                    LayerProtocolName.PHOTONICMEDIA),
-                Arrays.asList(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
+                "inService", "inService", Set.of(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA),
+                Set.of(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
                 this.tapiTopoUuid);
             linkMap.put(transiLink.key(), transiLink);
         }
@@ -861,13 +867,33 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         return linkMap;
     }
 
-    private OduSwitchingPools createTpdrSwitchPool() {
-        return new OduSwitchingPoolsBuilder().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);
+            NonBlockingList nbl = new NonBlockingListBuilder()
+                .setNblNumber(Uint16.valueOf(count))
+                .setTpList(tpList)
+                .build();
+            nblMap.put(nbl.key(), nbl);
+            count++;
+        }
+        return new OduSwitchingPoolsBuilder()
+            .setNonBlockingList(nblMap)
+            .setSwitchingPoolNumber(Uint16.valueOf(1))
+            .build();
     }
 
     private OduSwitchingPools createSwtchSwitchPool(List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
                                                     Integer xpdrNb) {
-        List<TpId> tpl = new ArrayList<>();
+        Set<TpId> tpl = new HashSet<>();
         TpId tpId = null;
         for (int i = 1; i <= xpdrClMaps.size(); i++) {
             tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i);
@@ -894,7 +920,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     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++) {
-            List<TpId> tpList = new ArrayList<>();
+            Set<TpId> tpList = new HashSet<>();
             TpId tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i);
             tpList.add(tpId);
             tpId = new TpId("XPDR" + xpdrNb + "-NETWORK1");
@@ -955,7 +981,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .build();
             RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
                 .setRiskCharacteristicName("risk characteristic")
-                .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
+                .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
                 .build();
             NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
                 .setUuid(new Uuid(
@@ -980,7 +1006,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                                                                                        OwnedNodeEdgePoint> onepl) {
         // create NodeRuleGroup
         if (oorOduSwitchingPool == null) {
-            LOG.info("TPDR node --> no switching pool");
+            LOG.info("No switching pool created for node = {}", nodeId);
             return new HashMap<>();
         }
         LOG.info("ONEPL = {}", onepl.values());
@@ -1031,7 +1057,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .build();
             RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
                 .setRiskCharacteristicName("risk characteristic")
-                .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
+                .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
                 .build();
             NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
                 .setUuid(new Uuid(
@@ -1049,21 +1075,21 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         return nodeRuleGroupMap;
     }
 
-    private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(
+    private Set<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(
             List<Class<? extends SupportedIfCapability>> sicList, LayerProtocolName lpn) {
         if (sicList == null) {
-            return List.of(PHOTONICLAYERQUALIFIEROMS.class);
+            return Set.of(PHOTONICLAYERQUALIFIEROMS.class);
         }
         Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
         LOG.info("SIC list = {}", sicList);
         for (Class<? extends SupportedIfCapability> supInterCapa : sicList) {
             SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
-                    .withKey(new SupportedInterfaceCapabilityKey(convertSupIfCapa(supInterCapa)))
-                    .setIfCapType(convertSupIfCapa(supInterCapa))
+                    .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
+                    .setIfCapType(supInterCapa)
                     .build();
             supIfMap.put(supIfCapa.key(), supIfCapa);
         }
-        List<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new ArrayList<>();
+        Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new HashSet<>();
         for (SupportedInterfaceCapability sic : supIfMap.values()) {
             switch (lpn.getName()) {
                 case "DSR":
@@ -1141,31 +1167,19 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         return sclpqList;
     }
 
-    private static Class<? extends SupportedIfCapability> convertSupIfCapa(Class<? extends
-            SupportedIfCapability> ifCapType) {
-        LOG.info("Interface Capability type = {}", ifCapType.getSimpleName());
-        switch (ifCapType.getSimpleName()) {
-            case "If100GEODU4":
-                return If100GEODU4.class;
-            case "IfOCHOTU4ODU4":
-                return IfOCHOTU4ODU4.class;
-            case "If1GEODU0":
-                return If1GEODU0.class;
-            case "If10GEODU2e":
-                return If10GEODU2e.class;
-            case "If10GEODU2":
-                return If10GEODU2.class;
-            case "If100GE":
-                return If100GE.class;
-            case "If10GE":
-                return If10GE.class;
-            case "If1GE":
-                return If1GE.class;
-            case "IfOCH":
-                return IfOCH.class;
+    private String getNodeType(XpdrNodeTypes xponderType) {
+        switch (xponderType.getIntValue()) {
+            case 1:
+                return OpenroadmNodeType.TPDR.getName();
+            case 2:
+                return OpenroadmNodeType.MUXPDR.getName();
+            case 3:
+                return OpenroadmNodeType.SWITCH.getName();
             default:
-                return null;
+                LOG.info("XpdrType {} not supported", xponderType);
+                break;
         }
+        return null;
     }
 
     private void mergeNodeinTopology(Map<NodeKey, Node> nodeMap) {
@@ -1353,5 +1367,4 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             LOG.error("Error committing into datastore", e);
         }
     }
-
 }