Remove SupportedIfCapability conversion from TAPI 47/100447/3
authorGilles Thouenon <gilles.thouenon@orange.com>
Thu, 7 Apr 2022 11:55:04 +0000 (13:55 +0200)
committerGilles Thouenon <gilles.thouenon@orange.com>
Thu, 2 Jun 2022 11:47:18 +0000 (11:47 +0000)
With change https://git.opendaylight.org/gerrit/c/transportpce/+/100135,
conversions of SupportedIfCapability should have been removed.
Remove useless conversion methods.

JIRA: TRNSPRTPCE-644
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Ic4f885e4a8e45ff34496e27e20397dafc2975c53

tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiNetworkModelServiceImpl.java

index 15263b06ba32c9650dc214c0de643696756965ad..603612eab2b5d5c5d02d0f681149d60b7c6d608f 100644 (file)
@@ -39,15 +39,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.O
 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.If100GE;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If100GEODU4;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GE;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GEODU2;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GEODU2e;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If1GE;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If1GEODU0;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCH;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU4ODU4;
 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;
@@ -504,7 +495,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            ArrayList<Class<? extends SupportedIfCapability>> newSupIfCapList = convertSupIfCapaList(xpdrNetMaps, i);
+            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+                xpdrNetMaps.get(i).getSupportedInterfaceCapability();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
@@ -524,7 +516,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            ArrayList<Class<? extends SupportedIfCapability>> newSupIfCapList = convertSupIfCapaList(xpdrNetMaps, i);
+            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+                xpdrNetMaps.get(i).getSupportedInterfaceCapability();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
@@ -544,7 +537,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            ArrayList<Class<? extends SupportedIfCapability>> newSupIfCapList = convertSupIfCapaList(xpdrNetMaps, i);
+            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+                xpdrNetMaps.get(i).getSupportedInterfaceCapability();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
@@ -576,7 +570,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 name = nameBldr.setValueName("NodeEdgePoint_C").build();
             }
 
-            ArrayList<Class<? extends SupportedIfCapability>> newSupIfCapList = convertSupIfCapaList(xpdrClMaps, i);
+            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+                xpdrClMaps.get(i).getSupportedInterfaceCapability();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
@@ -598,7 +593,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            ArrayList<Class<? extends SupportedIfCapability>> newSupIfCapList = convertSupIfCapaList(xpdrNetMaps, i);
+            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+                xpdrNetMaps.get(i).getSupportedInterfaceCapability();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName),
@@ -621,7 +617,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrClMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            ArrayList<Class<? extends SupportedIfCapability>> newSupIfCapList = convertSupIfCapaList(xpdrClMaps, i);
+            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+                xpdrClMaps.get(i).getSupportedInterfaceCapability();
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
                 Map.of(onedName.key(), onedName),
@@ -1088,8 +1085,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         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);
         }
@@ -1171,33 +1168,6 @@ 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;
-            default:
-                return null;
-        }
-    }
-
     private String getNodeType(XpdrNodeTypes xponderType) {
         switch (xponderType.getIntValue()) {
             case 1:
@@ -1398,13 +1368,4 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             LOG.error("Error committing into datastore", e);
         }
     }
-
-    private ArrayList<Class<? extends SupportedIfCapability>> convertSupIfCapaList(List<Mapping> xpdrNetMaps,
-            int index) {
-        ArrayList<Class<? extends SupportedIfCapability>> newSupIfCapList = new ArrayList<Class<? extends
-            SupportedIfCapability>>();
-        xpdrNetMaps.get(index).getSupportedInterfaceCapability()
-            .forEach(a -> newSupIfCapList.add(xpdrNetMaps.get(index).getSupportedInterfaceCapability().get(0)));
-        return newSupIfCapList;
-    }
 }