Adapt TransportPCE code to Chlorine 76/101976/8
authorGilles Thouenon <gilles.thouenon@orange.com>
Fri, 5 Aug 2022 16:56:35 +0000 (18:56 +0200)
committerGilles Thouenon <gilles.thouenon@orange.com>
Wed, 7 Sep 2022 10:15:39 +0000 (12:15 +0200)
- remove some no longer existing Optional
- adapt code to new format of SuypportedIfCapability
- replace switch case structure based on string coming from typedef to
  if- else strcuture due to the removal of getSimpleName() method
- all class types are now .VALUE
- adapt unitary tests consequently

Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: I4278e7b7787564542f12575ceb2f5d6fab15446c

42 files changed:
common/src/main/java/org/opendaylight/transportpce/common/crossconnect/CrossConnectImpl.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/MappingUtilsImpl.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion121.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion221.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java
common/src/test/resources/expected_string.json
inventory/src/main/java/org/opendaylight/transportpce/inventory/INode121.java
inventory/src/main/java/org/opendaylight/transportpce/inventory/INode221.java
networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/FrequenciesServiceImpl.java
networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java
networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java
networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java
olm/src/test/java/org/opendaylight/transportpce/olm/service/OlmPowerServiceImplSpanLossBaseTest.java
pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyResult.java
pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyServiceImpl.java
pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyTopoImpl.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceOpticalNode.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceOtnNode.java
pce/src/test/java/org/opendaylight/transportpce/pce/networkanalyzer/PceOtnNodeTest.java
pce/src/test/java/org/opendaylight/transportpce/pce/service/PathComputationServiceImplTest.java
pce/src/test/java/org/opendaylight/transportpce/pce/utils/NodeUtils.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/ModelMappingUtils.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface121.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface221.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface710.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmOtnInterface221.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmOtnInterface710.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListener.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/checks/ServicehandlerServiceResiliencyCheck.java
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListenerTest.java
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/validation/checks/CheckCoherencyServiceResiliencyTest.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/connectivity/ConnectivityUtils.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiPceListenerImpl.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java
tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiNetworkModelServiceImpl.java
tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java
tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopoTest.java
tests/transportpce_tests/2.2.1/test08_otn_sh_renderer.py

index 71af9a89c168655c74b50e1c48d5902d9b321186..108905983d54842b9adf17dc381f67b557c1139d 100644 (file)
@@ -108,16 +108,16 @@ public class CrossConnectImpl implements CrossConnect {
     @Override
     public boolean setPowerLevel(String nodeId, String mode, Decimal64 powerValue, String connectionNumber) {
         String openRoadmVersion = mappingUtils.getOpenRoadmVersion(nodeId);
-        if (OPENROADM_DEVICE_VERSION_1_2_1.equals(openRoadmVersion) && OpticalControlMode.forName(mode).isPresent()) {
-            return crossConnectImpl121.setPowerLevel(nodeId,OpticalControlMode.forName(mode).get(), powerValue,
+        if (OPENROADM_DEVICE_VERSION_1_2_1.equals(openRoadmVersion) && OpticalControlMode.forName(mode) != null) {
+            return crossConnectImpl121.setPowerLevel(nodeId,OpticalControlMode.forName(mode), powerValue,
                 connectionNumber);
         }
         else if (OPENROADM_DEVICE_VERSION_2_2_1.equals(openRoadmVersion)
-            && org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode)
-            .isPresent()) {
+                && org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode
+                    .forName(mode) != null) {
             return crossConnectImpl221.setPowerLevel(nodeId,
-                org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode)
-                .get(), powerValue, connectionNumber);
+                org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode),
+                powerValue, connectionNumber);
         }
         return false;
     }
index d1f7292c3ee4386925326e834b87fde6e2c28aca..c94e26caa412689544e7233a8568053890512f1f 100644 (file)
@@ -7,10 +7,9 @@
  */
 package org.opendaylight.transportpce.common.mapping;
 
+import com.google.common.collect.ImmutableMap;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -27,46 +26,46 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10
 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.If400GE;
 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.IfOCHOTU2EODU2E;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU2ODU2;
 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.IfOTU4ODU4;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOTUCnODUCn;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOtsiOtsigroup;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 public class MappingUtilsImpl implements MappingUtils {
 
     private static final Logger LOG = LoggerFactory.getLogger(MappingUtilsImpl.class);
 
     private final DataBroker dataBroker;
 
-    private static Map<String, Class<? extends SupportedIfCapability>> capTypeClassMap = new HashMap<>() {
-        {
-            put("IfOtsiOtsigroup", IfOtsiOtsigroup.class);
-            put("IfOTUCnODUCn", IfOTUCnODUCn.class);
-            put("IfOCHOTU4ODU4", IfOCHOTU4ODU4.class);
-            put("IfOTU4ODU4", IfOTU4ODU4.class);
-            put("IfOCH", IfOCH.class);
-            put("If100GEODU4", If100GEODU4.class);
-            put("If10GEODU2e", If10GEODU2e.class);
-            put("If10GEODU2", If10GEODU2.class);
-            put("If1GEODU0", If1GEODU0.class);
-            put("If400GE", If400GE.class);
-            put("If100GE", If100GE.class);
-            put("If10GE", If10GE.class);
-            put("If1GE", If1GE.class);
-            put("IfOCHOTU2EODU2E", IfOCHOTU2EODU2E.class);
-            put("IfOCHOTU2ODU2", IfOCHOTU2ODU2.class);
-        }
-    };
+    private static final ImmutableMap<String, SupportedIfCapability> CAP_TYPE_MAP =
+        ImmutableMap.<String, SupportedIfCapability>builder()
+            .put("If400GE{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-400GE}", If400GE.VALUE)
+            .put("IfOtsiOtsigroup{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-otsi-otsigroup}",
+                IfOtsiOtsigroup.VALUE)
+            .put("IfOCH{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-OCH}", IfOCH.VALUE)
+            .put("IfOCHOTU4ODU4{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-OCH-OTU4-ODU4}",
+                IfOCHOTU4ODU4.VALUE)
+            .put("IfOCHOTU4ODU4{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-OCH-OTU4-ODU4}",
+                IfOCHOTU4ODU4.VALUE)
+            .put("If1GEODU0{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-1GE-ODU0}", If1GEODU0.VALUE)
+            .put("If10GE{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-10GE}", If10GE.VALUE)
+            .put("If10GEODU2{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-10GE-ODU2}",
+                If10GEODU2.VALUE)
+            .put("If10GEODU2e{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-10GE-ODU2e}",
+                If10GEODU2e.VALUE)
+            .put("If100GE{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-100GE}", If100GE.VALUE)
+            .put("If100GE{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-100GE}", If100GE.VALUE)
+            .put("If100GEODU4{qname=(http://org/openroadm/port/types?revision=2018-10-19)if-100GE-ODU4}",
+                If100GEODU4.VALUE)
+            .put("If100GEODU4{qname=(http://org/openroadm/port/types?revision=2020-03-27)if-100GE-ODU4}",
+                If100GEODU4.VALUE)
+            .build();
 
     public MappingUtilsImpl(DataBroker dataBroker) {
 
@@ -132,11 +131,11 @@ public class MappingUtilsImpl implements MappingUtils {
         return mcCapabilities;
     }
 
-    public static Class<? extends SupportedIfCapability> convertSupIfCapa(String ifCapType) {
-        if (!capTypeClassMap.containsKey(ifCapType)) {
+    public static SupportedIfCapability convertSupIfCapa(String ifCapType) {
+        if (!CAP_TYPE_MAP.containsKey(ifCapType)) {
             LOG.error("supported-if-capability {} not supported", ifCapType);
             return null;
         }
-        return capTypeClassMap.get(ifCapType);
+        return CAP_TYPE_MAP.get(ifCapType);
     }
 }
index c1cb74097e2af0fde40658c0f5e1a57b98fb0aef..cded0f0779dff2d7e1089aa6dc9ed7a65b0c1b1d 100644 (file)
@@ -621,22 +621,21 @@ public class PortMappingVersion121 {
             }
             LOG.debug(PortMappingUtils.GOT_INTF_LOGMSG,
                 nodeId, openRoadmInterface.get().getName(), openRoadmInterface.get().getType());
-            Class<? extends InterfaceType> interfaceType
-                = (Class<? extends InterfaceType>) openRoadmInterface.get().getType();
+            InterfaceType interfaceType = openRoadmInterface.get().getType();
             // Check if interface type is OMS or OTS
-            if (interfaceType.equals(OpenROADMOpticalMultiplex.class)) {
+            if (interfaceType.equals(OpenROADMOpticalMultiplex.VALUE)) {
                 mpBldr.setSupportingOms(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OpticalTransport.class)) {
+            if (interfaceType.equals(OpticalTransport.VALUE)) {
                 mpBldr.setSupportingOts(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OtnOtu.class)) {
+            if (interfaceType.equals(OtnOtu.VALUE)) {
                 mpBldr.setSupportingOtu4(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OtnOdu.class)) {
+            if (interfaceType.equals(OtnOdu.VALUE)) {
                 mpBldr.setSupportingOdu4(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(EthernetCsmacd.class)) {
+            if (interfaceType.equals(EthernetCsmacd.VALUE)) {
                 mpBldr.setSupportingEthernet(interfaces.getInterfaceName());
             }
         }
@@ -655,8 +654,8 @@ public class PortMappingVersion121 {
 
     private Mapping createNewXpdrMapping(String nodeId, Ports port, String circuitPackName,
             String logicalConnectionPoint, String partnerLcp) {
-        Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
-            .SupportedIfCapability>> supportedIntf = new HashSet<>();
+        Set<org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability> supportedIntf =
+            new HashSet<>();
         for (String sup: getSupIfCapList(port)) {
             if (MappingUtilsImpl.convertSupIfCapa(sup) != null) {
                 supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup));
@@ -687,12 +686,12 @@ public class PortMappingVersion121 {
     }
 
     private List<String> getSupIfCapList(Ports port) {
-        Set<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
+        Set<SupportedIfCapability> supIfCapClassList = port.getSupportedInterfaceCapability();
         return
             supIfCapClassList == null
                 ? Collections.emptyList()
                 : supIfCapClassList
-                    .stream().map(e -> e.getSimpleName())
+                    .stream().map(e -> e.toString())
                     .collect(Collectors.toList());
     }
 
index 420f18f5d3a8b96109d9f584acb8ec6a56ce3485..eac3516d2656bbffdcf85dc16fc6cbdb9ce8c724 100644 (file)
@@ -841,22 +841,21 @@ public class PortMappingVersion221 {
             }
             LOG.debug(PortMappingUtils.GOT_INTF_LOGMSG,
                 nodeId, openRoadmInterface.get().getName(), openRoadmInterface.get().getType());
-            Class<? extends InterfaceType> interfaceType
-                = (Class<? extends InterfaceType>) openRoadmInterface.get().getType();
+            InterfaceType interfaceType = openRoadmInterface.get().getType();
             // Check if interface type is OMS or OTS
-            if (interfaceType.equals(OpenROADMOpticalMultiplex.class)) {
+            if (interfaceType.equals(OpenROADMOpticalMultiplex.VALUE)) {
                 mpBldr.setSupportingOms(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OpticalTransport.class)) {
+            if (interfaceType.equals(OpticalTransport.VALUE)) {
                 mpBldr.setSupportingOts(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OtnOtu.class)) {
+            if (interfaceType.equals(OtnOtu.VALUE)) {
                 mpBldr.setSupportingOtu4(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OtnOdu.class)) {
+            if (interfaceType.equals(OtnOdu.VALUE)) {
                 mpBldr.setSupportingOdu4(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(EthernetCsmacd.class)) {
+            if (interfaceType.equals(EthernetCsmacd.VALUE)) {
                 mpBldr.setSupportingEthernet(interfaces.getInterfaceName());
             }
         }
@@ -875,8 +874,8 @@ public class PortMappingVersion221 {
 
     private Mapping createNewXpdrMapping(String nodeId, Ports port, String circuitPackName,
             String logicalConnectionPoint, String partnerLcp, XpdrNodeTypes xpdrNodeType) {
-        Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
-            .SupportedIfCapability>> supportedIntf = new HashSet<>();
+        Set<org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability> supportedIntf =
+            new HashSet<>();
         for (String sup: getSupIfCapList(port)) {
             if (MappingUtilsImpl.convertSupIfCapa(sup) != null) {
                 supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup));
@@ -911,16 +910,16 @@ public class PortMappingVersion221 {
     }
 
     private List<String> getSupIfCapList(Ports port) {
-        Set<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
+        Set<SupportedIfCapability> supIfCapClassList = port.getSupportedInterfaceCapability();
         if (supIfCapClassList != null) {
             return supIfCapClassList
-                    .stream().map(e -> e.getSimpleName())
+                    .stream().map(e -> e.toString())
                     .collect(Collectors.toList());
         }
         Ports1 ports1 = port.augmentation(Ports1.class);
         if (ports1 != null && ports1.getPortCapabilities() != null) {
             return ports1.getPortCapabilities().getSupportedInterfaceCapability()
-                    .values().stream().map(e -> e.getIfCapType().getSimpleName())
+                    .values().stream().map(e -> e.getIfCapType().toString())
                     .collect(Collectors.toList());
         }
         return Collections.emptyList();
index 474fd72ff1d4e0d4acea293f6e09d60c541d5b7d..1a6985b2192fb9ee16d5c176bccd1f71ba729ff0 100644 (file)
@@ -985,32 +985,31 @@ public class PortMappingVersion710 {
             }
             LOG.debug(PortMappingUtils.GOT_INTF_LOGMSG,
                 nodeId, openRoadmInterface.get().getName(), openRoadmInterface.get().getType());
-            Class<? extends InterfaceType> interfaceType
-                = (Class<? extends InterfaceType>) openRoadmInterface.get().getType();
+            InterfaceType interfaceType = openRoadmInterface.get().getType();
             // Check if interface type is OMS or OTS
-            if (interfaceType.equals(OpenROADMOpticalMultiplex.class)) {
+            if (interfaceType.equals(OpenROADMOpticalMultiplex.VALUE)) {
                 mpBldr.setSupportingOms(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OpticalTransport.class)) {
+            if (interfaceType.equals(OpticalTransport.VALUE)) {
                 mpBldr.setSupportingOts(interfaces.getInterfaceName());
             }
             String interfaceName = interfaces.getInterfaceName();
-            if (interfaceType.equals(OtnOtu.class)
+            if (interfaceType.equals(OtnOtu.VALUE)
                 && (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
                 .equals("OTU4"))) {
                 mpBldr.setSupportingOtu4(interfaces.getInterfaceName());
             }
-            if ((interfaceType.equals(OtnOtu.class))
+            if ((interfaceType.equals(OtnOtu.VALUE))
                 && (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
                 .contains("OTUC"))) {
                 mpBldr.setSupportingOtucn(interfaces.getInterfaceName());
             }
-            if (interfaceType.equals(OtnOdu.class)
+            if (interfaceType.equals(OtnOdu.VALUE)
                 && (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
                 .equals("ODU4"))) {
                 mpBldr.setSupportingOdu4(interfaces.getInterfaceName());
             }
-            if ((interfaceType.equals(OtnOdu.class))
+            if ((interfaceType.equals(OtnOdu.VALUE))
                 && (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
                 .contains("ODUC"))) {
                 mpBldr.setSupportingOducn(interfaces.getInterfaceName());
@@ -1051,11 +1050,11 @@ public class PortMappingVersion710 {
         }
         Collection<SupportedInterfaceCapability> supIntfCapaList = getSupIntfCapaList(port);
         if (supIntfCapaList != null) {
-            Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
-                .SupportedIfCapability>> supportedIntf = new HashSet<>();
+            Set<org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability>
+                    supportedIntf = new HashSet<>();
             SupportedInterfaceCapability sic1 = null;
             for (SupportedInterfaceCapability sic : supIntfCapaList) {
-                supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().getSimpleName()));
+                supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().toString()));
                 sic1 = sic;
             }
             mpBldr.setSupportedInterfaceCapability(supportedIntf);
index 4a7675fac023f31e4a95c05b1bd95f806fdd5511..624584c5e6ed5e76c463129b704634dc690bd3ce 100644 (file)
@@ -1 +1 @@
-{"gnpy-api:request":{"topology":{"connections":[{"from_node":"127.0.0.51","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"127.0.0.31"},{"from_node":"127.0.0.10","to_node":"243.0.0.1"},{"from_node":"243.0.0.1","to_node":"127.0.0.30"},{"from_node":"127.0.0.20","to_node":"127.0.0.21"},{"from_node":"127.0.0.20","to_node":"243.0.0.2"},{"from_node":"243.0.0.2","to_node":"127.0.0.10"},{"from_node":"127.0.0.20","to_node":"243.0.0.3"},{"from_node":"243.0.0.3","to_node":"127.0.0.50"},{"from_node":"127.0.0.40","to_node":"127.0.0.41"},{"from_node":"127.0.0.40","to_node":"243.0.0.4"},{"from_node":"243.0.0.4","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"243.0.0.5"},{"from_node":"243.0.0.5","to_node":"127.0.0.30"},{"from_node":"127.0.0.31","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"127.0.0.51"},{"from_node":"127.0.0.20","to_node":"243.0.0.6"},{"from_node":"243.0.0.6","to_node":"127.0.0.30"},{"from_node":"127.0.0.30","to_node":"243.0.0.7"},{"from_node":"243.0.0.7","to_node":"127.0.0.40"},{"from_node":"127.0.0.11","to_node":"127.0.0.10"},{"from_node":"127.0.0.30","to_node":"243.0.0.8"},{"from_node":"243.0.0.8","to_node":"127.0.0.10"},{"from_node":"127.0.0.40","to_node":"243.0.0.9"},{"from_node":"243.0.0.9","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"243.0.0.10"},{"from_node":"243.0.0.10","to_node":"127.0.0.50"},{"from_node":"127.0.0.50","to_node":"243.0.0.11"},{"from_node":"243.0.0.11","to_node":"127.0.0.20"},{"from_node":"127.0.0.50","to_node":"243.0.0.12"},{"from_node":"243.0.0.12","to_node":"127.0.0.40"},{"from_node":"127.0.0.21","to_node":"127.0.0.20"},{"from_node":"127.0.0.41","to_node":"127.0.0.40"},{"from_node":"127.0.0.30","to_node":"243.0.0.13"},{"from_node":"243.0.0.13","to_node":"127.0.0.20"},{"from_node":"127.0.0.10","to_node":"127.0.0.11"},{"from_node":"127.0.0.10","to_node":"243.0.0.14"},{"from_node":"243.0.0.14","to_node":"127.0.0.20"}],"elements":[{"uid":"127.0.0.11","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-1"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.10","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-1"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.51","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-5"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.50","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-5"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.31","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-3"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.30","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-3"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.21","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-2"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.40","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-4"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.20","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-2"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.41","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-4"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"243.0.0.12","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.11","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.10","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.14","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.13","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21000}},{"uid":"243.0.0.8","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.9","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.4","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.5","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.6","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21000}},{"uid":"243.0.0.7","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.1","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.2","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.3","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}}]},"service":{"path-request":[{"request-id":"2","bidirectional":false,"dst-tp-id":"ZHN0VHBJZA\u003d\u003d","src-tp-id":"c3JjVHBJZA\u003d\u003d","path-constraints":{"te-bandwidth":{"spacing":50000000000.0,"trx_mode":"W100G","trx_type":"openroadm-beta1","effective-freq-slot":[{"N":0,"M":4}],"path_bandwidth":100.0,"technology":"flexi-grid"}},"source":"127.0.0.11","explicit-route-objects":{"route-object-include-exclude":[{"index":0,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.20"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"},{"index":1,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.30"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"}]},"destination":"127.0.0.41"}]}}}
\ No newline at end of file
+{"gnpy-api:request":{"topology":{"connections":[{"from_node":"127.0.0.51","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"127.0.0.31"},{"from_node":"127.0.0.10","to_node":"243.0.0.1"},{"from_node":"243.0.0.1","to_node":"127.0.0.30"},{"from_node":"127.0.0.20","to_node":"127.0.0.21"},{"from_node":"127.0.0.20","to_node":"243.0.0.2"},{"from_node":"243.0.0.2","to_node":"127.0.0.10"},{"from_node":"127.0.0.20","to_node":"243.0.0.3"},{"from_node":"243.0.0.3","to_node":"127.0.0.50"},{"from_node":"127.0.0.40","to_node":"127.0.0.41"},{"from_node":"127.0.0.40","to_node":"243.0.0.4"},{"from_node":"243.0.0.4","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"243.0.0.5"},{"from_node":"243.0.0.5","to_node":"127.0.0.30"},{"from_node":"127.0.0.31","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"127.0.0.51"},{"from_node":"127.0.0.20","to_node":"243.0.0.6"},{"from_node":"243.0.0.6","to_node":"127.0.0.30"},{"from_node":"127.0.0.30","to_node":"243.0.0.7"},{"from_node":"243.0.0.7","to_node":"127.0.0.40"},{"from_node":"127.0.0.11","to_node":"127.0.0.10"},{"from_node":"127.0.0.30","to_node":"243.0.0.8"},{"from_node":"243.0.0.8","to_node":"127.0.0.10"},{"from_node":"127.0.0.40","to_node":"243.0.0.9"},{"from_node":"243.0.0.9","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"243.0.0.10"},{"from_node":"243.0.0.10","to_node":"127.0.0.50"},{"from_node":"127.0.0.50","to_node":"243.0.0.11"},{"from_node":"243.0.0.11","to_node":"127.0.0.20"},{"from_node":"127.0.0.50","to_node":"243.0.0.12"},{"from_node":"243.0.0.12","to_node":"127.0.0.40"},{"from_node":"127.0.0.21","to_node":"127.0.0.20"},{"from_node":"127.0.0.41","to_node":"127.0.0.40"},{"from_node":"127.0.0.30","to_node":"243.0.0.13"},{"from_node":"243.0.0.13","to_node":"127.0.0.20"},{"from_node":"127.0.0.10","to_node":"127.0.0.11"},{"from_node":"127.0.0.10","to_node":"243.0.0.14"},{"from_node":"243.0.0.14","to_node":"127.0.0.20"}],"elements":[{"uid":"127.0.0.11","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-1"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.10","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-1"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.51","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-5"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.50","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-5"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.31","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-3"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.30","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-3"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.21","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-2"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.40","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-4"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.20","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-2"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.41","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-4"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"243.0.0.12","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.11","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.10","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.14","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.13","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21}},{"uid":"243.0.0.8","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.9","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.4","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.5","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.6","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21}},{"uid":"243.0.0.7","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.1","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12}},{"uid":"243.0.0.2","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29}},{"uid":"243.0.0.3","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12}}]},"service":{"path-request":[{"request-id":"2","bidirectional":false,"dst-tp-id":"ZHN0VHBJZA\u003d\u003d","src-tp-id":"c3JjVHBJZA\u003d\u003d","path-constraints":{"te-bandwidth":{"spacing":50000000000.0,"trx_mode":"W100G","trx_type":"openroadm-beta1","effective-freq-slot":[{"N":0,"M":4}],"path_bandwidth":100.0,"technology":"flexi-grid"}},"source":"127.0.0.11","explicit-route-objects":{"route-object-include-exclude":[{"index":0,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.20"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"},{"index":1,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.30"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"}]},"destination":"127.0.0.41"}]}}}
\ No newline at end of file
index 1016d65a46130ca55382081f809848b796b53910..2751fd9b25ef6c531ce7bed7fa6359d59bbae781 100644 (file)
@@ -730,7 +730,7 @@ public class INode121 {
 
         String name = deviceInterface.getName();
         String description = deviceInterface.getDescription();
-        String type = deviceInterface.getType().getTypeName();
+        String type = deviceInterface.getType().toString();
         String administrativeStateEnu = deviceInterface.getAdministrativeState().getName();
         int operationalState = deviceInterface.getOperationalState().getIntValue();
         String circuitId = deviceInterface.getCircuitId();
@@ -759,7 +759,7 @@ public class INode121 {
                     org.opendaylight.yang.gen.v1
                         .http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
                     .getOch());
-                ochRate = ochIfBuilder.getRate().getName();
+                ochRate = ochIfBuilder.getRate().toString();
                 ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
                 ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
                 ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
@@ -810,7 +810,7 @@ public class INode121 {
                     new OtuBuilder(deviceInterface.augmentation(
                         org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
                     .getOtu());
-                otuRate = otuIfBuilder.getRate().getName();
+                otuRate = otuIfBuilder.getRate().toString();
                 otuFecEnu = otuIfBuilder.getFec().getName();
                 otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().getEnabled().toString();
                 otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getName();
@@ -970,7 +970,7 @@ public class INode121 {
     private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
 
         String tribSlot = txMsi.getTribSlot().toString();
-        String odtuType = txMsi.getOdtuType().getTypeName();
+        String odtuType = txMsi.getOdtuType().toString();
         String tribPort = txMsi.getTribPort().toString();
         String tribPortPayload = txMsi.getTribPortPayload();
 
@@ -991,7 +991,7 @@ public class INode121 {
     private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
 
         String tribSlot = rxMsi.getTribSlot().toString();
-        String odtuType = rxMsi.getOdtuType().getTypeName();
+        String odtuType = rxMsi.getOdtuType().toString();
         String tribPort = rxMsi.getTribPort().toString();
         String tribPortPayload = rxMsi.getTribPortPayload();
 
@@ -1014,7 +1014,7 @@ public class INode121 {
         ExpMsi expMsi) {
 
         String tribSlot = expMsi.getTribSlot().toString();
-        String odtuType = expMsi.getOdtuType().getTypeName();
+        String odtuType = expMsi.getOdtuType().toString();
         String tribPort = expMsi.getTribPort().toString();
         String tribPortPayload = expMsi.getTribPortPayload();
 
index 3ff63b7dc54a0971608a62548208d2156606ed07..cb6ec1a1970bf30ccfd6e6b9e14faf319ecf0125 100644 (file)
@@ -542,7 +542,7 @@ public class INode221 {
         //int otsFiberTypeEnu = -1;
         String name = deviceInterface.getName();
         String description = deviceInterface.getDescription();
-        String type = deviceInterface.getType().getTypeName();
+        String type = deviceInterface.getType().toString();
         String circuitId = deviceInterface.getCircuitId();
         String supportingInterface = deviceInterface.getSupportingInterface();
         String supportingCircuitPackName = deviceInterface.getSupportingCircuitPackName();
@@ -635,7 +635,7 @@ public class INode221 {
                     org.opendaylight.yang.gen.v1
                         .http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
                     .getOch());
-                ochRate = ochIfBuilder.getRate().getName();
+                ochRate = ochIfBuilder.getRate().toString();
                 //ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
                 ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
                 ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
@@ -684,7 +684,7 @@ public class INode221 {
                 OtuBuilder otuIfBuilder = new OtuBuilder(deviceInterface.augmentation(
                     org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
                     .getOtu());
-                otuRate = otuIfBuilder.getRate().getName();
+                otuRate = otuIfBuilder.getRate().toString();
                 otuFecEnu = otuIfBuilder.getFec().getIntValue();
                 otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().getEnabled().toString();
                 otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getIntValue();
@@ -849,7 +849,7 @@ public class INode221 {
     private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
 
         String tribSlot = txMsi.getTribSlot().toString();
-        String odtuType = txMsi.getOdtuType().getTypeName();
+        String odtuType = txMsi.getOdtuType().toString();
         String tribPort = txMsi.getTribPort().toString();
         String tribPortPayload = txMsi.getTribPortPayload();
 
@@ -870,7 +870,7 @@ public class INode221 {
     private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
 
         String tribSlot = rxMsi.getTribSlot().toString();
-        String odtuType = rxMsi.getOdtuType().getTypeName();
+        String odtuType = rxMsi.getOdtuType().toString();
         String tribPort = rxMsi.getTribPort().toString();
         String tribPortPayload = rxMsi.getTribPortPayload();
 
@@ -893,7 +893,7 @@ public class INode221 {
         ExpMsi expMsi) {
 
         String tribSlot = expMsi.getTribSlot().toString();
-        String odtuType = expMsi.getOdtuType().getTypeName();
+        String odtuType = expMsi.getOdtuType().toString();
         String tribPort = expMsi.getTribPort().toString();
         String tribPortPayload = expMsi.getTribPortPayload();
 
index 667320760ccb9d779e764d9fa67e9e6a2f66a89e..b0e24f48a9797d3a15db2d31d848441a7144e57f 100644 (file)
@@ -100,17 +100,15 @@ public class FrequenciesServiceImpl implements FrequenciesService {
             List<NodeIdPair> atozTpIds = getAToZTpList(atoZDirection);
             Decimal64 atozMinFrequency = atoZDirection.getAToZMinFrequency().getValue();
             Decimal64 atozMaxFrequency = atoZDirection.getAToZMaxFrequency().getValue();
-            Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-                    .forName(atoZDirection.getModulationFormat());
-            if (!optionalModulationFormat.isPresent()) {
+            ModulationFormat modulationFormat = ModulationFormat.forName(atoZDirection.getModulationFormat());
+            if (modulationFormat == null) {
                 LOG.error("Unknown modulation format {} for a to z direction, frequencies not updated",
                         atoZDirection.getModulationFormat());
                 return;
             }
-            setFrequencies4Tps(atozMinFrequency, atozMaxFrequency, atoZDirection.getRate(),
-                    optionalModulationFormat.get(), atozTpIds, used);
-            setFrequencies4Nodes(atozMinFrequency,
-                    atozMaxFrequency,
+            setFrequencies4Tps(atozMinFrequency, atozMaxFrequency, atoZDirection.getRate(), modulationFormat, atozTpIds,
+                    used);
+            setFrequencies4Nodes(atozMinFrequency, atozMaxFrequency,
                     atozTpIds.stream().map(NodeIdPair::getNodeID).distinct().collect(Collectors.toList()),
                     used);
         }
@@ -119,15 +117,14 @@ public class FrequenciesServiceImpl implements FrequenciesService {
             List<NodeIdPair> ztoaTpIds = getZToATpList(ztoADirection);
             Decimal64 ztoaMinFrequency = ztoADirection.getZToAMinFrequency().getValue();
             Decimal64 ztoaMaxFrequency = ztoADirection.getZToAMaxFrequency().getValue();
-            Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-                    .forName(ztoADirection.getModulationFormat());
-            if (!optionalModulationFormat.isPresent()) {
+            ModulationFormat modulationFormat = ModulationFormat.forName(ztoADirection.getModulationFormat());
+            if (modulationFormat == null) {
                 LOG.error("Unknown modulation format {} for z to a direction, frequencies not updated",
                         ztoADirection.getModulationFormat());
                 return;
             }
-            setFrequencies4Tps(ztoaMinFrequency, ztoaMaxFrequency, ztoADirection.getRate(),
-                    optionalModulationFormat.get(), ztoaTpIds, used);
+            setFrequencies4Tps(ztoaMinFrequency, ztoaMaxFrequency, ztoADirection.getRate(), modulationFormat, ztoaTpIds,
+                    used);
             setFrequencies4Nodes(ztoaMinFrequency,
                     ztoaMaxFrequency,
                     ztoaTpIds.stream().map(NodeIdPair::getNodeID).distinct().collect(Collectors.toList()),
index 9843bd987473553859c3ddc99535b28aa00cbe24..c56fecd8130d5f8ebf1717149e1abeca3193eb5c 100644 (file)
@@ -92,12 +92,12 @@ public final class OpenRoadmOtnTopology {
     private static final int NB_TRIB_PORTS = 80;
     private static final int NB_TRIB_SLOTS = 80;
 
-    private static final Map<String, Class<? extends OduRateIdentity>> RATE_MAP = Map.of(
-        "If100GEODU4", ODU4.class,
-        "IfOCHOTU4ODU4", ODU4.class,
-        "If1GEODU0", ODU0.class,
-        "If10GEODU2", ODU2.class,
-        "If10GEODU2e", ODU2e.class);
+    private static final Map<String, OduRateIdentity> RATE_MAP = Map.of(
+        "If100GEODU4", ODU4.VALUE,
+        "IfOCHOTU4ODU4", ODU4.VALUE,
+        "If1GEODU0", ODU0.VALUE,
+        "If10GEODU2", ODU2.VALUE,
+        "If10GEODU2e", ODU2e.VALUE);
     private static final Map<OtnLinkType, Long> OTNLINKTYPE_BW_MAP = Map.of(
         OtnLinkType.ODTU4, 100000L,
         OtnLinkType.ODUC4, 400000L,
@@ -110,10 +110,10 @@ public final class OpenRoadmOtnTopology {
         Uint32.valueOf(1), 1000L,
         Uint32.valueOf(10), 10000L,
         Uint32.valueOf(100), 100000L);
-    private static final Map<Uint32, Class<? extends OdtuTypeIdentity>> SERVICERATE_ODTUTYPECLASS_MAP = Map.of(
-        Uint32.valueOf(1), ODTU4TsAllocated.class,
-        Uint32.valueOf(10), ODTU4TsAllocated.class,
-        Uint32.valueOf(100), ODTUCnTs.class);
+    private static final Map<Uint32, OdtuTypeIdentity> SERVICERATE_ODTUTYPECLASS_MAP = Map.of(
+        Uint32.valueOf(1), ODTU4TsAllocated.VALUE,
+        Uint32.valueOf(10), ODTU4TsAllocated.VALUE,
+        Uint32.valueOf(100), ODTUCnTs.VALUE);
 
     private OpenRoadmOtnTopology() {
     }
@@ -427,7 +427,7 @@ public final class OpenRoadmOtnTopology {
                 tpnPool.add(Uint16.valueOf(i));
             }
             OdtuTpnPool oduTpnPool = new OdtuTpnPoolBuilder()
-                .setOdtuType(ODTU4TsAllocated.class)
+                .setOdtuType(ODTU4TsAllocated.VALUE)
                 .setTpnPool(tpnPool)
                 .build();
             xtpcaBldr.setOdtuTpnPool(ImmutableMap.of(oduTpnPool.key(),oduTpnPool));
@@ -470,7 +470,7 @@ public final class OpenRoadmOtnTopology {
                 tpnPool.remove(Uint16.valueOf(tribPortNb));
             }
         }
-        Class<? extends OdtuTypeIdentity> odtuType;
+        OdtuTypeIdentity odtuType;
         if (SERVICERATE_ODTUTYPECLASS_MAP.containsKey(serviceRate)) {
             odtuType = SERVICERATE_ODTUTYPECLASS_MAP.get(serviceRate);
         } else {
@@ -713,7 +713,7 @@ public final class OpenRoadmOtnTopology {
                     mapping.getLogicalConnectionPoint(), node.getNodeId());
             } else {
                 XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder();
-                for (Class<? extends SupportedIfCapability> supInterCapa : mapping.getSupportedInterfaceCapability()) {
+                for (SupportedIfCapability supInterCapa : mapping.getSupportedInterfaceCapability()) {
                     SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
                         .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
                         .setIfCapType(supInterCapa)
@@ -777,11 +777,11 @@ public final class OpenRoadmOtnTopology {
         }
     }
 
-    private static Class<? extends OduRateIdentity> fixRate(Set<Class<? extends SupportedIfCapability>> list) {
-
-        for (Class<? extends  SupportedIfCapability> class1 : list) {
-            if (RATE_MAP.containsKey(class1.getSimpleName())) {
-                return RATE_MAP.get(class1.getSimpleName());
+    private static OduRateIdentity fixRate(Set<SupportedIfCapability> list) {
+        for (SupportedIfCapability supIfCap: list) {
+            String simpleName = supIfCap.toString().split("\\{")[0];
+            if (RATE_MAP.containsKey(simpleName)) {
+                return RATE_MAP.get(simpleName);
             }
         }
         return null;
@@ -846,4 +846,5 @@ public final class OpenRoadmOtnTopology {
                 ? nodeName
                 : new StringBuilder(nodeName).append("-").append(tpName.split("-")[0]).toString();
     }
+
 }
index 5c5f959df9561955a0c2cc650e9e629954af780b..144aef0d48a27a0bf614c3c75c3f78a5e65b08de 100644 (file)
@@ -165,13 +165,13 @@ public class OpenRoadmOtnTopologyTest {
                 .getSupportedInterfaceCapability()
                 .size());
         assertEquals(
-            If100GE.class.getName(),
+            If100GE.VALUE,
             tps.get(0).augmentation(
                     org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
                         .TerminationPoint1.class)
                 .getTpSupportedInterfaces().nonnullSupportedInterfaceCapability()
                 .values().stream().findFirst()
-                .get().getIfCapType().getName());
+                .get().getIfCapType());
         assertEquals(
             "first TP must be of type client",
             OpenroadmTpType.XPONDERCLIENT,
@@ -195,7 +195,7 @@ public class OpenRoadmOtnTopologyTest {
                 .getSupportedInterfaceCapability()
                 .size());
         assertEquals(
-            IfOCH.class.getName(),
+            IfOCH.VALUE,
             tps.get(2).augmentation(
                     org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
                         .TerminationPoint1.class)
@@ -203,8 +203,7 @@ public class OpenRoadmOtnTopologyTest {
                 .getSupportedInterfaceCapability()
                 .values().stream().findFirst()
                 .get()
-                .getIfCapType()
-                .getName());
+                .getIfCapType());
         assertNull(
             "the rate should be null",
             tps.get(2).augmentation(
@@ -891,7 +890,7 @@ public class OpenRoadmOtnTopologyTest {
         LOG.info("tpList = {}", tpList);
         assertEquals(
             "only IfOCHOTU4ODU4 interface capabitily expected",
-            IfOCHOTU4ODU4.class,
+            IfOCHOTU4ODU4.VALUE,
             tpList.get(4)
                 .augmentation(
                     org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
@@ -902,7 +901,7 @@ public class OpenRoadmOtnTopologyTest {
                 .getIfCapType());
         assertEquals(
             "the rate should be ODU4",
-            ODU4.class,
+            ODU4.VALUE,
             tpList.get(4)
                 .augmentation(
                     org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
@@ -953,8 +952,8 @@ public class OpenRoadmOtnTopologyTest {
             for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient1) {
                 assertThat("tp should have 2 if-cap-type: if-10GE-ODU2e, if-10GE-ODU2",
                     String.valueOf(supportedInterfaceCapability.getIfCapType()),
-                    either(containsString(String.valueOf(If10GEODU2e.class)))
-                    .or(containsString(String.valueOf(If10GEODU2.class))));
+                    either(containsString(String.valueOf(If10GEODU2e.VALUE)))
+                    .or(containsString(String.valueOf(If10GEODU2.VALUE))));
             }
             List<SupportedInterfaceCapability> sicListClient3 = tpList.get(3)
                 .augmentation(
@@ -965,9 +964,9 @@ public class OpenRoadmOtnTopologyTest {
             for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient3) {
                 assertThat("tp should have 3 if-cap-type: if-10GE-ODU2e, if-10GE-ODU2, if-10GE",
                     String.valueOf(supportedInterfaceCapability.getIfCapType()),
-                    either(containsString(String.valueOf(If10GEODU2e.class)))
-                    .or(containsString(String.valueOf(If10GEODU2.class)))
-                    .or(containsString(String.valueOf(If10GE.class))));
+                    either(containsString(String.valueOf(If10GEODU2e.VALUE)))
+                    .or(containsString(String.valueOf(If10GEODU2.VALUE)))
+                    .or(containsString(String.valueOf(If10GE.VALUE))));
             }
             assertThat("the rate should be ODU2 or ODU2e",
                 String.valueOf(tpList.get(2)
@@ -976,8 +975,8 @@ public class OpenRoadmOtnTopologyTest {
                             .TerminationPoint1.class)
                     .getXpdrTpPortConnectionAttributes()
                     .getRate()),
-                either(containsString(String.valueOf(ODU2e.class)))
-                .or(containsString(String.valueOf(ODU2.class))));
+                either(containsString(String.valueOf(ODU2e.VALUE)))
+                .or(containsString(String.valueOf(ODU2.VALUE))));
             assertEquals(
                 "TP should be of type client",
                 OpenroadmTpType.XPONDERCLIENT,
@@ -994,7 +993,7 @@ public class OpenRoadmOtnTopologyTest {
             assertEquals("XPDR2-NETWORK2", tpList.get(5).getTpId().getValue());
             assertEquals(
                 "only IfOCHOTU4ODU4 interface capabitily expected",
-                IfOCHOTU4ODU4.class,
+                IfOCHOTU4ODU4.VALUE,
                 tpList.get(5)
                     .augmentation(
                         org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210
@@ -1021,8 +1020,8 @@ public class OpenRoadmOtnTopologyTest {
             for (SupportedInterfaceCapability supportedInterfaceCapability : sicListClient3) {
                 assertThat("tp should have 2 if-cap-type: if-100GE-ODU4, if-100GE",
                     String.valueOf(supportedInterfaceCapability.getIfCapType()),
-                    either(containsString(String.valueOf(If100GEODU4.class)))
-                    .or(containsString(String.valueOf(If100GE.class))));
+                    either(containsString(String.valueOf(If100GEODU4.VALUE)))
+                    .or(containsString(String.valueOf(If100GE.VALUE))));
             }
             assertEquals(
                 "TP should be of type client", OpenroadmTpType.XPONDERCLIENT,
index bfc6f672f7a2adbc2aca650319c27f56782d03fa..a7177a39fba8211c6720f2230b7ea88bd24ff081 100644 (file)
@@ -151,7 +151,7 @@ public final class NetworkmodelTestUtil {
 
     public static List<TerminationPoint> createTpList(boolean withTpnTsPool) {
         SupportedInterfaceCapability supCapa = new SupportedInterfaceCapabilityBuilder()
-            .setIfCapType(IfOCHOTU4ODU4.class)
+            .setIfCapType(IfOCHOTU4ODU4.VALUE)
             .build();
         Map<SupportedInterfaceCapabilityKey,SupportedInterfaceCapability> supInterCapaList =
                 new HashMap<>();
@@ -160,7 +160,7 @@ public final class NetworkmodelTestUtil {
             .setSupportedInterfaceCapability(supInterCapaList)
             .build();
         XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder()
-            .setRate(ODU4.class);
+            .setRate(ODU4.VALUE);
         if (withTpnTsPool) {
             Set<Uint16> tsPool = new HashSet<>();
             for (int i = 0; i < 80; i++) {
@@ -172,7 +172,7 @@ public final class NetworkmodelTestUtil {
                 tpnPool.add(Uint16.valueOf(i));
             }
             OdtuTpnPool odtuTpn = new OdtuTpnPoolBuilder()
-                    .setOdtuType(ODTU4TsAllocated.class)
+                    .setOdtuType(ODTU4TsAllocated.VALUE)
                     .setTpnPool(tpnPool).build();
             xtpcaBldr.setOdtuTpnPool(ImmutableMap.of(odtuTpn.key(),odtuTpn));
         }
@@ -251,8 +251,8 @@ public final class NetworkmodelTestUtil {
             int networkPortNb, int clientPortNb,
         XpdrNodeTypes xpdrNodeType) {
         for (int i = 1; i <= networkPortNb; i++) {
-            Set<Class<? extends SupportedIfCapability>> supportedIntf = new HashSet<>();
-            supportedIntf.add(IfOCH.class);
+            Set<SupportedIfCapability> supportedIntf = new HashSet<>();
+            supportedIntf.add(IfOCH.VALUE);
             MappingBuilder mappingBldr = new MappingBuilder()
                 .setLogicalConnectionPoint("XPDR1-NETWORK" + i)
                 .setPortDirection("bidirectional")
@@ -268,8 +268,8 @@ public final class NetworkmodelTestUtil {
             mappingMap.put(mapping.key(),mapping);
         }
         for (int i = 1; i <= clientPortNb; i++) {
-            Set<Class<? extends SupportedIfCapability>> supportedIntf = new HashSet<>();
-            supportedIntf.add(If100GE.class);
+            Set<SupportedIfCapability> supportedIntf = new HashSet<>();
+            supportedIntf.add(If100GE.VALUE);
             Mapping mapping = new MappingBuilder()
                 .setLogicalConnectionPoint("XPDR1-CLIENT" + i)
                 .setPortDirection("bidirectional")
index 335c7b6f8af59aada2707eb921a30511cd284ba3..01a60328a91a8b57db8478639c770d74ede7e08c 100644 (file)
@@ -125,9 +125,9 @@ public class OlmPowerServiceImplSpanLossBaseTest extends AbstractTest {
             .setSpanLossReceive(new RatioDB(Decimal64.valueOf("25")))
             .build();
         Interface1 ots = new Interface1Builder().setOts(otsValue).build();
-        Interface interA = new InterfaceBuilder().setName("OTS-DEG2-TTP-TXRX").setType(OpticalTransport.class)
+        Interface interA = new InterfaceBuilder().setName("OTS-DEG2-TTP-TXRX").setType(OpticalTransport.VALUE)
                 .addAugmentation(ots).build();
-        Interface interC = new InterfaceBuilder().setName("OTS-DEG1-TTP-TXRX").setType(OpticalTransport.class)
+        Interface interC = new InterfaceBuilder().setName("OTS-DEG1-TTP-TXRX").setType(OpticalTransport.VALUE)
                 .addAugmentation(ots).build();
         Optional<Interface> interOptA = Optional.of(interA);
         Optional<Interface> interOptC = Optional.of(interC);
index d5e27d18fc2785a9d9b6a740c0d4c21e399a7013..47e428f97a677c831435ee93d97ab526b45a5355 100644 (file)
@@ -79,7 +79,7 @@ public class GnpyResult {
                             .getPathProperties().nonnullPathMetric().values();
                     LOG.info("GNPy : path is not feasible : {}", noPathType);
                     for (PathMetric pathMetric : pathMetricList) {
-                        String metricType = pathMetric.getMetricType().getSimpleName();
+                        String metricType = pathMetric.getMetricType().toString();
                         Decimal64 accumulativeValue = pathMetric.getAccumulativeValue();
                         LOG.info("Metric type {} // AccumulatriveValue {}", metricType, accumulativeValue);
                     }
@@ -91,7 +91,7 @@ public class GnpyResult {
                         .getPathProperties().nonnullPathMetric().values();
                 // Path metrics
                 for (PathMetric pathMetric : pathMetricList) {
-                    String metricType = pathMetric.getMetricType().getSimpleName();
+                    String metricType = pathMetric.getMetricType().toString();
                     Decimal64 accumulativeValue = pathMetric.getAccumulativeValue();
                     LOG.info("Metric type {} // AccumulatriveValue {}", metricType, accumulativeValue);
                 }
index 02eade3f5dd2258a89ef13bfcc48d6f41dafc099..30e521ad0725e8149fde534ff701ce3f3badcc08 100644 (file)
@@ -20,7 +20,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
@@ -339,7 +338,7 @@ public class GnpyServiceImpl {
         Type type1 = new NumUnnumHopBuilder().setNumUnnumHop(numUnnumHop).build();
         // Create routeObjectIncludeExclude element
         return new RouteObjectIncludeExcludeBuilder()
-            .setIndex(Uint32.valueOf(index)).setExplicitRouteUsage(RouteIncludeEro.class).setType(type1).build();
+            .setIndex(Uint32.valueOf(index)).setExplicitRouteUsage(RouteIncludeEro.VALUE).setType(type1).build();
     }
 
     //Create the path constraints
@@ -351,10 +350,9 @@ public class GnpyServiceImpl {
         if (minFrequency != null && maxFrequency != null && modulationFormat != null) {
             LOG.info("Creating path constraints for rate {}, modulationFormat {}, min freq {}, max freq {}", rate,
                     modulationFormat, minFrequency, maxFrequency);
-            ModulationFormat mformat = ModulationFormat.DpQpsk;
-            Optional<ModulationFormat> optionalModulationFormat = ModulationFormat.forName(modulationFormat);
-            if (optionalModulationFormat.isPresent()) {
-                mformat = optionalModulationFormat.get();
+            ModulationFormat mformat = ModulationFormat.forName(modulationFormat);
+            if (mformat == null) {
+                mformat = ModulationFormat.DpQpsk;
             }
             spacing = GridConstant.FREQUENCY_SLOT_WIDTH_TABLE.get(Uint32.valueOf(rate), mformat);
             FrequencyTHz centralFrequency = GridUtils.getCentralFrequency(
index 5687e4b7365de49e8ad75f0634b12a8747ff3528..8bb53215cca9dbb3353468e99ec73723f19f70ef 100644 (file)
@@ -346,7 +346,7 @@ public class GnpyTopoImpl {
         Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
         Fiber fiber = new FiberBuilder()
             .setLength(Decimal64.valueOf(String.valueOf(length)))
-            .setLengthUnits(Km.class)
+            .setLengthUnits(Km.VALUE)
             .setAttIn(Decimal64.valueOf(String.valueOf(attIn)))
             .setLossCoef(Decimal64.valueOf(String.valueOf(lossCoef)).scaleTo(5, RoundingMode.CEILING))
             .setConIn(Decimal64.valueOf(String.valueOf(connIn)))
@@ -354,7 +354,7 @@ public class GnpyTopoImpl {
             .build();
         Params params1 = new ParamsBuilder().setFiberroadmfused(fiber).build();
         return new ElementsBuilder().setUid(uidFiber)
-                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Fiber.class)
+                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Fiber.VALUE)
                 .setTypeVariety(typeVariety).setMetadata(metadata1)
                 .setElementType(new FiberRoadmBuilder().setParams(params1).build()).build();
     }
@@ -378,7 +378,7 @@ public class GnpyTopoImpl {
         Edfa edfa = new EdfaBuilder()
                 .setOperational(operational).build();
         return new ElementsBuilder().setUid(uidEdfa)
-                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Edfa.class)
+                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Edfa.VALUE)
                 .setMetadata(metadata1).setElementType(edfa).setTypeVariety(typeVariety).build();
     }
 
@@ -397,7 +397,7 @@ public class GnpyTopoImpl {
             .build();
         Params params1 = new ParamsBuilder().setFiberroadmfused(roadm).build();
         return new ElementsBuilder().setUid(uidRoadm)
-                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Roadm.class)
+                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Roadm.VALUE)
                 .setMetadata(metadata1).setElementType(new FiberRoadmBuilder().setParams(params1).build()).build();
     }
 
@@ -413,7 +413,7 @@ public class GnpyTopoImpl {
         Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
         Transceiver transceiver = new TransceiverBuilder().build();
         return new ElementsBuilder().setUid(uidTrans)
-                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Transceiver.class)
+                .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Transceiver.VALUE)
                 .setMetadata(metadata1).setElementType(transceiver).build();
     }
 
index f0929fcc4abc9b7595d8c048cc91603c8c216eb8..1a8eb7aff2274ce82dcbbb467e52f825c900ed1d 100644 (file)
@@ -269,8 +269,8 @@ public class PceCalculation {
             LOG.error("readMdSal: Error reading topology {}", nwInstanceIdentifier);
             networkTransactionService.close();
             returnStructure.setRC(ResponseCodes.RESPONSE_FAILED);
-            throw new RuntimeException(
-                "readMdSal: Error reading from operational store, topology : " + nwInstanceIdentifier + " :" + e);
+//            throw new RuntimeException(
+//                "readMdSal: Error reading from operational store, topology : " + nwInstanceIdentifier + " :" + e);
         }
         return nw;
     }
index 01bf4d34cd22012090d892679659f6b2b2b4c83a..7fd8976c484a0b1cd9306476a16440ca6ce34ad2 100644 (file)
@@ -179,15 +179,15 @@ public class PceOpticalNode implements PceNode {
         }
         switch (this.serviceType) {
             case "400GE":
-                for (Class<? extends SupportedIfCapability> ifCap : mapping.getSupportedInterfaceCapability()) {
-                    if (ifCap.equals(IfOtsiOtsigroup.class)) {
+                for (SupportedIfCapability ifCap : mapping.getSupportedInterfaceCapability()) {
+                    if (ifCap.equals(IfOtsiOtsigroup.VALUE)) {
                         return true;
                     }
                 }
                 return false;
             case "100GE":
-                return mapping.getSupportedInterfaceCapability().contains(IfOCH.class)
-                        || mapping.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class);
+                return mapping.getSupportedInterfaceCapability().contains(IfOCH.VALUE)
+                        || mapping.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE);
             default:
                 return true;
         }
index f4f40a394322b6abb34e78f02d9542ad53c5c34e..87ea1072c9ffcded4bcea1cad2c94aa9ae000cd0 100644 (file)
@@ -26,8 +26,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.re
 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.OpenroadmTpType;
 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.otn.common.types.rev200327.ODTU4TsAllocated;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODTUCnTs;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.ODTU4TsAllocated;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.ODTUCnTs;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.Node1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.networks.network.node.termination.point.XpdrTpPortConnectionAttributes;
@@ -62,11 +62,11 @@ public class PceOtnNode implements PceNode {
         OpenroadmNodeType.MUXPDR,
         OpenroadmNodeType.SWITCH,
         OpenroadmNodeType.TPDR);
-    private static final Map<String, Class<? extends SupportedIfCapability>> SERVICE_TYPE_ETH_CLASS_MAP = Map.of(
-        StringConstants.SERVICE_TYPE_1GE, If1GEODU0.class,
-        StringConstants.SERVICE_TYPE_10GE, If10GEODU2e.class,
-        StringConstants.SERVICE_TYPE_100GE_M, If100GEODU4.class,
-        StringConstants.SERVICE_TYPE_100GE_S, If100GEODU4.class);
+    private static final Map<String, SupportedIfCapability> SERVICE_TYPE_ETH_CLASS_MAP = Map.of(
+        StringConstants.SERVICE_TYPE_1GE, If1GEODU0.VALUE,
+        StringConstants.SERVICE_TYPE_10GE, If10GEODU2e.VALUE,
+        StringConstants.SERVICE_TYPE_100GE_M, If100GEODU4.VALUE,
+        StringConstants.SERVICE_TYPE_100GE_S, If100GEODU4.VALUE);
     private static final Map<String, Integer> SERVICE_TYPE_ETH_TS_NB_MAP = Map.of(
         StringConstants.SERVICE_TYPE_1GE, 1,
         StringConstants.SERVICE_TYPE_10GE, 10,
@@ -317,8 +317,8 @@ public class PceOtnNode implements PceNode {
         for (SupportedInterfaceCapability sic :
                 ontTp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values()) {
             LOG.debug("in checkTpForOduTermination - sic = {}", sic.getIfCapType());
-            if ((sic.getIfCapType().equals(IfOCHOTU4ODU4.class)
-                    || sic.getIfCapType().equals(IfOtsiOtsigroup.class))
+            if ((sic.getIfCapType().equals(IfOCHOTU4ODU4.VALUE)
+                    || sic.getIfCapType().equals(IfOtsiOtsigroup.VALUE))
                     && (ontTp1.getXpdrTpPortConnectionAttributes() == null
                         || ontTp1.getXpdrTpPortConnectionAttributes().getTsPool() == null)) {
                 return true;
@@ -339,8 +339,8 @@ public class PceOtnNode implements PceNode {
     }
 
     private boolean checkFirstOdtuTpn(OdtuTpnPool otPool) {
-        return (otPool.getOdtuType().getSimpleName().equals(ODTU4TsAllocated.class.getSimpleName())
-                || otPool.getOdtuType().getSimpleName().equals(ODTUCnTs.class.getSimpleName()))
+        return (otPool.getOdtuType().equals(ODTU4TsAllocated.VALUE))
+                || otPool.getOdtuType().equals(ODTUCnTs.VALUE)
             && !otPool.getTpnPool().isEmpty();
     }
 
@@ -349,8 +349,7 @@ public class PceOtnNode implements PceNode {
                 ontTp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values()) {
             LOG.debug("in checkTpForOduTermination - sic = {}", sic.getIfCapType());
             // we could also check the administrative status of the tp
-            if (SERVICE_TYPE_ETH_CLASS_MAP.get(otnServiceType).getSimpleName()
-                    .equals(sic.getIfCapType().getSimpleName())) {
+            if (SERVICE_TYPE_ETH_CLASS_MAP.get(otnServiceType).equals(sic.getIfCapType())) {
                 return true;
             }
         }
index 26643761159c77628453ba5f6bb61c5dbef9050f..8986694068692dd3138bd8aa027c12ee920eb264 100644 (file)
@@ -235,17 +235,17 @@ public class PceOtnNodeTest extends AbstractTest {
             .TerminationPoint1Builder createOTNTerminationPoint(OpenroadmTpType openroadmTpType) {
 
         SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(IfOCHOTU4ODU4.class)
+                .setIfCapType(IfOCHOTU4ODU4.VALUE)
                 .build();
 
         SupportedInterfaceCapability supIfCapa1 = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(If100GEODU4.class)
+                .setIfCapType(If100GEODU4.VALUE)
                 .build();
         SupportedInterfaceCapability supIfCapa2 = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(If10GEODU2e.class)
+                .setIfCapType(If10GEODU2e.VALUE)
                 .build();
         SupportedInterfaceCapability supIfCapa3 = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(If1GEODU0.class)
+                .setIfCapType(If1GEODU0.VALUE)
                 .build();
 
         Map<SupportedInterfaceCapabilityKey,SupportedInterfaceCapability> supIfCapaList = new HashMap<>();
index 2c93c5bc3bc8d885102a88b0e0f54e89e6430180..042a1f90aa92b7e32103af07395e076d9309f776 100644 (file)
@@ -66,7 +66,7 @@ public class PathComputationServiceImplTest extends AbstractTest {
     public void testPathComputationRequestPathCase() {
         PathMetric pathMetric = new PathMetricBuilder()
                 .setAccumulativeValue(Decimal64.valueOf("21"))
-                .setMetricType(PathBandwidth.class).build();
+                .setMetricType(PathBandwidth.VALUE).build();
         Response response = new ResponseBuilder()
                 .withKey(new ResponseKey("responseId")).setResponseType(new PathCaseBuilder()
                 .setPathProperties(new PathPropertiesBuilder().setPathMetric(Map.of(pathMetric.key(),pathMetric))
index 74fd2d54f198f9651fb2f4860d552ad556a8d42c..e525df32e04a9675910e6e4121bde4e30d561ece 100644 (file)
@@ -301,17 +301,17 @@ public final class NodeUtils {
             .TerminationPoint1Builder createOTNTerminationPoint(OpenroadmTpType openroadmTpType) {
 
         SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(IfOCHOTU4ODU4.class)
+                .setIfCapType(IfOCHOTU4ODU4.VALUE)
                 .build();
 
         SupportedInterfaceCapability supIfCapa1 = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(If100GEODU4.class)
+                .setIfCapType(If100GEODU4.VALUE)
                 .build();
         SupportedInterfaceCapability supIfCapa2 = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(If10GEODU2e.class)
+                .setIfCapType(If10GEODU2e.VALUE)
                 .build();
         SupportedInterfaceCapability supIfCapa3 = new SupportedInterfaceCapabilityBuilder()
-                .setIfCapType(If1GEODU0.class)
+                .setIfCapType(If1GEODU0.VALUE)
                 .build();
 
         Map<SupportedInterfaceCapabilityKey,SupportedInterfaceCapability> supIfCapaList = new HashMap<>();
index 8197b9ba06e47c79036d260987122550521d264c..7ed479dda0cecccde82e283103c0dd62d00e51dc 100644 (file)
@@ -14,7 +14,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.stream.Collectors;
@@ -170,15 +169,14 @@ public final class ModelMappingUtils {
                     scale));
         }
         if (atoZDirection.getRate() != null && atoZDirection.getModulationFormat() != null) {
-            Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-                    .forName(atoZDirection.getModulationFormat());
-            if (optionalModulationFormat.isPresent()
+            ModulationFormat modulationFormat = ModulationFormat.forName(atoZDirection.getModulationFormat());
+            if (modulationFormat != null
                     && GridConstant.FREQUENCY_WIDTH_TABLE
-                    .contains(atoZDirection.getRate(), optionalModulationFormat.get())) {
+                    .contains(atoZDirection.getRate(), modulationFormat)) {
                 servicePathInputBuilder
                     .setNmcWidth(FrequencyGHz
                         .getDefaultInstance(GridConstant.FREQUENCY_WIDTH_TABLE.get(atoZDirection.getRate(),
-                        optionalModulationFormat.get())));
+                        modulationFormat)));
             }
         }
         servicePathInputBuilder.setModulationFormat(atoZDirection.getModulationFormat())
@@ -228,14 +226,13 @@ public final class ModelMappingUtils {
                     scale));
         }
         if (ztoADirection.getRate() != null && ztoADirection.getModulationFormat() != null) {
-            Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-                    .forName(ztoADirection.getModulationFormat());
-            if (optionalModulationFormat.isPresent()
+            ModulationFormat modulationFormat = ModulationFormat.forName(ztoADirection.getModulationFormat());
+            if (modulationFormat != null
                     && GridConstant.FREQUENCY_WIDTH_TABLE
-                    .contains(ztoADirection.getRate(), optionalModulationFormat.get())) {
+                    .contains(ztoADirection.getRate(), modulationFormat)) {
                 servicePathInputBuilder.setNmcWidth(FrequencyGHz
                         .getDefaultInstance(GridConstant.FREQUENCY_WIDTH_TABLE.get(ztoADirection.getRate(),
-                                optionalModulationFormat.get())));
+                                modulationFormat)));
             }
         }
         servicePathInputBuilder.setModulationFormat(ztoADirection.getModulationFormat())
index e66124a7e5ca8a0f66be29b97792264a9b85a2fa..2073b5cb5029ad8dd5cae0b8349f53ac92699c03 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.Opti
 import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOdu;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOtu;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes.ModulationFormat;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.R100G;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.och.container.OchBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.OtsAttributes;
@@ -85,7 +86,7 @@ public class OpenRoadmInterface121 {
                 .setSpeed(Uint32.valueOf(100000))
                 .setMtu(Uint32.valueOf(9000));
 
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
+        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
                                                                           logicalConnPoint + "-ETHERNET");
 
         // Create Interface1 type object required for adding as augmentation
@@ -101,7 +102,7 @@ public class OpenRoadmInterface121 {
         return ethInterfaceBldr.getName();
     }
 
-    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
+    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
                                                            String key) {
         return new InterfaceBuilder()
                 .setDescription("  TBD   ")
@@ -131,14 +132,14 @@ public class OpenRoadmInterface121 {
             throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
         }
         // Create generic interface
-        InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOtu.class, logicalConnPoint
+        InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOtu.VALUE, logicalConnPoint
                 + "-OTU");
         otuInterfaceBldr.setSupportingInterface(supportOchInterface);
 
         // OTU interface specific data
         OtuBuilder otuIfBuilder = new OtuBuilder()
                 .setFec(OtuAttributes.Fec.Scfec)
-                .setRate(OTU4.class);
+                .setRate(OTU4.VALUE);
 
         // Create Interface1 type object required for adding as augmentation
         // TODO look at imports of different versions of class
@@ -168,7 +169,7 @@ public class OpenRoadmInterface121 {
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class, logicalConnPoint
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint
                 + "-ODU");
         if (portMap.getSupportingOtu4() != null) {
             oduInterfaceBldr.setSupportingInterface(portMap.getSupportingOtu4());
@@ -180,7 +181,7 @@ public class OpenRoadmInterface121 {
                 .setPayloadType("07")
                 .setExpPayloadType("07");
         OduBuilder oduIfBuilder = new OduBuilder()
-                .setRate(ODU4.class)
+                .setRate(ODU4.VALUE)
                 .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
                 .setOpu(opuBldr.build());
 
@@ -216,7 +217,7 @@ public class OpenRoadmInterface121 {
                     nodeId, logicalConnPoint));
         }
         // Create generic interface
-        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
                 spectrumInformation.getIdentifierFromParams(logicalConnPoint));
 
         // OCH interface specific data
@@ -248,17 +249,16 @@ public class OpenRoadmInterface121 {
                 "Unable to get mapping from PortMapping for node %s and logical connection port %s",
                     nodeId, logicalConnPoint));
         }
-        OchAttributes.ModulationFormat modulationFormat = OchAttributes.ModulationFormat.DpQpsk;
-        Optional<OchAttributes.ModulationFormat> optionalModulationFormat = OchAttributes.ModulationFormat
+        ModulationFormat modulationFormat = OchAttributes.ModulationFormat
                 .forName(spectrumInformation.getModulationFormat());
-        if (optionalModulationFormat.isPresent()) {
-            modulationFormat =  optionalModulationFormat.get();
+        if (modulationFormat == null) {
+            modulationFormat = OchAttributes.ModulationFormat.DpQpsk;
         }
         // OCH interface specific data
         OchBuilder ocIfBuilder = new OchBuilder()
                 .setWavelengthNumber(spectrumInformation.getWaveLength())
                 .setModulationFormat(modulationFormat)
-                .setRate(R100G.class)
+                .setRate(R100G.VALUE)
                 .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")));
 
         // Create Interface1 type object required for adding as augmentation
@@ -267,7 +267,7 @@ public class OpenRoadmInterface121 {
                 .Interface1Builder ochIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel
                 .interfaces.rev161014.Interface1Builder();
         // Create generic interface
-        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
                 spectrumInformation.getIdentifierFromParams(logicalConnPoint));
         ochInterfaceBldr.addAugmentation(ochIf1Builder.setOch(ocIfBuilder.build()).build());
 
@@ -288,7 +288,7 @@ public class OpenRoadmInterface121 {
     public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
         if (mapping.getSupportingOms() == null) {
             // Create generic interface
-            InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.class,
+            InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.VALUE,
                 "OMS-" + mapping.getLogicalConnectionPoint());
             if (mapping.getSupportingOts() != null) {
                 omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
@@ -308,7 +308,7 @@ public class OpenRoadmInterface121 {
     public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
         if (mapping.getSupportingOts() == null) {
             // Create generic interface
-            InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.class, "OTS-"
+            InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-"
                     + mapping.getLogicalConnectionPoint());
             // OTS interface augmentation specific data
             OtsBuilder otsIfBuilder = new OtsBuilder();
index 9a2c95ff32414053e7c6fde081b6cec74896452f..e41c866faebc89373f972b0d47b7983599a9370c 100644 (file)
@@ -102,7 +102,7 @@ public class OpenRoadmInterface221 {
             .setFec(EthAttributes.Fec.Off)
             .setSpeed(Uint32.valueOf(100000));
 
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(mapping, EthernetCsmacd.class,
+        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(mapping, EthernetCsmacd.VALUE,
             logicalConnPoint + "-ETHERNET");
         // Create Interface1 type object required for adding as augmentation
         Interface1Builder ethIf1Builder = new Interface1Builder();
@@ -150,7 +150,7 @@ public class OpenRoadmInterface221 {
                 spectrumInformation.getMinFrequency(), spectrumInformation.getMaxFrequency(),
                 spectrumInformation.getCenterFrequency());
         InterfaceBuilder mcInterfaceBldr = createGenericInterfaceBuilder(portMap,
-            MediaChannelTrailTerminationPoint.class,
+            MediaChannelTrailTerminationPoint.VALUE,
             spectrumInformation.getIdentifierFromParams(logicalConnPoint, "mc"))
                 .setSupportingInterface(portMap.getSupportingOms());
         McTtpBuilder mcTtpBuilder = new McTtpBuilder()
@@ -184,7 +184,7 @@ public class OpenRoadmInterface221 {
         //TODO : Check this method
         String nmcName = spectrumInformation.getIdentifierFromParams(logicalConnPoint, "nmc");
         InterfaceBuilder nmcInterfaceBldr = createGenericInterfaceBuilder(portMap,
-            NetworkMediaChannelConnectionTerminationPoint.class, nmcName);
+            NetworkMediaChannelConnectionTerminationPoint.VALUE, nmcName);
         if (logicalConnPoint.contains("DEG")) {
             nmcInterfaceBldr.setSupportingInterface(mcName);
         }
@@ -208,16 +208,14 @@ public class OpenRoadmInterface221 {
         SpectrumInformation spectrumInformation)
         throws OpenRoadmInterfaceException {
         // TODO : Check this method
-        ModulationFormat modulationFormat = ModulationFormat.DpQpsk;
-        Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-                .forName(spectrumInformation.getModulationFormat());
-        if (optionalModulationFormat.isPresent()) {
-            modulationFormat =  optionalModulationFormat.get();
+        ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+        if (modulationFormat == null) {
+            modulationFormat = ModulationFormat.DpQpsk;
         }
         // OCH interface specific data
         OchBuilder ocIfBuilder = new OchBuilder()
             .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
-            .setRate(R100G.class)
+            .setRate(R100G.VALUE)
             .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
             .setModulationFormat(modulationFormat);
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
@@ -227,7 +225,7 @@ public class OpenRoadmInterface221 {
                     nodeId, logicalConnPoint));
         }
         // Create generic interface
-        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
             spectrumInformation.getIdentifierFromParams(logicalConnPoint));
         // Create Interface1 type object required for adding as augmentation
         // TODO look at imports of different versions of class
@@ -255,7 +253,7 @@ public class OpenRoadmInterface221 {
                     String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
 
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
             logicalConnPoint + "-ODU4");
         if (mapping.getSupportingOtu4() != null) {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOtu4());
@@ -264,19 +262,19 @@ public class OpenRoadmInterface221 {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
         }
         // ODU interface specific data
-        Class<? extends OduFunctionIdentity> oduFunction;
+        OduFunctionIdentity oduFunction;
         MonitoringMode monitoringMode;
         Opu opu = null;
         if (isCTP) {
-            oduFunction = ODUCTP.class;
+            oduFunction = ODUCTP.VALUE;
             monitoringMode = MonitoringMode.Monitored;
         } else {
             // For TPDR it can be both CTP and TTP
             if (mapping.getXponderType() == XpdrNodeTypes.Tpdr) {
-                oduFunction = ODUTTPCTP.class;
+                oduFunction = ODUTTPCTP.VALUE;
                 // For switch-ponder we still use TTP
             } else {
-                oduFunction = ODUTTP.class;
+                oduFunction = ODUTTP.VALUE;
             }
             monitoringMode = MonitoringMode.Terminated;
             opu = new OpuBuilder()
@@ -285,7 +283,7 @@ public class OpenRoadmInterface221 {
                 .build();
         }
         OduBuilder oduIfBuilder = new OduBuilder()
-                .setRate(ODU4.class)
+                .setRate(ODU4.VALUE)
                 .setOduFunction(oduFunction)
                 .setMonitoringMode(monitoringMode)
                 .setOpu(opu);
@@ -325,7 +323,7 @@ public class OpenRoadmInterface221 {
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
                     nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
             logicalConnPoint + "-ODU");
         oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
 
@@ -335,7 +333,7 @@ public class OpenRoadmInterface221 {
                 .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
                 .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"));
         OduBuilder oduIfBuilder = new OduBuilder()
-                .setRate(ODU4.class)
+                .setRate(ODU4.VALUE)
                 .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
                 .setOpu(opuBldr.build());
 
@@ -363,7 +361,7 @@ public class OpenRoadmInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
             alogicalConnPoint + "-ODU");
         oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
 
@@ -373,7 +371,7 @@ public class OpenRoadmInterface221 {
             .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
             .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"));
         OduBuilder oduIfBuilder = new OduBuilder()
-            .setRate(ODU4.class)
+            .setRate(ODU4.VALUE)
             .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
             .setOpu(opuBldr.build())
             .setTxSapi(portMapA.getLcpHashVal())
@@ -401,14 +399,14 @@ public class OpenRoadmInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.class,
+        InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
             logicalConnPoint + "-OTU");
         otuInterfaceBldr.setSupportingInterface(supportOchInterface);
 
         // OTU interface specific data
         OtuBuilder otuIfBuilder = new OtuBuilder()
             .setFec(OtuAttributes.Fec.Scfec)
-            .setRate(OTU4.class);
+            .setRate(OTU4.VALUE);
         if (apiInfoA != null) {
             otuIfBuilder.setTxSapi(apiInfoA.getSapi())
                 .setTxDapi(apiInfoA.getDapi())
@@ -438,7 +436,7 @@ public class OpenRoadmInterface221 {
         return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotName);
     }
 
-    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
+    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
         String key) {
         return new InterfaceBuilder()
                 .setDescription("  TBD   ")
@@ -454,7 +452,7 @@ public class OpenRoadmInterface221 {
     public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
         if (mapping.getSupportingOms() == null) {
             // Create generic interface
-            InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.class,
+            InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.VALUE,
                 "OMS-" + mapping.getLogicalConnectionPoint());
             if (mapping.getSupportingOts() != null) {
                 omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
@@ -474,7 +472,7 @@ public class OpenRoadmInterface221 {
     public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
         if (mapping.getSupportingOts() == null) {
             // Create generic interface
-            InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.class, "OTS-"
+            InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-"
                 + mapping.getLogicalConnectionPoint());
             // OTS interface augmentation specific data
             OtsBuilder otsIfBuilder = new OtsBuilder();
@@ -551,20 +549,20 @@ public class OpenRoadmInterface221 {
             throw new OpenRoadmInterfaceException(
                     String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
                 logicalConnPoint + "-ODU4");
         oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
 
         // ODU interface specific data
         OduBuilder oduIfBuilder = new OduBuilder()
-                .setRate(ODU4.class)
+                .setRate(ODU4.VALUE)
                 .setMonitoringMode(OduAttributes.MonitoringMode.Terminated);
 
         // Set Opu attributes
         OpuBuilder opuBldr = new OpuBuilder()
                 .setPayloadType(PayloadTypeDef.getDefaultInstance("21"))
                 .setExpPayloadType(PayloadTypeDef.getDefaultInstance("21"));
-        oduIfBuilder.setOduFunction(ODUTTP.class)
+        oduIfBuilder.setOduFunction(ODUTTP.VALUE)
                 .setOpu(opuBldr.build());
 
         // Create Interface1 type object required for adding as augmentation
@@ -592,13 +590,13 @@ public class OpenRoadmInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
             alogicalConnPoint + "-ODU4");
         oduInterfaceBldr.setSupportingInterface(asupportingOtuInterface);
 
         // ODU interface specific data
         OduBuilder oduIfBuilder = new OduBuilder()
-            .setRate(ODU4.class)
+            .setRate(ODU4.VALUE)
             .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
             .setTxSapi(portMapA.getLcpHashVal())
             .setTxDapi(portMapZ.getLcpHashVal())
@@ -610,7 +608,7 @@ public class OpenRoadmInterface221 {
         OpuBuilder opuBldr = new OpuBuilder()
             .setPayloadType(PayloadTypeDef.getDefaultInstance("21"))
             .setExpPayloadType(PayloadTypeDef.getDefaultInstance("21"));
-        oduIfBuilder.setOduFunction(ODUTTP.class)
+        oduIfBuilder.setOduFunction(ODUTTP.VALUE)
             .setOpu(opuBldr.build());
 
         // Create Interface1 type object required for adding as augmentation
index 3faf35b87e34edf7640705239cb1a522ded8b0c7..d53a7b65a150a4ca614c6d96860fa0bad8573b21 100644 (file)
@@ -13,7 +13,6 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import java.util.stream.IntStream;
 import org.opendaylight.transportpce.common.StringConstants;
@@ -113,18 +112,18 @@ public class OpenRoadmInterface710 {
         }
         // Ethernet interface specific data
         EthernetBuilder ethIfBuilder = new EthernetBuilder()
-            .setFec(Rsfec.class)
+            .setFec(Rsfec.VALUE)
             // Default set to 400G
             .setSpeed(Uint32.valueOf(400000));
         // We have to differentiate if-100GE vs if-400GE
-        if (portMap.getSupportedInterfaceCapability().contains(If100GE.class)) {
+        if (portMap.getSupportedInterfaceCapability().contains(If100GE.VALUE)) {
             ethIfBuilder
                 // There could be different client pluggables on either side QSFP28-LR4 or QSFP28-FR4
                 // LR4-requires FEC to off, while FR4 can accept even when FEC is off
-                .setFec(Off.class) // For 100G OFec mode, the fec is off
+                .setFec(Off.VALUE) // For 100G OFec mode, the fec is off
                 .setSpeed(Uint32.valueOf(100000));
         }
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
+        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
             logicalConnPoint + "-ETHERNET");
 
         // Create Interface1 type object required for adding as augmentation
@@ -144,16 +143,14 @@ public class OpenRoadmInterface710 {
         SpectrumInformation spectrumInformation)
         throws OpenRoadmInterfaceException {
 
-        ModulationFormat   modulationFormat = ModulationFormat.DpQpsk;
-        Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-            .forName(spectrumInformation.getModulationFormat());
-        if (optionalModulationFormat.isPresent()) {
-            modulationFormat =  optionalModulationFormat.get();
+        ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+        if (modulationFormat == null) {
+            modulationFormat =  ModulationFormat.DpQpsk;
         }
         // OCH interface specific data
         OchBuilder ocIfBuilder = new OchBuilder()
             .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
-            .setRate(R100G.class)
+            .setRate(R100G.VALUE)
             .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
             .setModulationFormat(modulationFormat);
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
@@ -164,7 +161,7 @@ public class OpenRoadmInterface710 {
         }
         // Create generic interface
         InterfaceBuilder
-            ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
+            ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
             spectrumInformation.getIdentifierFromParams(logicalConnPoint));
         // Create Interface1 type object required for adding as augmentation
         // TODO look at imports of different versions of class
@@ -188,14 +185,9 @@ public class OpenRoadmInterface710 {
             SpectrumInformation spectrumInformation)
             throws OpenRoadmInterfaceException {
 
-        ModulationFormat modulationFormat;
-        Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-            .forName(spectrumInformation.getModulationFormat());
-        if (optionalModulationFormat.isPresent()) {
-            modulationFormat =  optionalModulationFormat.get();
-        } else {
-            throw new OpenRoadmInterfaceException(
-                String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
+        ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+        if (modulationFormat == null) {
+            throw new OpenRoadmInterfaceException(String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
         }
 
         // OTSI interface specific data
@@ -203,7 +195,7 @@ public class OpenRoadmInterface710 {
             .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
             .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
             .setProvisionMode(ProvisionModeType.Explicit)
-            .setFec(Ofec.class)
+            .setFec(Ofec.VALUE)
             .setModulationFormat(modulationFormat);
 
         // Set the Flexo values
@@ -216,9 +208,9 @@ public class OpenRoadmInterface710 {
                 LOG.info("Given modulation format and spectral width 50GHz {} and thus rate is 100G",
                     modulationFormat);
                 LOG.info("FOIC is 1.4 for 31.6 Gbaud and rate is 100");
-                flexoBuilder.setFoicType(Foic14.class)
+                flexoBuilder.setFoicType(Foic14.VALUE)
                     .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1))));
-                otsiBuilder.setOtsiRate(R100GOtsi.class)
+                otsiBuilder.setOtsiRate(R100GOtsi.VALUE)
                     .setFlexo(flexoBuilder.build());
                 break;
             case 200:
@@ -226,32 +218,32 @@ public class OpenRoadmInterface710 {
                 if (modulationFormat == ModulationFormat.DpQam16) {
                     LOG.info("FOIC is 2.8 for 31.6 Gbaud and rate is 200");
                     // FOIC rate is different
-                    flexoBuilder.setFoicType(Foic28.class)
+                    flexoBuilder.setFoicType(Foic28.VALUE)
                         .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2))));
                 } else {
                     // default is dp-qpsk for 200G under 63.1 GBaud
-                    flexoBuilder.setFoicType(Foic24.class)
+                    flexoBuilder.setFoicType(Foic24.VALUE)
                         .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2))));
                 }
-                otsiBuilder.setOtsiRate(R200GOtsi.class)
+                otsiBuilder.setOtsiRate(R200GOtsi.VALUE)
                     .setFlexo(flexoBuilder.build());
                 break;
             case 300:
                 LOG.info("Given modulation format is {} and thus rate is 300G", modulationFormat);
-                flexoBuilder.setFoicType(Foic36.class)
+                flexoBuilder.setFoicType(Foic36.VALUE)
                     .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
                         Uint8.valueOf(3))));
-                otsiBuilder.setOtsiRate(R300GOtsi.class)
+                otsiBuilder.setOtsiRate(R300GOtsi.VALUE)
                     .setFlexo(flexoBuilder.build());
                 break;
             case 400:
                 // Default baud-rate is 63.1 Gbaud
                 LOG.info("Given modulation format is {} and thus rate is 400G", modulationFormat);
-                flexoBuilder.setFoicType(Foic48.class)
+                flexoBuilder.setFoicType(Foic48.VALUE)
                     .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
                         Uint8.valueOf(3), Uint8.valueOf(4))));
                 otsiBuilder.setModulationFormat(modulationFormat)
-                    .setOtsiRate(R400GOtsi.class)
+                    .setOtsiRate(R400GOtsi.VALUE)
                     .setFlexo(flexoBuilder.build());
                 break;
             default:
@@ -271,7 +263,7 @@ public class OpenRoadmInterface710 {
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
         // Create generic interface
-        InterfaceBuilder otsiInterfaceBldr = createGenericInterfaceBuilder(portMap, Otsi.class,
+        InterfaceBuilder otsiInterfaceBldr = createGenericInterfaceBuilder(portMap, Otsi.VALUE,
             spectrumInformation.getIdentifierFromParams(logicalConnPoint));
         // Create Interface1 type object required for adding as augmentation
         org.opendaylight.yang.gen.v1.http
@@ -304,14 +296,9 @@ public class OpenRoadmInterface710 {
                     nodeId, logicalConnPoint));
         }
         // Check the modulation format
-        ModulationFormat modulationFormat;
-        Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
-            .forName(spectrumInformation.getModulationFormat());
-        if (optionalModulationFormat.isPresent()) {
-            modulationFormat =  optionalModulationFormat.get();
-        } else {
-            throw new OpenRoadmInterfaceException(
-                String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
+        ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
+        if (modulationFormat == null) {
+            throw new OpenRoadmInterfaceException(String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
         }
         int serviceRate = getServiceRate(modulationFormat, spectrumInformation);
         // Create an OTSI group object
@@ -320,16 +307,16 @@ public class OpenRoadmInterface710 {
         boolean rateNotFound = false;
         switch (serviceRate) {
             case 100:
-                otsiGroupBuilder.setGroupRate(R100GOtsi.class);
+                otsiGroupBuilder.setGroupRate(R100GOtsi.VALUE);
                 break;
             case 200:
-                otsiGroupBuilder.setGroupRate(R200GOtsi.class);
+                otsiGroupBuilder.setGroupRate(R200GOtsi.VALUE);
                 break;
             case 300:
-                otsiGroupBuilder.setGroupRate(R300GOtsi.class);
+                otsiGroupBuilder.setGroupRate(R300GOtsi.VALUE);
                 break;
             case 400:
-                otsiGroupBuilder.setGroupRate(R400GOtsi.class);
+                otsiGroupBuilder.setGroupRate(R400GOtsi.VALUE);
                 break;
             default:
                 LOG.error("Rate {} is not supported", serviceRate);
@@ -342,7 +329,7 @@ public class OpenRoadmInterface710 {
         }
 
         // Create generic interface
-        InterfaceBuilder otsiGroupInterfaceBldr = createGenericInterfaceBuilder(portMap, OtsiGroup.class,
+        InterfaceBuilder otsiGroupInterfaceBldr = createGenericInterfaceBuilder(portMap, OtsiGroup.VALUE,
             logicalConnPoint + String.join("-", "", "OTSIGROUP", serviceRate + "G"));
 
         // Create a list
@@ -375,10 +362,10 @@ public class OpenRoadmInterface710 {
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
         String interfaceOchOtsiOtsigroup = null;
-        if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+        if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
             // create OCH interface
             interfaceOchOtsiOtsigroup = createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation);
-        } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+        } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
             // Create OTSi and OTSi-group and concat the names of the interface
             String interfaceOtsiName = createOpenRoadmOtsiInterface(nodeId, logicalConnPoint, spectrumInformation);
             // Concat the two names for this interface
@@ -399,7 +386,7 @@ public class OpenRoadmInterface710 {
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
         InterfaceBuilder
-            otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.class,
+            otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
             logicalConnPoint + "-OTU4");
         // Supporting interface list
         Set<String> listSupportingOChInterface = new HashSet<>();
@@ -410,8 +397,8 @@ public class OpenRoadmInterface710 {
         org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.otu.container.OtuBuilder
             otuIfBuilder = new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu
             .interfaces.rev200529.otu.container.OtuBuilder()
-            .setFec(Scfec.class)
-            .setRate(OTU4.class);
+            .setFec(Scfec.VALUE)
+            .setRate(OTU4.VALUE);
         if (apiInfoA != null) {
             otuIfBuilder.setTxSapi(apiInfoA.getSapi())
                 .setTxDapi(apiInfoA.getDapi())
@@ -449,7 +436,7 @@ public class OpenRoadmInterface710 {
         }
         // Create an OTUCn object
         OtuBuilder otuBuilder = new OtuBuilder()
-            .setRate(OTUCn.class)
+            .setRate(OTUCn.VALUE)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
             .setDegmIntervals(Uint8.valueOf(2))
@@ -499,7 +486,7 @@ public class OpenRoadmInterface710 {
                 String.format(RATE_EXCEPTION_MESSAGE));
         }
 
-        InterfaceBuilder otuInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOtu.class,
+        InterfaceBuilder otuInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
             logicalConnPoint + "-OTUC" + otucnrate);
 
         // Create a list
@@ -533,11 +520,11 @@ public class OpenRoadmInterface710 {
         // Depending on OCH-OTU4-ODU4 interface or OTSi-OTSi-group, supporting interface should
         // reflect that
         String interfaceOtu4Otucn = null;
-        if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+        if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
             // create OTU4 interface
             interfaceOtu4Otucn = createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportingInterface,
                 apiInfoA, apiInfoZ);
-        } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+        } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
             // Create OTUCn
             interfaceOtu4Otucn = createOpenRoadmOtucnInterface(nodeId, logicalConnPoint, supportingInterface,
                 apiInfoA, apiInfoZ);
@@ -554,7 +541,7 @@ public class OpenRoadmInterface710 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
             logicalConnPoint + "-ODU4");
         Set<String> listSupportingOtu4Interface = new HashSet<>();
         if (mapping.getSupportingOtu4() != null) {
@@ -569,8 +556,8 @@ public class OpenRoadmInterface710 {
 
         // Create an ODU4 object
         OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODU4.class)
-            .setOduFunction(ODUTTP.class)
+            .setRate(ODU4.VALUE)
+            .setOduFunction(ODUTTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setOpu(opuBuilder.build());
 
@@ -618,8 +605,8 @@ public class OpenRoadmInterface710 {
 
         // Create an ODUCn object
         OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.class)
-            .setOduFunction(ODUTTP.class)
+            .setRate(ODUCn.VALUE)
+            .setOduFunction(ODUTTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
@@ -649,7 +636,7 @@ public class OpenRoadmInterface710 {
 
         oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
 
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
             logicalConnPoint + "-ODUC" + oducnrate);
 
         oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
@@ -697,8 +684,8 @@ public class OpenRoadmInterface710 {
 
         // Create an ODUC4 object
         OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.class)
-            .setOduFunction(ODUTTP.class)
+            .setRate(ODUCn.VALUE)
+            .setOduFunction(ODUTTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
@@ -721,7 +708,7 @@ public class OpenRoadmInterface710 {
 
         oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
 
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
             alogicalConnPoint + ODUC + oducnrate);
 
         // Create a list
@@ -775,7 +762,7 @@ public class OpenRoadmInterface710 {
 
         // Create an ODUFlex object
         OduBuilder oduBuilder = new OduBuilder()
-            .setOduFunction(ODUTTPCTP.class)
+            .setOduFunction(ODUTTPCTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
@@ -786,19 +773,19 @@ public class OpenRoadmInterface710 {
         if (rate.equals("1")) {
             opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
                 .setPayloadType(PayloadTypeDef.getDefaultInstance("07"));
-            oduBuilder.setRate(ODU4.class);
+            oduBuilder.setRate(ODU4.VALUE);
             logicalConnPoint += "-ODU4";
         } else if (rate.equals("4")) {
             opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
                 .setPayloadType(PayloadTypeDef.getDefaultInstance("32"));
-            oduBuilder.setRate(ODUflexCbr.class).setOduflexCbrService(ODUflexCbr400G.class);
+            oduBuilder.setRate(ODUflexCbr.VALUE).setOduflexCbrService(ODUflexCbr400G.VALUE);
             logicalConnPoint += "-ODUFLEX";
         }
 
         // Build the OPU container to the ODU builder
         oduBuilder.setOpu(opuBuilder.build());
 
-        InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+        InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
             logicalConnPoint);
 
         Set<String> listSupportingOtucnInterface = new HashSet<>();
@@ -860,7 +847,7 @@ public class OpenRoadmInterface710 {
 
         // Create an ODUFlex object
         OduBuilder oduBuilder = new OduBuilder()
-            .setOduFunction(ODUTTPCTP.class)
+            .setOduFunction(ODUTTPCTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
@@ -872,16 +859,16 @@ public class OpenRoadmInterface710 {
         if (rate.equals("1")) {
             opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
                 .setPayloadType(PayloadTypeDef.getDefaultInstance("07"));
-            oduBuilder.setRate(ODU4.class);
+            oduBuilder.setRate(ODU4.VALUE);
             alogicalConnPoint += "-ODU4";
         } else if (rate.equals("4")) {
             opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
                 .setPayloadType(PayloadTypeDef.getDefaultInstance("32"));
-            oduBuilder.setRate(ODUflexCbr.class).setOduflexCbrService(ODUflexCbr400G.class);
+            oduBuilder.setRate(ODUflexCbr.VALUE).setOduflexCbrService(ODUflexCbr400G.VALUE);
             alogicalConnPoint += "-ODUFLEX";
         }
 
-        InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+        InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
             alogicalConnPoint);
 
 
@@ -920,10 +907,10 @@ public class OpenRoadmInterface710 {
         // reflect that
         String interfaceOdu4OducnOduflex = null;
         // Depending on OTU4 or OTUCn, supporting interface should reflect that
-        if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
+        if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
             // create OTU4 interface
             interfaceOdu4OducnOduflex = createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
-        } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.class)) {
+        } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
             // Create ODUCn and ODUFlex interface.
             String interfaceOducn = createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
             interfaceOdu4OducnOduflex  = interfaceOducn + "#"
@@ -950,8 +937,8 @@ public class OpenRoadmInterface710 {
 
         // Create an ODUC4 object
         OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.class)
-            .setOduFunction(ODUTTP.class)
+            .setRate(ODUCn.VALUE)
+            .setOduFunction(ODUTTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
@@ -970,7 +957,7 @@ public class OpenRoadmInterface710 {
 
         oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
 
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
             logicalConnPoint + ODUC + oducnrate);
 
         // Create a list
@@ -1022,8 +1009,8 @@ public class OpenRoadmInterface710 {
 
         // Create an ODUCn object
         OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.class)
-            .setOduFunction(ODUTTP.class)
+            .setRate(ODUCn.VALUE)
+            .setOduFunction(ODUTTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
@@ -1046,7 +1033,7 @@ public class OpenRoadmInterface710 {
 
         oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
 
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
             alogicalConnPoint + ODUC + oducnrate);
 
         // Create a list
@@ -1075,7 +1062,7 @@ public class OpenRoadmInterface710 {
         return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, logicalConnectionPoint, spectralSlotName);
     }
 
-    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
+    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
             String key) {
         return new org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.interfaces.grp.InterfaceBuilder()
             .setDescription("  TBD   ")
index 136f03bfa7b105b9e60e8aee6e2357f66d2673b8..3ce172da3b5f5363820501b8aee79122682f2a4c 100644 (file)
@@ -68,8 +68,7 @@ public class OpenRoadmOtnInterface221 {
         // Ethernet interface specific data
         EthernetBuilder ethIfBuilder = new EthernetBuilder()
                 .setSpeed(Uint32.valueOf(1000));
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(
-                portMap, EthernetCsmacd.class,
+        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
                 logicalConnPoint + "-ETHERNET1G");
         // Create Interface1 type object required for adding as augmentation
         Interface1Builder ethIf1Builder = new Interface1Builder();
@@ -92,8 +91,7 @@ public class OpenRoadmOtnInterface221 {
                 nodeId, logicalConnPoint));
     }
 
-    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap,
-            Class<? extends InterfaceType> type, String key) {
+    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type, String key) {
         return new InterfaceBuilder()
                 // .setDescription(" TBD ")
                 // .setCircuitId(" TBD ")
@@ -118,7 +116,7 @@ public class OpenRoadmOtnInterface221 {
                 .setSpeed(Uint32.valueOf(10000));
         // Create Interface1 type object required for adding as augmentation
         Interface1Builder ethIf1Builder = new Interface1Builder();
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
+        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
                 logicalConnPoint + "-ETHERNET10G").addAugmentation(ethIf1Builder.setEthernet(ethIfBuilder.build())
                         .build());
         // Post interface on the device
@@ -141,7 +139,7 @@ public class OpenRoadmOtnInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
             logicalConnPoint + "-ODU2e");
         if (mapping.getSupportingOdu4() != null) {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOdu4());
@@ -150,12 +148,12 @@ public class OpenRoadmOtnInterface221 {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
         }
 
-        Class<? extends OduFunctionIdentity> oduFunction;
+        OduFunctionIdentity oduFunction;
         MonitoringMode monitoringMode;
         Opu opu = null;
         ParentOduAllocation parentOduAllocation = null;
         if (isCTP) {
-            oduFunction = ODUCTP.class;
+            oduFunction = ODUCTP.VALUE;
             monitoringMode = MonitoringMode.Monitored;
             Set<Uint16> tribSlots = new HashSet<>();
             Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
@@ -167,7 +165,7 @@ public class OpenRoadmOtnInterface221 {
                     .setTribSlots(tribSlots)
                     .build();
         } else {
-            oduFunction = ODUTTPCTP.class;
+            oduFunction = ODUTTPCTP.VALUE;
             monitoringMode = MonitoringMode.Terminated;
             opu = new OpuBuilder()
                 .setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
@@ -175,7 +173,7 @@ public class OpenRoadmOtnInterface221 {
                 .build();
         }
         OduBuilder oduIfBuilder = new OduBuilder()
-            .setRate(ODU2e.class)
+            .setRate(ODU2e.VALUE)
             .setOduFunction(oduFunction)
             .setMonitoringMode(monitoringMode)
             .setOpu(opu)
@@ -217,7 +215,7 @@ public class OpenRoadmOtnInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
             logicalConnPoint + "-ODU0");
         if (mapping.getSupportingOdu4() != null) {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOdu4());
@@ -226,12 +224,12 @@ public class OpenRoadmOtnInterface221 {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
         }
 
-        Class<? extends OduFunctionIdentity> oduFunction;
+        OduFunctionIdentity oduFunction;
         MonitoringMode monitoringMode;
         Opu opu = null;
         ParentOduAllocation parentOduAllocation = null;
         if (isCTP) {
-            oduFunction = ODUCTP.class;
+            oduFunction = ODUCTP.VALUE;
             monitoringMode = MonitoringMode.Monitored;
             Set<Uint16> tribSlots = new HashSet<>();
             Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
@@ -243,7 +241,7 @@ public class OpenRoadmOtnInterface221 {
                     .setTribSlots(tribSlots)
                     .build();
         } else {
-            oduFunction = ODUTTPCTP.class;
+            oduFunction = ODUTTPCTP.VALUE;
             monitoringMode = MonitoringMode.Terminated;
             opu = new OpuBuilder()
                 .setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
@@ -251,7 +249,7 @@ public class OpenRoadmOtnInterface221 {
                 .build();
         }
         OduBuilder oduIfBuilder = new OduBuilder()
-            .setRate(ODU0.class)
+            .setRate(ODU0.VALUE)
             .setOduFunction(oduFunction)
             .setMonitoringMode(monitoringMode)
             .setOpu(opu)
@@ -293,7 +291,7 @@ public class OpenRoadmOtnInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
             logicalConnPoint + "-ODU2");
         if (mapping.getSupportingOdu4() != null) {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOdu4());
@@ -302,12 +300,12 @@ public class OpenRoadmOtnInterface221 {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
         }
 
-        Class<? extends OduFunctionIdentity> oduFunction;
+        OduFunctionIdentity oduFunction;
         MonitoringMode monitoringMode;
         Opu opu = null;
         ParentOduAllocation parentOduAllocation = null;
         if (isCTP) {
-            oduFunction = ODUCTP.class;
+            oduFunction = ODUCTP.VALUE;
             monitoringMode = MonitoringMode.Monitored;
             Set<Uint16> tribSlots = new HashSet<>();
             Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
@@ -319,7 +317,7 @@ public class OpenRoadmOtnInterface221 {
                     .setTribSlots(tribSlots)
                     .build();
         } else {
-            oduFunction = ODUTTPCTP.class;
+            oduFunction = ODUTTPCTP.VALUE;
             monitoringMode = MonitoringMode.Terminated;
             opu = new OpuBuilder()
                 .setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
@@ -327,7 +325,7 @@ public class OpenRoadmOtnInterface221 {
                 .build();
         }
         OduBuilder oduIfBuilder = new OduBuilder()
-            .setRate(ODU2.class)
+            .setRate(ODU2.VALUE)
             .setOduFunction(oduFunction)
             .setMonitoringMode(monitoringMode)
             .setOpu(opu)
index 8c5903be109a11b774424e34e053992cb8849f53..8764dba3f69c7b52a6ed2e48b68e259878fd9adc 100644 (file)
@@ -60,10 +60,9 @@ public class OpenRoadmOtnInterface710 {
 
         // Ethernet interface specific data
         EthernetBuilder ethIfBuilder = new EthernetBuilder()
-            .setFec(Off.class)
+            .setFec(Off.VALUE)
             .setSpeed(Uint32.valueOf(100000));
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(
-            portMap, EthernetCsmacd.class,
+        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
             logicalConnPoint + "-ETHERNET-100G");
         // Create Interface1 type object required for adding as augmentation
         Interface1Builder ethIf1Builder = new Interface1Builder();
@@ -112,12 +111,11 @@ public class OpenRoadmOtnInterface710 {
         // Supporting interface is a list for B100G (7.1) device models
         supportingInterfaceList.add(supportingInterface);
 
-        InterfaceBuilder oduIfBuilder = createGenericInterfaceBuilder(
-            portMap, OtnOdu.class, logicalConnPoint + "-ODU4")
+        InterfaceBuilder oduIfBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU4")
             .setSupportingInterfaceList(supportingInterfaceList);
         // Agument ODU4 specific interface data
-        OduBuilder oduBuilder = new OduBuilder().setRate(ODU4.class)
-            .setOduFunction(ODUTTPCTP.class)
+        OduBuilder oduBuilder = new OduBuilder().setRate(ODU4.VALUE)
+            .setOduFunction(ODUTTPCTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated);
         LOG.debug("Inside the ODU4 creation {} {} {}", isNetworkPort, minTribSlotNumber.getValue(),
             maxTribSlotNumber.getValue());
@@ -139,7 +137,7 @@ public class OpenRoadmOtnInterface710 {
                 .setTribPortNumber(tribPortNumber)
                 .setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(opucnTribSlotDefList).build());
             // reset the ODU function as ODUCTP and the monitoring moode
-            oduBuilder.setOduFunction(ODUCTP.class)
+            oduBuilder.setOduFunction(ODUCTP.VALUE)
                 .setMonitoringMode(MonitoringMode.NotTerminated)
                 .setParentOduAllocation(parentOduAllocationBuilder.build());
         }
@@ -162,8 +160,7 @@ public class OpenRoadmOtnInterface710 {
         return oduIfBuilder.getName();
     }
 
-    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap,
-        Class<? extends InterfaceType> type, String key) {
+    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type, String key) {
         return new InterfaceBuilder()
             // .setDescription(" TBD ")
             // .setCircuitId(" TBD ")
index f8e22e28b68fa793ab8edb546a37b04c47a279cb..48f0aa14dc378060e99b3a7a8419dfa2417967f6 100644 (file)
@@ -294,8 +294,8 @@ public class RendererServiceOperationsImpl implements RendererServiceOperations
         }
         String serviceName =
             ServiceFormat.OTU.getName().equals(input.getServiceAEnd().getServiceFormat().getName())
-                ? input.getServiceAEnd().getOtuServiceRate().getSimpleName()
-                : input.getServiceAEnd().getOduServiceRate().getSimpleName();
+                ? input.getServiceAEnd().getOtuServiceRate().toString().split("\\{")[0]
+                : input.getServiceAEnd().getOduServiceRate().toString().split("\\{")[0];
         if (!formatRateMap.get(input.getServiceAEnd().getServiceFormat()).containsKey(serviceName)) {
             LOG.warn("Unable to get service-rate for service {} - unsupported service name {}",
                 input.getServiceName(), serviceName);
index 333b66f6a2c1bcd50a2c999c5097c597d82c0d56..b8d1668e6dd0e499ba1d9a0b8d8f85d3bbce5cb5 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.transportpce.servicehandler;
 
+import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.PathComputationRequestOutput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.path.computation.request.input.ServiceAEnd;
@@ -89,6 +90,33 @@ import org.slf4j.LoggerFactory;
 public final class ModelMappingUtils {
     private static final Logger LOG = LoggerFactory.getLogger(ModelMappingUtils.class);
 
+    private static final ImmutableMap<String, OduRateIdentity> ODU_RATE_MAP =
+        ImmutableMap.<String, OduRateIdentity>builder()
+            .put("ODU0", ODU0.VALUE)
+            .put("ODU1", ODU1.VALUE)
+            .put("ODU2", ODU2.VALUE)
+            .put("ODU2e", ODU2e.VALUE)
+            .put("ODU3", ODU3.VALUE)
+            .put("ODU4", ODU4.VALUE)
+            .put("ODUCn", ODUCn.VALUE)
+            .put("ODUflexCbr", ODUflexCbr.VALUE)
+            .put("ODUflexFlexe", ODUflexFlexe.VALUE)
+            .put("ODUflexGfp", ODUflexGfp.VALUE)
+            .put("ODUflexImp", ODUflexImp.VALUE)
+            .build();
+
+    private static final ImmutableMap<String, OtuRateIdentity> OTU_RATE_MAP =
+        ImmutableMap.<String, OtuRateIdentity>builder()
+            .put("OTU0", OTU0.VALUE)
+            .put("OTU1", OTU1.VALUE)
+            .put("OTU2", OTU2.VALUE)
+            .put("OTU2e", OTU2e.VALUE)
+            .put("OTU3", OTU3.VALUE)
+            .put("OTU4", OTU4.VALUE)
+            .put("OTUCn", OTUCn.VALUE)
+            .put("OTUflex", OTUflex.VALUE)
+            .build();
+
     private ModelMappingUtils() {
     }
 
@@ -157,74 +185,20 @@ public final class ModelMappingUtils {
             .build();
     }
 
-    private static Class<? extends OduRateIdentity> getOduServiceRate(
-            Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OduRateIdentity>
-                oduServiceRate) {
-        if (oduServiceRate == null) {
+    private static OduRateIdentity getOduServiceRate(OduRateIdentity oduServiceRate) {
+        if (oduServiceRate == null || !ODU_RATE_MAP.containsKey(oduServiceRate.toString())) {
+            LOG.error("ODU rate {} not recognized", oduServiceRate);
             return null;
         }
-        String oduRate = oduServiceRate.getSimpleName();
-        LOG.info("ODU rate = {}", oduRate);
-        //TODO a Map would probably be more indicated here
-        switch (oduRate) {
-            case "ODU0":
-                return ODU0.class;
-            case "ODU1":
-                return ODU1.class;
-            case "ODU2":
-                return ODU2.class;
-            case "ODU2e":
-                return ODU2e.class;
-            case "ODU3":
-                return ODU3.class;
-            case "ODU4":
-                return ODU4.class;
-            case "ODUCn":
-                return ODUCn.class;
-            case "ODUflexCbr":
-                return ODUflexCbr.class;
-            case "ODUflexFlexe":
-                return ODUflexFlexe.class;
-            case "ODUflexGfp":
-                return ODUflexGfp.class;
-            case "ODUflexImp":
-                return ODUflexImp.class;
-            default:
-                LOG.error("OTU rate {} not recognized", oduRate);
-        }
-        return null;
+        return ODU_RATE_MAP.get(oduServiceRate.toString());
     }
 
-    private static Class<? extends OtuRateIdentity> getOtuServiceRate(
-            Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OtuRateIdentity>
-                otuServiceRate) {
-        if (otuServiceRate == null) {
+    private static OtuRateIdentity getOtuServiceRate(OtuRateIdentity otuServiceRate) {
+        if (otuServiceRate == null || !OTU_RATE_MAP.containsKey(otuServiceRate.toString())) {
+            LOG.error("OTU rate {} not recognized", otuServiceRate);
             return null;
         }
-        String otuRate = otuServiceRate.getSimpleName();
-        LOG.info("OTU rate = {}", otuRate);
-        //TODO a Map would probably be more indicated here
-        switch (otuRate) {
-            case "OTU0":
-                return OTU0.class;
-            case "OTU1":
-                return OTU1.class;
-            case "OTU2":
-                return OTU2.class;
-            case "OTU2e":
-                return OTU2e.class;
-            case "OTU3":
-                return OTU3.class;
-            case "OTU4":
-                return OTU4.class;
-            case "OTUCn":
-                return OTUCn.class;
-            case "OTUflex":
-                return OTUflex.class;
-            default:
-                LOG.error("OTU rate {} not recognized", otuRate);
-        }
-        return null;
+        return OTU_RATE_MAP.get(otuServiceRate.toString());
     }
 
     public static org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
index 64d46b4cf7f33bbf4431f5c0f1078d52d147dc32..ed6a9a6be3bb1bc02d16cfde87ddf2cb25108b3a 100644 (file)
@@ -96,7 +96,7 @@ public class ServiceListener implements DataTreeChangeListener<Services> {
                         if (inputAfter.getAdministrativeState() == AdminStates.InService
                                 && inputAfter.getServiceResiliency() != null
                                 && inputAfter.getServiceResiliency().getResiliency() != null
-                                && inputAfter.getServiceResiliency().getResiliency().equals(Restorable.class)) {
+                                && inputAfter.getServiceResiliency().getResiliency().equals(Restorable.VALUE)) {
                             LOG.info("Attempting to reroute the service '{}'...", serviceInputName);
                             // It is used for hold off time purposes
                             mapServiceInputReroute.put(serviceInputName, null);
index 2d5b173eca3a1eb4b8e945395c7d36e25ba3abf1..3ca5f7c63e2c0768e373a13dcc9bf762c3bc4be6 100644 (file)
@@ -31,29 +31,25 @@ public final class ServicehandlerServiceResiliencyCheck {
      *         <code> false </code> otherwise
      */
     public static ComplianceCheckResult check(ServiceResiliency serviceResiliency) {
-        if (serviceResiliency.getResiliency() != null) {
-            switch (serviceResiliency.getResiliency().getSimpleName()) {
-                case "Unprotected":
-                    return checkUnprotectedResiliency(serviceResiliency);
-
-                case "UnprotectedDiverselyRouted":
-                    return checkUnprotectedDiverselyRoutedResiliency(serviceResiliency);
-
-                case "Protected":
-                    return checkProtectedResiliency(serviceResiliency);
-
-                case "Restorable":
-                case "ExternalTriggerRestorable":
-                    return checkRestorableAndExternalTriggerRestorableResiliency(serviceResiliency);
-
-                default:
-                    LOG.warn(LOG_RESILIENCY_TYPE_UNMANAGED);
-                    return new ComplianceCheckResult(false, LOG_RESILIENCY_TYPE_UNMANAGED);
-            }
-        } else {
+        if (serviceResiliency.getResiliency() == null) {
             LOG.warn(LOG_RESILIENCY_NULL);
             return new ComplianceCheckResult(false, LOG_RESILIENCY_NULL);
         }
+        String serviceResiliencyType = serviceResiliency.getResiliency().toString().split("\\{")[0];
+        switch (serviceResiliencyType) {
+            case "Unprotected":
+                return checkUnprotectedResiliency(serviceResiliency);
+            case "UnprotectedDiverselyRouted":
+                return checkUnprotectedDiverselyRoutedResiliency(serviceResiliency);
+            case "Protected":
+                return checkProtectedResiliency(serviceResiliency);
+            case "Restorable":
+            case "ExternalTriggerRestorable":
+                return checkRestorableAndExternalTriggerRestorableResiliency(serviceResiliency);
+            default:
+                LOG.warn(LOG_RESILIENCY_TYPE_UNMANAGED);
+                return new ComplianceCheckResult(false, LOG_RESILIENCY_TYPE_UNMANAGED);
+        }
     }
 
     private static ComplianceCheckResult checkUnprotectedResiliency(ServiceResiliency serviceResiliency) {
index b8d5290f08784e55871349b216fb007ae3dd4d06..f94d94b3e770187e95231cb537b89452769c9254 100755 (executable)
@@ -160,7 +160,7 @@ public class ServiceListenerTest {
         changes.add(ch);
         when(ch.getRootNode()).thenReturn(service);
 
-        ServiceResiliency serviceResiliency = new ServiceResiliencyBuilder().setResiliency(Restorable.class).build();
+        ServiceResiliency serviceResiliency = new ServiceResiliencyBuilder().setResiliency(Restorable.VALUE).build();
         Services serviceAfter = new ServicesBuilder(buildService(State.OutOfService, AdminStates.InService))
                 .setServiceResiliency(serviceResiliency)
                 .build();
index 22a728e7cfbec5827923589a9dc0d4b0d66a05d7..2bf3840a16778ccd589fbbc5b9e28045166fca65 100644 (file)
@@ -35,7 +35,7 @@ public class CheckCoherencyServiceResiliencyTest {
 
     @Test
     public void testCheckWhenUnprotectedResiliencyWithWrongAttributes() {
-        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Unprotected.class);
+        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Unprotected.VALUE);
 
         Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
         Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
@@ -52,14 +52,14 @@ public class CheckCoherencyServiceResiliencyTest {
     public void testCheckWhenUnprotectedResiliencyWithCorrectAttributes() {
         Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
                 new ServiceResiliencyBuilder()
-                        .setResiliency(Unprotected.class)
+                        .setResiliency(Unprotected.VALUE)
                         .build())
                 .hasPassed());
     }
 
     @Test
     public void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithWrongAttributes() {
-        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.class);
+        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.VALUE);
 
         Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
         Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
@@ -73,13 +73,13 @@ public class CheckCoherencyServiceResiliencyTest {
     @Test
     public void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithCorrectAttributes() {
         Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
-                new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.class)
+                new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.VALUE)
                         .setCoupledService(new CoupledServiceBuilder().build()).build()).hasPassed());
     }
 
     @Test
     public void testCheckWhenProtectedResiliencyWithWrongAttributes() {
-        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Protected.class);
+        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Protected.VALUE);
 
         Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
                 input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build()).hasPassed());
@@ -93,7 +93,7 @@ public class CheckCoherencyServiceResiliencyTest {
     public void testCheckWhenProtectedResiliencyWithCorrectAttributes() {
         Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
                 new ServiceResiliencyBuilder()
-                        .setResiliency(Protected.class)
+                        .setResiliency(Protected.VALUE)
                         .setRevertive(true)
                         .setWaitToRestore(Uint64.valueOf(1))
                         .setHoldoffTime(Uint64.valueOf(1))
@@ -103,7 +103,7 @@ public class CheckCoherencyServiceResiliencyTest {
 
     @Test
     public void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithWrongAttributes() {
-        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Restorable.class);
+        ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Restorable.VALUE);
 
         Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
                 input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build()).hasPassed());
@@ -115,7 +115,7 @@ public class CheckCoherencyServiceResiliencyTest {
     public void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithCorrectAttributes() {
         Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
                 new ServiceResiliencyBuilder()
-                        .setResiliency(Restorable.class)
+                        .setResiliency(Restorable.VALUE)
                         .setRevertive(true)
                         .setWaitToRestore(Uint64.valueOf(1))
                         .setHoldoffTime(Uint64.valueOf(1))
index c88c5239c689c25cc09c859a790aaeac49fdfbcd..cbfbbf4b10aea67a04684df0bc175fcecb9487cc 100644 (file)
@@ -347,7 +347,7 @@ public final class ConnectivityUtils {
             = this.tapiContext.getTapiNode(this.tapiTopoUuid, nodeUuid);
         if (tapiNode != null) {
             return OpenroadmNodeType.forName(tapiNode.getName().get(new NameKey("Node Type"))
-                .getValue()).get();
+                .getValue());
         }
         return null;
     }
@@ -1540,10 +1540,10 @@ public final class ConnectivityUtils {
                 .setIndex(Uint8.ZERO)
                 .build()));
         if (serviceFormat.equals(ServiceFormat.ODU)) {
-            serviceZEndBuilder.setOduServiceRate(ODU4.class);
+            serviceZEndBuilder.setOduServiceRate(ODU4.VALUE);
         }
         if (serviceFormat.equals(ServiceFormat.OTU)) {
-            serviceZEndBuilder.setOtuServiceRate(OTU4.class);
+            serviceZEndBuilder.setOtuServiceRate(OTU4.VALUE);
         }
         if (!serviceLayer.equals(LayerProtocolName.ETH)) {
             serviceZEndBuilder
@@ -1647,10 +1647,10 @@ public final class ConnectivityUtils {
                 .setIndex(Uint8.ZERO)
                 .build()));
         if (serviceFormat.equals(ServiceFormat.ODU)) {
-            serviceAEndBuilder.setOduServiceRate(ODU4.class);
+            serviceAEndBuilder.setOduServiceRate(ODU4.VALUE);
         }
         if (serviceFormat.equals(ServiceFormat.OTU)) {
-            serviceAEndBuilder.setOtuServiceRate(OTU4.class);
+            serviceAEndBuilder.setOtuServiceRate(OTU4.VALUE);
         }
         if (!serviceLayer.equals(LayerProtocolName.ETH)) {
             serviceAEndBuilder
@@ -1757,7 +1757,7 @@ public final class ConnectivityUtils {
                     return null;
                 }
                 OpenroadmNodeType openroadmNodeType = OpenroadmNodeType.forName(optNode.get().getName().get(
-                    new NameKey("Node Type")).getValue()).get();
+                    new NameKey("Node Type")).getValue());
                 if (!openroadmNodeTypeList.contains(openroadmNodeType)) {
                     openroadmNodeTypeList.add(openroadmNodeType);
                 }
index 713e496f5db0425be70ec583f39ab322f4b644c1..d7d75b7758a9707208493922f1a0b307684f871e 100644 (file)
@@ -1187,7 +1187,7 @@ public class TapiPceListenerImpl implements TransportpcePceListener {
                     return null;
                 }
                 OpenroadmNodeType openroadmNodeType = OpenroadmNodeType.forName(optNode.get().getName().get(
-                    new NameKey("Node Type")).getValue()).get();
+                    new NameKey("Node Type")).getValue());
                 if (!openroadmNodeTypeList.contains(openroadmNodeType)) {
                     openroadmNodeTypeList.add(openroadmNodeType);
                 }
index d7c5c21f539411f7fe87904550abde6e0c52163c..40e00af97203dba17978f8d4682a7428b7d1eb84 100644 (file)
@@ -795,7 +795,7 @@ public class ConvertORTopoToTapiFullTopo {
                     .getBytes(Charset.forName("UTF-8"))).toString()))
                 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
                 .setName(Map.of(nepName.key(), nepName))
-                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
                 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
                 .setLinkPortRole(PortRole.SYMMETRIC)
                 .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
@@ -818,7 +818,7 @@ public class ConvertORTopoToTapiFullTopo {
                     TapiStringConstants.MC, tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
                 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
                 .setName(Map.of(nepName1.key(), nepName1))
-                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
                 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
                 .setLinkPortRole(PortRole.SYMMETRIC)
                 .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
@@ -848,7 +848,7 @@ public class ConvertORTopoToTapiFullTopo {
                     .toString()))
                 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
                 .setName(Map.of(nepName2.key(), nepName2))
-                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
                 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
                 .setLinkPortRole(PortRole.SYMMETRIC)
                 .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
@@ -945,9 +945,9 @@ public class ConvertORTopoToTapiFullTopo {
             .build();
     }
 
-    private Set<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(TerminationPoint tp,
-                                                                                                LayerProtocolName lpn) {
-        Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
+    private Set<LAYERPROTOCOLQUALIFIER> createSupportedLayerProtocolQualifier(TerminationPoint tp,
+                                                                              LayerProtocolName lpn) {
+        Set<LAYERPROTOCOLQUALIFIER> sclpqSet = new HashSet<>();
         org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1 tp1 =
             tp.augmentation(org.opendaylight.yang.gen.v1.http
                 .org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class);
@@ -961,36 +961,37 @@ public class ConvertORTopoToTapiFullTopo {
         Collection<SupportedInterfaceCapability> sicList = tp1.getTpSupportedInterfaces()
             .getSupportedInterfaceCapability().values();
         for (SupportedInterfaceCapability sic : sicList) {
+            String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
             switch (lpn.getName()) {
                 case "DSR":
-                    switch (sic.getIfCapType().getSimpleName()) {
+                    switch (ifCapType) {
                         // TODO: it may be needed to add more cases clauses if the interface capabilities of a
                         //  port are extended in the config file
                         case "If1GEODU0":
-                            sclpqSet.add(ODUTYPEODU0.class);
-                            sclpqSet.add(DIGITALSIGNALTYPEGigE.class);
+                            sclpqSet.add(ODUTYPEODU0.VALUE);
+                            sclpqSet.add(DIGITALSIGNALTYPEGigE.VALUE);
                             break;
                         case "If10GEODU2e":
-                            sclpqSet.add(ODUTYPEODU2E.class);
-                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqSet.add(ODUTYPEODU2E.VALUE);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If10GEODU2":
-                            sclpqSet.add(ODUTYPEODU2.class);
-                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqSet.add(ODUTYPEODU2.VALUE);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If10GE":
-                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If100GEODU4":
-                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
-                            sclpqSet.add(ODUTYPEODU4.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
+                            sclpqSet.add(ODUTYPEODU4.VALUE);
                             break;
                         case "If100GE":
-                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
                             break;
                         case "IfOCHOTU4ODU4":
                         case "IfOCH":
-                            sclpqSet.add(ODUTYPEODU4.class);
+                            sclpqSet.add(ODUTYPEODU4.VALUE);
                             break;
                         default:
                             LOG.error("IfCapability type not managed");
@@ -998,24 +999,24 @@ public class ConvertORTopoToTapiFullTopo {
                     }
                     break;
                 case "ODU":
-                    switch (sic.getIfCapType().getSimpleName()) {
+                    switch (ifCapType) {
                         // TODO: it may be needed to add more cases clauses if the interface capabilities of a
                         //  port are extended in the config file
                         case "If1GEODU0":
-                            sclpqSet.add(ODUTYPEODU0.class);
+                            sclpqSet.add(ODUTYPEODU0.VALUE);
                             break;
                         case "If10GEODU2e":
-                            sclpqSet.add(ODUTYPEODU2E.class);
+                            sclpqSet.add(ODUTYPEODU2E.VALUE);
                             break;
                         case "If10GEODU2":
                         case "If10GE":
-                            sclpqSet.add(ODUTYPEODU2.class);
+                            sclpqSet.add(ODUTYPEODU2.VALUE);
                             break;
                         case "If100GEODU4":
                         case "If100GE":
                         case "IfOCHOTU4ODU4":
                         case "IfOCH":
-                            sclpqSet.add(ODUTYPEODU4.class);
+                            sclpqSet.add(ODUTYPEODU4.VALUE);
                             break;
                         default:
                             LOG.error("IfCapability type not managed");
@@ -1023,10 +1024,9 @@ public class ConvertORTopoToTapiFullTopo {
                     }
                     break;
                 case "PHOTONIC_MEDIA":
-                    if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
-                            || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
-                        sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
-                        sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
+                    if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+                        sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.VALUE);
+                        sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.VALUE);
                     }
                     break;
                 default:
index aab9df4b0d1b5435e5142d39ba74cf9c57b6c2cf..0a655375f1cd2f316c09aba3a0930476fd0d99be 100644 (file)
@@ -588,7 +588,7 @@ public class ConvertORTopoToTapiTopo {
                 .setUuid(nepUuid)
                 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
                 .setName(Map.of(nepName.key(), nepName))
-                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
                 .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
                 .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
                 .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
@@ -645,38 +645,39 @@ public class ConvertORTopoToTapiTopo {
         return msipl;
     }
 
-    private Set<Class<? extends LAYERPROTOCOLQUALIFIER>>
+    private Set<LAYERPROTOCOLQUALIFIER>
             createSupportedCepLayerProtocolQualifier(TerminationPoint tp, LayerProtocolName lpn) {
-        Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
+        Set<LAYERPROTOCOLQUALIFIER> sclpqSet = new HashSet<>();
         Collection<SupportedInterfaceCapability> sicList = tp.augmentation(
                 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class)
             .getTpSupportedInterfaces()
             .getSupportedInterfaceCapability().values();
         for (SupportedInterfaceCapability sic : sicList) {
+            String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
             switch (lpn.getName()) {
                 case "DSR":
-                    switch (sic.getIfCapType().getSimpleName()) {
+                    switch (ifCapType) {
                         case "If10GEODU2e":
-                            sclpqSet.add(ODUTYPEODU2E.class);
-                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqSet.add(ODUTYPEODU2E.VALUE);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If10GEODU2":
-                            sclpqSet.add(ODUTYPEODU2.class);
-                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqSet.add(ODUTYPEODU2.VALUE);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If10GE":
-                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If100GEODU4":
-                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
-                            sclpqSet.add(ODUTYPEODU4.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
+                            sclpqSet.add(ODUTYPEODU4.VALUE);
                             break;
                         case "If100GE":
-                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+                            sclpqSet.add(DIGITALSIGNALTYPE100GigE.VALUE);
                             break;
                         case "IfOCHOTU4ODU4":
                         case "IfOCH":
-                            sclpqSet.add(ODUTYPEODU4.class);
+                            sclpqSet.add(ODUTYPEODU4.VALUE);
                             break;
                         default:
                             LOG.error("IfCapability type not managed");
@@ -684,10 +685,9 @@ public class ConvertORTopoToTapiTopo {
                     }
                     break;
                 case "PHOTONIC_MEDIA":
-                    if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
-                            || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
-                        sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
-                        sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
+                    if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+                        sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.VALUE);
+                        sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.VALUE);
                     }
                     break;
                 default:
index 39163fed44d3b3e2f7bee68343fff67a92edaccb..3eeb7a34fdc100d5e4251523b9c78dd695908f59 100644 (file)
@@ -687,7 +687,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+            List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
 
             OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
@@ -708,8 +708,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
-                new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
+            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,
@@ -729,7 +729,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+            List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
 
             OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
@@ -762,7 +762,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 name = nameBldr.setValueName("NodeEdgePoint_C").build();
             }
 
-            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+            List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
@@ -785,7 +785,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrNetMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+            List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
@@ -809,7 +809,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     xpdrClMaps.get(i).getLogicalConnectionPoint()))
                 .build();
 
-            List<Class<? extends SupportedIfCapability>> newSupIfCapList =
+            List<SupportedIfCapability> newSupIfCapList =
                     new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
 
             OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
@@ -837,7 +837,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     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<SupportedIfCapability> supportedInterfaceCapability,
                                          OperationalState operState, AdministrativeState adminState) {
         OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
                 .setUuid(nepUuid)
@@ -872,7 +872,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setUuid(nepUuid)
             .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
             .setName(Map.of(nepName.key(), nepName))
-            .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+            .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
             .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
             .setAdministrativeState(adminState).setOperationalState(operState)
             .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
@@ -891,7 +891,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                 .setUuid(nepUuid1)
                 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
                 .setName(Map.of(nepName1.key(), nepName1))
-                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+                .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
                 .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
                 .setAdministrativeState(adminState).setOperationalState(operState)
                 .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
@@ -916,7 +916,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
             .setUuid(nepUuid2)
             .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
             .setName(Map.of(nepName2.key(), nepName2))
-            .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
+            .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE))
             .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
             .setAdministrativeState(adminState).setOperationalState(operState)
             .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
@@ -928,7 +928,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
 
     private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint>
             createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid,
-                   List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+                   List<SupportedIfCapability> supportedInterfaceCapability,
                    OperationalState operState, AdministrativeState adminState) {
         Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
         for (int i = 0; i < nb; i++) {
@@ -947,7 +947,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
     }
 
     private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpid, String nodeid,
-                                            List<Class<? extends SupportedIfCapability>> supportedInterfaceCapability,
+                                            List<SupportedIfCapability> supportedInterfaceCapability,
                                             OperationalState operState, AdministrativeState adminState) {
         // TODO: what value should be set in total capacity and available capacity
         LOG.info("SIP name = {}", String.join("+", nodeid, tpid));
@@ -1266,52 +1266,53 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
         return nodeRuleGroupMap;
     }
 
-    private Set<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(
-            List<Class<? extends SupportedIfCapability>> sicList, LayerProtocolName lpn) {
+    private Set<LAYERPROTOCOLQUALIFIER> createSupportedLayerProtocolQualifier(
+            List<SupportedIfCapability> sicList, LayerProtocolName lpn) {
         if (sicList == null) {
-            return Set.of(PHOTONICLAYERQUALIFIEROMS.class);
+            return Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE);
         }
         Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
         LOG.info("SIC list = {}", sicList);
-        for (Class<? extends SupportedIfCapability> supInterCapa : sicList) {
+        for (SupportedIfCapability supInterCapa : sicList) {
             SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
                     .withKey(new SupportedInterfaceCapabilityKey(supInterCapa))
                     .setIfCapType(supInterCapa)
                     .build();
             supIfMap.put(supIfCapa.key(), supIfCapa);
         }
-        Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new HashSet<>();
+        Set<LAYERPROTOCOLQUALIFIER> sclpqList = new HashSet<>();
         for (SupportedInterfaceCapability sic : supIfMap.values()) {
+            String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
             switch (lpn.getName()) {
                 case "DSR":
-                    switch (sic.getIfCapType().getSimpleName()) {
+                    switch (ifCapType) {
                         // TODO: it may be needed to add more cases clauses if the interface capabilities of a
                         //  port are extended in the config file
                         case "If1GEODU0":
-                            sclpqList.add(ODUTYPEODU0.class);
-                            sclpqList.add(DIGITALSIGNALTYPEGigE.class);
+                            sclpqList.add(ODUTYPEODU0.VALUE);
+                            sclpqList.add(DIGITALSIGNALTYPEGigE.VALUE);
                             break;
                         case "If10GEODU2e":
-                            sclpqList.add(ODUTYPEODU2E.class);
-                            sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqList.add(ODUTYPEODU2E.VALUE);
+                            sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If10GEODU2":
-                            sclpqList.add(ODUTYPEODU2.class);
-                            sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqList.add(ODUTYPEODU2.VALUE);
+                            sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If10GE":
-                            sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
+                            sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE);
                             break;
                         case "If100GEODU4":
-                            sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
-                            sclpqList.add(ODUTYPEODU4.class);
+                            sclpqList.add(DIGITALSIGNALTYPE100GigE.VALUE);
+                            sclpqList.add(ODUTYPEODU4.VALUE);
                             break;
                         case "If100GE":
-                            sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
+                            sclpqList.add(DIGITALSIGNALTYPE100GigE.VALUE);
                             break;
                         case "IfOCHOTU4ODU4":
                         case "IfOCH":
-                            sclpqList.add(ODUTYPEODU4.class);
+                            sclpqList.add(ODUTYPEODU4.VALUE);
                             break;
                         default:
                             LOG.error("IfCapability type not managed");
@@ -1319,24 +1320,24 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     }
                     break;
                 case "ODU":
-                    switch (sic.getIfCapType().getSimpleName()) {
+                    switch (ifCapType) {
                         // TODO: it may be needed to add more cases clauses if the interface capabilities of a
                         //  port are extended in the config file
                         case "If1GEODU0":
-                            sclpqList.add(ODUTYPEODU0.class);
+                            sclpqList.add(ODUTYPEODU0.VALUE);
                             break;
                         case "If10GEODU2e":
-                            sclpqList.add(ODUTYPEODU2E.class);
+                            sclpqList.add(ODUTYPEODU2E.VALUE);
                             break;
                         case "If10GEODU2":
                         case "If10GE":
-                            sclpqList.add(ODUTYPEODU2.class);
+                            sclpqList.add(ODUTYPEODU2.VALUE);
                             break;
                         case "If100GEODU4":
                         case "If100GE":
                         case "IfOCHOTU4ODU4":
                         case "IfOCH":
-                            sclpqList.add(ODUTYPEODU4.class);
+                            sclpqList.add(ODUTYPEODU4.VALUE);
                             break;
                         default:
                             LOG.error("IfCapability type not managed");
@@ -1344,10 +1345,9 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService {
                     }
                     break;
                 case "PHOTONIC_MEDIA":
-                    if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
-                            || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
-                        sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.class);
-                        sclpqList.add(PHOTONICLAYERQUALIFIEROMS.class);
+                    if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) {
+                        sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.VALUE);
+                        sclpqList.add(PHOTONICLAYERQUALIFIEROMS.VALUE);
                     }
                     break;
                 default:
index 45479177a3936f37cf84861d1841ecdd1f6e38cd..bf6919992c4429d1ab3102c6b0ec3748569649da 100644 (file)
@@ -915,7 +915,7 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
             3, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("client nep should support 3 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
+            hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
         assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, false);
     }
@@ -933,9 +933,9 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
         assertThat("eODU nep should support 1, 2 or 3 kind of cep, depending on client port",
             nep.getSupportedCepLayerProtocolQualifier().size(), anyOf(is(1), is(2), is(3)));
         assertTrue("eODU nep should support 1 kind of cep",
-            nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.class)
-                || splc.equals(ODUTYPEODU2.class) || splc.equals(ODUTYPEODU2E.class)
-                || splc.equals(ODUTYPEODU4.class)));
+            nep.getSupportedCepLayerProtocolQualifier().stream().anyMatch(splc -> splc.equals(ODUTYPEODU0.VALUE)
+                || splc.equals(ODUTYPEODU2.VALUE) || splc.equals(ODUTYPEODU2E.VALUE)
+                || splc.equals(ODUTYPEODU4.VALUE)));
         assertEquals("eODU nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, withSip);
     }
@@ -953,7 +953,7 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
             1, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("network nep should support 1 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItem(ODUTYPEODU4.class));
+            hasItem(ODUTYPEODU4.VALUE));
         assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, withSip);
     }
@@ -1150,7 +1150,7 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
             2, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("client nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
+            hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
         assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, false);
     }
@@ -1166,7 +1166,7 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
             1, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("client nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(DIGITALSIGNALTYPE100GigE.class));
+            hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
         assertEquals("client nep should be of DSR protocol type", LayerProtocolName.DSR, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, false);
     }
@@ -1183,7 +1183,7 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
             2, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("OTSi nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
+            hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
         assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
             LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, withSip);
@@ -1201,7 +1201,7 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
             1, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("OTSi nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(PHOTONICLAYERQUALIFIEROMS.class));
+            hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
         assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
             LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, withSip);
index ac12edd36bf744e829dcd43c63cfd13ed54f9665..d04e4b38e5775ba127f2ed56f12ba1afd829a547 100644 (file)
@@ -928,7 +928,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest {
             3, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("client nep should support 3 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(ODUTYPEODU2.class, ODUTYPEODU2E.class, DIGITALSIGNALTYPE10GigELAN.class));
+            hasItems(ODUTYPEODU2.VALUE, ODUTYPEODU2E.VALUE, DIGITALSIGNALTYPE10GigELAN.VALUE));
         assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, false);
         checkSIP(nep, portName, nodeId, extension);
@@ -947,7 +947,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest {
             1, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("network nep should support 1 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItem(ODUTYPEODU4.class));
+            hasItem(ODUTYPEODU4.VALUE));
         assertEquals("network nep should be of ODU protocol type", LayerProtocolName.ODU, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, false);
         checkSIP(nep, portName, nodeId, extension);
@@ -1146,7 +1146,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest {
             2, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("client nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(ODUTYPEODU4.class, DIGITALSIGNALTYPE100GigE.class));
+            hasItems(ODUTYPEODU4.VALUE, DIGITALSIGNALTYPE100GigE.VALUE));
         assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, false);
         checkSIP(nep, portName, nodeId, extension);
@@ -1164,7 +1164,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest {
             1, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("client nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(DIGITALSIGNALTYPE100GigE.class));
+            hasItems(DIGITALSIGNALTYPE100GigE.VALUE));
         assertEquals("client nep should be of ETH protocol type", LayerProtocolName.ETH, nep.getLayerProtocolName());
         checkCommonPartOfNep(nep, false);
         checkSIP(nep, portName, nodeId, extension);
@@ -1182,7 +1182,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest {
             2, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("OTSi nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(PHOTONICLAYERQUALIFIEROMS.class, PHOTONICLAYERQUALIFIEROTSi.class));
+            hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE, PHOTONICLAYERQUALIFIEROTSi.VALUE));
         assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
             LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
         assertEquals("OTSi nep should support one SIP", 1, nep.getMappedServiceInterfacePoint().size());
@@ -1209,7 +1209,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest {
             1, nep.getSupportedCepLayerProtocolQualifier().size());
         assertThat("OTSi nep should support 2 kind of cep",
             nep.getSupportedCepLayerProtocolQualifier(),
-            hasItems(PHOTONICLAYERQUALIFIEROMS.class));
+            hasItems(PHOTONICLAYERQUALIFIEROMS.VALUE));
         assertEquals("OTSi nep should be of PHOTONIC_MEDIA protocol type",
             LayerProtocolName.PHOTONICMEDIA, nep.getLayerProtocolName());
         assertEquals("OTSi nep of RDM infra should support no SIP", 0, nep.nonnullMappedServiceInterfacePoint().size());
index eb21782a5ed02111ce5e1cbd02c7553251b22773..a035f38e97e47e01986d27961753c739af90016d 100644 (file)
@@ -48,7 +48,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.mount_device("SPDR-SA1", ('spdra', self.NODE_VERSION))
         self.assertEqual(response.status_code, requests.codes.created,
                          test_utils.CODE_SHOULD_BE_201)
-        time.sleep(10)
+        time.sleep(5)
 
         response = test_utils.check_device_connection("SPDR-SA1")
         self.assertEqual(response['status_code'], requests.codes.ok)
@@ -58,7 +58,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.mount_device("SPDR-SC1", ('spdrc', self.NODE_VERSION))
         self.assertEqual(response.status_code, requests.codes.created,
                          test_utils.CODE_SHOULD_BE_201)
-        time.sleep(10)
+        time.sleep(5)
 
         response = test_utils.check_device_connection("SPDR-SC1")
         self.assertEqual(response['status_code'], requests.codes.ok)