Refactor Renderer OpenRoadmInterfaces step 1 25/102325/4
authorguillaume.lambert <guillaume.lambert@orange.com>
Fri, 9 Sep 2022 13:40:27 +0000 (15:40 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Mon, 12 Sep 2022 17:52:24 +0000 (19:52 +0200)
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I01e4ed15dcf355e88b5c14f420b93e8381e70848

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

index 2073b5cb5029ad8dd5cae0b8349f53ac92699c03..906bd2398c9f2e08148b7ee609a5015465303dab 100644 (file)
@@ -77,28 +77,25 @@ public class OpenRoadmInterface121 {
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
         }
-
-        // Ethernet interface specific data
-        EthernetBuilder ethIfBuilder = new EthernetBuilder()
-                .setAutoNegotiation(EthAttributes.AutoNegotiation.Enabled)
-                .setDuplex(EthAttributes.Duplex.Full)
-                .setFec(EthAttributes.Fec.Off)
-                .setSpeed(Uint32.valueOf(100000))
-                .setMtu(Uint32.valueOf(9000));
-
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
-                                                                          logicalConnPoint + "-ETHERNET");
-
-        // Create Interface1 type object required for adding as augmentation
-        Interface1Builder ethIf1Builder = new Interface1Builder();
-        ethInterfaceBldr.addAugmentation(ethIf1Builder.setEthernet(ethIfBuilder.build()).build());
-
+        InterfaceBuilder ethInterfaceBldr =
+            createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE, logicalConnPoint + "-ETHERNET")
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    new Interface1Builder()
+                        .setEthernet(
+                            // Ethernet interface specific data
+                            new EthernetBuilder()
+                                .setAutoNegotiation(EthAttributes.AutoNegotiation.Enabled)
+                                .setDuplex(EthAttributes.Duplex.Full)
+                                .setFec(EthAttributes.Fec.Off)
+                                .setSpeed(Uint32.valueOf(100000))
+                                .setMtu(Uint32.valueOf(9000))
+                                .build())
+                        .build());
         // Post interface on the device
         this.openRoadmInterfaces.postInterface(nodeId, ethInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack
         this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
-
         return ethInterfaceBldr.getName();
     }
 
@@ -132,21 +129,19 @@ public class OpenRoadmInterface121 {
             throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
         }
         // Create generic interface
-        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.VALUE);
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder otuIf1Builder =
-                new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder();
-        otuInterfaceBldr.addAugmentation(otuIf1Builder.setOtu(otuIfBuilder.build()).build());
-
+        InterfaceBuilder otuInterfaceBldr =
+            createGenericInterfaceBuilder(portMap, OtnOtu.VALUE, logicalConnPoint + "-OTU")
+                .setSupportingInterface(supportOchInterface)
+                .addAugmentation(
+                // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder()
+                        .setOtu(
+                            // OTU interface specific data
+                            new OtuBuilder()
+                                .setFec(OtuAttributes.Fec.Scfec)
+                                .setRate(OTU4.VALUE)
+                                .build())
+                        .build());
         // Post interface on the device
         this.openRoadmInterfaces.postInterface(nodeId, otuInterfaceBldr);
         this.portMapping.updateMapping(nodeId, portMap);
@@ -169,28 +164,28 @@ public class OpenRoadmInterface121 {
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint
-                + "-ODU");
+        InterfaceBuilder oduInterfaceBldr =
+            createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU");
         if (portMap.getSupportingOtu4() != null) {
             oduInterfaceBldr.setSupportingInterface(portMap.getSupportingOtu4());
         }
-
-        // ODU interface specific data
-        // Set Opu attributes
-        OpuBuilder opuBldr = new OpuBuilder()
-                .setPayloadType("07")
-                .setExpPayloadType("07");
-        OduBuilder oduIfBuilder = new OduBuilder()
-                .setRate(ODU4.VALUE)
-                .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
-                .setOpu(opuBldr.build());
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1Builder oduIf1Builder =
-                new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1Builder();
-        oduInterfaceBldr.addAugmentation(oduIf1Builder.setOdu(oduIfBuilder.build()).build());
-
+        oduInterfaceBldr.addAugmentation(
+            // Create Interface1 type object required for adding as augmentation
+            // TODO look at imports of different versions of class
+            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1Builder()
+                .setOdu(
+                    // ODU interface specific data
+                    new OduBuilder()
+                        .setRate(ODU4.VALUE)
+                        .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
+                        .setOpu(
+                            // Set Opu attributes
+                            new OpuBuilder()
+                                .setPayloadType("07")
+                                .setExpPayloadType("07")
+                                .build())
+                        .build())
+                .build());
         // Post interface on the device
         this.openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
         return oduInterfaceBldr.getName();
@@ -209,7 +204,7 @@ public class OpenRoadmInterface121 {
 
     public List<String> createOpenRoadmOchInterfaces(String nodeId, String logicalConnPoint,
             SpectrumInformation spectrumInformation)
-        throws OpenRoadmInterfaceException {
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(String.format(
@@ -217,28 +212,25 @@ public class OpenRoadmInterface121 {
                     nodeId, logicalConnPoint));
         }
         // Create generic interface
-        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
+        InterfaceBuilder ochInterfaceBldr =
+            createGenericInterfaceBuilder(
+                portMap, OpticalChannel.VALUE,
                 spectrumInformation.getIdentifierFromParams(logicalConnPoint));
-
-        // OCH interface specific data
-        OchBuilder ocIfBuilder = new OchBuilder().setWavelengthNumber(spectrumInformation.getWaveLength());
-
         // Add supporting OMS interface
         if (portMap.getSupportingOms() != null) {
             ochInterfaceBldr.setSupportingInterface(portMap.getSupportingOms());
         }
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1Builder
-                ochIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces
-                .rev161014.Interface1Builder();
-        ochInterfaceBldr.addAugmentation(ochIf1Builder.setOch(ocIfBuilder.build()).build());
-
-        List<String> interfacesCreated = new ArrayList<>();
+        ochInterfaceBldr.addAugmentation(
+            // Create Interface1 type object required for adding as augmentation
+            // TODO look at imports of different versions of class
+            new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1Builder()
+                .setOch(
+                    // OCH interface specific data
+                    new OchBuilder().setWavelengthNumber(spectrumInformation.getWaveLength()).build())
+                .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, ochInterfaceBldr);
-        interfacesCreated.add(ochInterfaceBldr.getName());
-        return interfacesCreated;
+        return new ArrayList<String>(List.of(ochInterfaceBldr.getName()));
     }
 
     public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint,
@@ -249,31 +241,32 @@ public class OpenRoadmInterface121 {
                 "Unable to get mapping from PortMapping for node %s and logical connection port %s",
                     nodeId, logicalConnPoint));
         }
-        ModulationFormat modulationFormat = OchAttributes.ModulationFormat
-                .forName(spectrumInformation.getModulationFormat());
+        ModulationFormat modulationFormat =
+            OchAttributes.ModulationFormat.forName(spectrumInformation.getModulationFormat());
         if (modulationFormat == null) {
             modulationFormat = OchAttributes.ModulationFormat.DpQpsk;
         }
-        // OCH interface specific data
-        OchBuilder ocIfBuilder = new OchBuilder()
-                .setWavelengthNumber(spectrumInformation.getWaveLength())
-                .setModulationFormat(modulationFormat)
-                .setRate(R100G.VALUE)
-                .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")));
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014
-                .Interface1Builder ochIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel
-                .interfaces.rev161014.Interface1Builder();
         // Create generic interface
-        InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.VALUE,
-                spectrumInformation.getIdentifierFromParams(logicalConnPoint));
-        ochInterfaceBldr.addAugmentation(ochIf1Builder.setOch(ocIfBuilder.build()).build());
-
+        InterfaceBuilder ochInterfaceBldr =
+            createGenericInterfaceBuilder(
+                    portMap, OpticalChannel.VALUE,
+                    spectrumInformation.getIdentifierFromParams(logicalConnPoint))
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014
+                            .Interface1Builder()
+                        .setOch(
+                            // OCH interface specific data
+                            new OchBuilder()
+                                .setWavelengthNumber(spectrumInformation.getWaveLength())
+                                .setModulationFormat(modulationFormat)
+                                .setRate(R100G.VALUE)
+                                .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
+                                .build())
+                        .build());
         // Post interface on the device
         this.openRoadmInterfaces.postInterface(nodeId, ochInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
@@ -286,66 +279,66 @@ public class OpenRoadmInterface121 {
     }
 
     public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
-        if (mapping.getSupportingOms() == null) {
-            // Create generic interface
-            InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.VALUE,
-                "OMS-" + mapping.getLogicalConnectionPoint());
-            if (mapping.getSupportingOts() != null) {
-                omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
-            } else {
-                LOG.error("Unable to get ots interface from mapping {} - {}", nodeId,
-                          mapping.getLogicalConnectionPoint());
-                return null;
-            }
-            this.openRoadmInterfaces.postInterface(nodeId, omsInterfaceBldr);
-            this.portMapping.updateMapping(nodeId, mapping);
-            return omsInterfaceBldr.build().getName();
-        } else {
+        if (mapping.getSupportingOms() != null) {
             return mapping.getSupportingOms();
         }
+        if (mapping.getSupportingOts() == null) {
+            LOG.error("Unable to get ots interface from mapping {} - {}", nodeId, mapping.getLogicalConnectionPoint());
+            return null;
+        }
+        // Create generic interface
+        InterfaceBuilder omsInterfaceBldr =
+            createGenericInterfaceBuilder(
+                     mapping, OpenROADMOpticalMultiplex.VALUE,
+                    "OMS-" + mapping.getLogicalConnectionPoint())
+                .setSupportingInterface(mapping.getSupportingOts());
+        this.openRoadmInterfaces.postInterface(nodeId, omsInterfaceBldr);
+        this.portMapping.updateMapping(nodeId, mapping);
+        return omsInterfaceBldr.build().getName();
     }
 
     public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
-        if (mapping.getSupportingOts() == null) {
-            // Create generic interface
-            InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-"
-                    + mapping.getLogicalConnectionPoint());
-            // OTS interface augmentation specific data
-            OtsBuilder otsIfBuilder = new OtsBuilder();
-            otsIfBuilder.setFiberType(OtsAttributes.FiberType.Smf);
-
-            // Create Interface1 type object required for adding as
-            // augmentation
-            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014
-                    .Interface1Builder otsIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm
-                    .optical.transport.interfaces.rev161014.Interface1Builder();
-            otsInterfaceBldr.addAugmentation(otsIf1Builder.setOts(otsIfBuilder.build()).build());
-            this.openRoadmInterfaces.postInterface(nodeId, otsInterfaceBldr);
-            this.portMapping.updateMapping(nodeId, mapping);
-            return otsInterfaceBldr.build().getName();
-        } else {
+        if (mapping.getSupportingOts() != null) {
             return mapping.getSupportingOts();
         }
+        // Create generic interface
+        InterfaceBuilder otsInterfaceBldr =
+            createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-" + mapping.getLogicalConnectionPoint())
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as
+                    // augmentation
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014
+                            .Interface1Builder()
+                        .setOts(
+                            // OTS interface augmentation specific data
+                            new OtsBuilder().setFiberType(OtsAttributes.FiberType.Smf).build())
+                        .build());
+        this.openRoadmInterfaces.postInterface(nodeId, otsInterfaceBldr);
+        this.portMapping.updateMapping(nodeId, mapping);
+        return otsInterfaceBldr.build().getName();
     }
 
     public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
-        DeviceTransactionManager deviceTransactionManager) {
-        InstanceIdentifier<RoadmConnections> xciid = InstanceIdentifier
-            .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
-            .child(RoadmConnections.class, new RoadmConnectionsKey(xc))
-            .build();
+            DeviceTransactionManager deviceTransactionManager) {
         LOG.info("reading xc {} in node {}", xc, nodeId);
-        Optional<RoadmConnections> crossconnection = deviceTransactionManager.getDataFromDevice(nodeId,
-            LogicalDatastoreType.CONFIGURATION, xciid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
-        if (crossconnection.isPresent()) {
-            RoadmConnections rc = crossconnection.get();
-            LOG.info("xd {} found", xc);
-            if (rc.getSource().getSrcIf().equals(interfaceName)
-                || rc.getDestination().getDstIf().equals(interfaceName)) {
-                return true;
-            }
-        } else {
+        Optional<RoadmConnections> crossconnection = deviceTransactionManager.getDataFromDevice(
+            nodeId,
+            LogicalDatastoreType.CONFIGURATION,
+            InstanceIdentifier
+                .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+                .child(RoadmConnections.class, new RoadmConnectionsKey(xc))
+                .build(),
+            Timeouts.DEVICE_READ_TIMEOUT,
+            Timeouts.DEVICE_READ_TIMEOUT_UNIT);
+        if (crossconnection.isEmpty()) {
             LOG.info("xd {} not found !", xc);
+            return false;
+        }
+        RoadmConnections rc = crossconnection.get();
+        LOG.info("xd {} found", xc);
+        if (rc.getSource().getSrcIf().equals(interfaceName)
+                || rc.getDestination().getDstIf().equals(interfaceName)) {
+            return true;
         }
         return false;
     }
index e41c866faebc89373f972b0d47b7983599a9370c..5d25362ae2abbc6b721e070cc7806a037d8f6b5a 100644 (file)
@@ -90,27 +90,26 @@ public class OpenRoadmInterface221 {
     }
 
     public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint)
-        throws OpenRoadmInterfaceException {
+            throws OpenRoadmInterfaceException {
         Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
         if (mapping == null) {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-
-        // Ethernet interface specific data
-        EthernetBuilder ethIfBuilder = new EthernetBuilder()
-            .setFec(EthAttributes.Fec.Off)
-            .setSpeed(Uint32.valueOf(100000));
-
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(mapping, EthernetCsmacd.VALUE,
-            logicalConnPoint + "-ETHERNET");
-        // Create Interface1 type object required for adding as augmentation
-        Interface1Builder ethIf1Builder = new Interface1Builder();
-        ethInterfaceBldr.addAugmentation(ethIf1Builder.setEthernet(ethIfBuilder.build()).build());
-
         // Post interface on the device
+        InterfaceBuilder ethInterfaceBldr =
+            createGenericInterfaceBuilder(mapping, EthernetCsmacd.VALUE, logicalConnPoint + "-ETHERNET")
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    new Interface1Builder()
+                        .setEthernet(
+                            // Ethernet interface specific data
+                            new EthernetBuilder()
+                                .setFec(EthAttributes.Fec.Off)
+                                .setSpeed(Uint32.valueOf(100000))
+                                .build())
+                        .build());
         openRoadmInterfaces.postInterface(nodeId, ethInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack
         openRoadmInterfaces.postEquipmentState(nodeId, mapping.getSupportingCircuitPackName(), true);
         this.portMapping.updateMapping(nodeId, mapping);
@@ -118,28 +117,25 @@ public class OpenRoadmInterface221 {
     }
 
     public List<String> createFlexOCH(String nodeId, String logicalConnPoint, SpectrumInformation spectrumInformation)
-        throws OpenRoadmInterfaceException {
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-
         List<String> interfacesCreated = new ArrayList<>();
         String mcInterfaceCreated = "";
         if (logicalConnPoint.contains("DEG")) {
             mcInterfaceCreated = createMCInterface(nodeId, logicalConnPoint, spectrumInformation);
             interfacesCreated.add(mcInterfaceCreated);
         }
-        String nmcInterfaceCreated = createNMCInterface(nodeId, logicalConnPoint, spectrumInformation,
-                mcInterfaceCreated);
-        interfacesCreated.add(nmcInterfaceCreated);
+        interfacesCreated.add(createNMCInterface(nodeId, logicalConnPoint, spectrumInformation, mcInterfaceCreated));
         return interfacesCreated;
     }
 
     public String createMCInterface(String nodeId, String logicalConnPoint,
-        SpectrumInformation spectrumInformation)
-        throws OpenRoadmInterfaceException {
+            SpectrumInformation spectrumInformation)
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
@@ -149,30 +145,31 @@ public class OpenRoadmInterface221 {
         LOG.info("MC interface Freq Start {} and Freq End {} and center-Freq {}",
                 spectrumInformation.getMinFrequency(), spectrumInformation.getMaxFrequency(),
                 spectrumInformation.getCenterFrequency());
-        InterfaceBuilder mcInterfaceBldr = createGenericInterfaceBuilder(portMap,
-            MediaChannelTrailTerminationPoint.VALUE,
-            spectrumInformation.getIdentifierFromParams(logicalConnPoint, "mc"))
-                .setSupportingInterface(portMap.getSupportingOms());
-        McTtpBuilder mcTtpBuilder = new McTtpBuilder()
-            .setMinFreq(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getMinFrequency())))
-            .setMaxFreq(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getMaxFrequency())));
-
-        // Create Interface1 type object required for adding as augmentation
-        org.opendaylight.yang.gen.v1.http.org.openroadm.media.channel.interfaces.rev181019.Interface1Builder
-            interface1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.media.channel.interfaces.rev181019.Interface1Builder()
-                .setMcTtp(mcTtpBuilder.build());
-
-        mcInterfaceBldr.addAugmentation(interface1Builder.build());
-
+        InterfaceBuilder mcInterfaceBldr =
+            createGenericInterfaceBuilder(
+                    portMap,
+                    MediaChannelTrailTerminationPoint.VALUE,
+                    spectrumInformation.getIdentifierFromParams(logicalConnPoint, "mc"))
+                .setSupportingInterface(portMap.getSupportingOms())
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.media.channel.interfaces.rev181019
+                            .Interface1Builder()
+                        .setMcTtp(
+                            new McTtpBuilder()
+                                .setMinFreq(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getMinFrequency())))
+                                .setMaxFreq(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getMaxFrequency())))
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, mcInterfaceBldr);
         return mcInterfaceBldr.getName();
     }
 
     public String createNMCInterface(String nodeId, String logicalConnPoint,
-        SpectrumInformation spectrumInformation, String mcName)
-        throws OpenRoadmInterfaceException {
+            SpectrumInformation spectrumInformation, String mcName)
+            throws OpenRoadmInterfaceException {
+        //TODO improve logs messages
         LOG.info("This is the central frequency {}", spectrumInformation.getCenterFrequency());
         LOG.info("This is the nmc width {}", spectrumInformation.getWidth());
         // TODO : Check this method
@@ -182,42 +179,36 @@ public class OpenRoadmInterface221 {
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
         //TODO : Check this method
-        String nmcName = spectrumInformation.getIdentifierFromParams(logicalConnPoint, "nmc");
-        InterfaceBuilder nmcInterfaceBldr = createGenericInterfaceBuilder(portMap,
-            NetworkMediaChannelConnectionTerminationPoint.VALUE, nmcName);
+        InterfaceBuilder nmcInterfaceBldr =
+            createGenericInterfaceBuilder(
+                portMap, NetworkMediaChannelConnectionTerminationPoint.VALUE,
+                spectrumInformation.getIdentifierFromParams(logicalConnPoint, "nmc"));
         if (logicalConnPoint.contains("DEG")) {
             nmcInterfaceBldr.setSupportingInterface(mcName);
         }
-
-        NmcCtpBuilder nmcCtpIfBuilder = new NmcCtpBuilder()
-                .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
-                .setWidth(new FrequencyGHz(Decimal64.valueOf(spectrumInformation.getWidth())));
-
         // Create Interface1 type object required for adding as augmentation
-        org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019.Interface1Builder
-            nmcCtpI1fBuilder =
+        nmcInterfaceBldr.addAugmentation(
             new org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019
-                 .Interface1Builder().setNmcCtp(nmcCtpIfBuilder.build());
-        nmcInterfaceBldr.addAugmentation(nmcCtpI1fBuilder.build());
+                     .Interface1Builder()
+                .setNmcCtp(
+                    new NmcCtpBuilder()
+                        .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
+                        .setWidth(new FrequencyGHz(Decimal64.valueOf(spectrumInformation.getWidth())))
+                        .build())
+                .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, nmcInterfaceBldr);
         return nmcInterfaceBldr.getName();
     }
 
     public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint,
-        SpectrumInformation spectrumInformation)
-        throws OpenRoadmInterfaceException {
+            SpectrumInformation spectrumInformation)
+            throws OpenRoadmInterfaceException {
         // TODO : Check this method
         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.VALUE)
-            .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
-            .setModulationFormat(modulationFormat);
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
@@ -225,23 +216,32 @@ public class OpenRoadmInterface221 {
                     nodeId, logicalConnPoint));
         }
         // Create generic interface
-        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
-        org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019.Interface1Builder
-            ochIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019
-            .Interface1Builder();
-        ochInterfaceBldr.addAugmentation(ochIf1Builder.setOch(ocIfBuilder.build()).build());
-
+        InterfaceBuilder ochInterfaceBldr =
+            createGenericInterfaceBuilder(
+                    portMap,
+                    OpticalChannel.VALUE,
+                    spectrumInformation.getIdentifierFromParams(logicalConnPoint))
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019
+                            .Interface1Builder()
+                        .setOch(
+                            // OCH interface specific data
+                            new OchBuilder()
+                                .setFrequency(
+                                    new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
+                                .setRate(R100G.VALUE)
+                                .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
+                                .setModulationFormat(modulationFormat)
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, ochInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
         }
-
         return ochInterfaceBldr.getName();
     }
 
@@ -250,11 +250,10 @@ public class OpenRoadmInterface221 {
         Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
         if (mapping == null) {
             throw new OpenRoadmInterfaceException(
-                    String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
-            logicalConnPoint + "-ODU4");
+        InterfaceBuilder oduInterfaceBldr =
+            createGenericInterfaceBuilder(mapping, OtnOdu.VALUE, logicalConnPoint + "-ODU4");
         if (mapping.getSupportingOtu4() != null) {
             oduInterfaceBldr.setSupportingInterface(mapping.getSupportingOtu4());
         }
@@ -269,13 +268,12 @@ public class OpenRoadmInterface221 {
             oduFunction = ODUCTP.VALUE;
             monitoringMode = MonitoringMode.Monitored;
         } else {
-            // For TPDR it can be both CTP and TTP
-            if (mapping.getXponderType() == XpdrNodeTypes.Tpdr) {
-                oduFunction = ODUTTPCTP.VALUE;
+            oduFunction =
+                // For TPDR it can be both CTP and TTP
                 // For switch-ponder we still use TTP
-            } else {
-                oduFunction = ODUTTP.VALUE;
-            }
+                mapping.getXponderType() == XpdrNodeTypes.Tpdr
+                    ? ODUTTPCTP.VALUE
+                    : ODUTTP.VALUE;
             monitoringMode = MonitoringMode.Terminated;
             opu = new OpuBuilder()
                 .setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
@@ -305,9 +303,10 @@ public class OpenRoadmInterface221 {
             new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
                 .setOdu(oduIfBuilder.build())
                 .build());
-
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
+        //TODO isCTP is checked twice. There is room for refactoring here
+        // and also likely for an intermediate fonction to create oduIfBuilder
         if (!isCTP) {
             LOG.info("{}-{} updating mapping with interface {}", nodeId, logicalConnPoint, oduInterfaceBldr.getName());
             this.portMapping.updateMapping(nodeId, mapping);
@@ -316,41 +315,39 @@ public class OpenRoadmInterface221 {
     }
 
     public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
-        throws OpenRoadmInterfaceException {
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    nodeId, logicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
-            logicalConnPoint + "-ODU");
-        oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
-
-        // ODU interface specific data
-        // Set Opu attributes
-        OpuBuilder opuBldr = new OpuBuilder()
-                .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
-                .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"));
-        OduBuilder oduIfBuilder = new OduBuilder()
-                .setRate(ODU4.VALUE)
-                .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
-                .setOpu(opuBldr.build());
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder();
-        oduInterfaceBldr.addAugmentation(oduIf1Builder.setOdu(oduIfBuilder.build()).build());
-
+        InterfaceBuilder oduInterfaceBldr =
+            createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU")
+                .setSupportingInterface(supportingOtuInterface)
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
+                        .setOdu(
+                            // ODU interface specific data
+                            new OduBuilder()
+                                .setRate(ODU4.VALUE)
+                                .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
+                                .setOpu(
+                                    new OpuBuilder()
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                                        .build())
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
         return oduInterfaceBldr.getName();
     }
 
     public String createOpenRoadmOdu4Interface(String anodeId, String alogicalConnPoint, String supportingOtuInterface,
-        String znodeId, String zlogicalConnPoint)
-        throws OpenRoadmInterfaceException {
+            String znodeId, String zlogicalConnPoint)
+            throws OpenRoadmInterfaceException {
         Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
         Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
         if (portMapA == null) {
@@ -361,31 +358,31 @@ public class OpenRoadmInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
-            alogicalConnPoint + "-ODU");
-        oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
-
-        // ODU interface specific data
-        // Set Opu attributes
-        OpuBuilder opuBldr = new OpuBuilder()
-            .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
-            .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"));
-        OduBuilder oduIfBuilder = new OduBuilder()
-            .setRate(ODU4.VALUE)
-            .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
-            .setOpu(opuBldr.build())
-            .setTxSapi(portMapA.getLcpHashVal())
-            .setTxDapi(portMapZ.getLcpHashVal())
-            // Setting the expected Dapi and Sapi values
-            .setExpectedDapi(portMapA.getLcpHashVal())
-            .setExpectedSapi(portMapZ.getLcpHashVal());
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder();
-        oduInterfaceBldr.addAugmentation(oduIf1Builder.setOdu(oduIfBuilder.build()).build());
-
+        InterfaceBuilder oduInterfaceBldr =
+            createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint + "-ODU")
+                .setSupportingInterface(supportingOtuInterface)
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
+                        .setOdu(
+                            new OduBuilder()
+                                .setRate(ODU4.VALUE)
+                                .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
+                                .setOpu(
+                                    // ODU interface specific data
+                                    // Set Opu attributes
+                                    new OpuBuilder()
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                                        .build())
+                                .setTxSapi(portMapA.getLcpHashVal())
+                                .setTxDapi(portMapZ.getLcpHashVal())
+                                // Setting the expected Dapi and Sapi values
+                                .setExpectedDapi(portMapA.getLcpHashVal())
+                                .setExpectedSapi(portMapZ.getLcpHashVal())
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(anodeId, oduInterfaceBldr);
         return oduInterfaceBldr.getName();
@@ -393,16 +390,11 @@ public class OpenRoadmInterface221 {
 
     public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
             AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
-
         Mapping mapping = this.portMapping.getMapping(nodeId, logicalConnPoint);
         if (mapping == null) {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
-            logicalConnPoint + "-OTU");
-        otuInterfaceBldr.setSupportingInterface(supportOchInterface);
-
         // OTU interface specific data
         OtuBuilder otuIfBuilder = new OtuBuilder()
             .setFec(OtuAttributes.Fec.Scfec)
@@ -419,13 +411,15 @@ public class OpenRoadmInterface221 {
                 .setExpectedSapi(apiInfoZ.getExpectedSapi())
                 .setExpectedDapi(apiInfoZ.getExpectedDapi());
         }
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.Interface1Builder otuIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.Interface1Builder();
-        otuInterfaceBldr.addAugmentation(otuIf1Builder.setOtu(otuIfBuilder.build()).build());
-
+        InterfaceBuilder otuInterfaceBldr =
+            createGenericInterfaceBuilder(mapping, OtnOtu.VALUE, logicalConnPoint + "-OTU")
+                .setSupportingInterface(supportOchInterface)
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.Interface1Builder()
+                        .setOtu(otuIfBuilder.build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, otuInterfaceBldr);
         this.portMapping.updateMapping(nodeId, mapping);
@@ -436,8 +430,7 @@ public class OpenRoadmInterface221 {
         return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotName);
     }
 
-    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
-        String key) {
+    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type, String key) {
         return new InterfaceBuilder()
                 .setDescription("  TBD   ")
                 .setCircuitId("   TBD    ")
@@ -450,46 +443,40 @@ public class OpenRoadmInterface221 {
     }
 
     public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
-        if (mapping.getSupportingOms() == null) {
-            // Create generic interface
-            InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.VALUE,
-                "OMS-" + mapping.getLogicalConnectionPoint());
-            if (mapping.getSupportingOts() != null) {
-                omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
-            } else {
-                LOG.error("Unable to get ots interface from mapping {} - {}", nodeId,
-                    mapping.getLogicalConnectionPoint());
-                return null;
-            }
-            this.openRoadmInterfaces.postInterface(nodeId, omsInterfaceBldr);
-            this.portMapping.updateMapping(nodeId, mapping);
-            return omsInterfaceBldr.build().getName();
-        } else {
+        if (mapping.getSupportingOms() != null) {
             return mapping.getSupportingOms();
         }
+        // Create generic interface
+        if (mapping.getSupportingOts() == null) {
+            LOG.error("Unable to get ots interface from mapping {} - {}", nodeId, mapping.getLogicalConnectionPoint());
+            return null;
+        }
+        InterfaceBuilder omsInterfaceBldr =
+            createGenericInterfaceBuilder(
+                    mapping, OpenROADMOpticalMultiplex.VALUE, "OMS-" + mapping.getLogicalConnectionPoint())
+                .setSupportingInterface(mapping.getSupportingOts());
+        this.openRoadmInterfaces.postInterface(nodeId, omsInterfaceBldr);
+        this.portMapping.updateMapping(nodeId, mapping);
+        return omsInterfaceBldr.build().getName();
     }
 
     public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
-        if (mapping.getSupportingOts() == null) {
-            // Create generic interface
-            InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-"
-                + mapping.getLogicalConnectionPoint());
-            // OTS interface augmentation specific data
-            OtsBuilder otsIfBuilder = new OtsBuilder();
-            otsIfBuilder.setFiberType(OtsAttributes.FiberType.Smf);
-
-            // Create Interface1 type object required for adding as
-            // augmentation
-            org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019.Interface1Builder
-                otsIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces
-                .rev181019.Interface1Builder();
-            otsInterfaceBldr.addAugmentation(otsIf1Builder.setOts(otsIfBuilder.build()).build());
-            this.openRoadmInterfaces.postInterface(nodeId, otsInterfaceBldr);
-            this.portMapping.updateMapping(nodeId, mapping);
-            return otsInterfaceBldr.build().getName();
-        } else {
+        if (mapping.getSupportingOts() != null) {
             return mapping.getSupportingOts();
         }
+        // Create generic interface
+        InterfaceBuilder otsInterfaceBldr =
+            createGenericInterfaceBuilder(mapping, OpticalTransport.VALUE, "OTS-" + mapping.getLogicalConnectionPoint())
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019
+                            .Interface1Builder()
+                        // OTS interface augmentation specific data
+                        .setOts(new OtsBuilder().setFiberType(OtsAttributes.FiberType.Smf).build())
+                        .build());
+        this.openRoadmInterfaces.postInterface(nodeId, otsInterfaceBldr);
+        this.portMapping.updateMapping(nodeId, mapping);
+        return otsInterfaceBldr.build().getName();
     }
 
     public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
@@ -501,27 +488,27 @@ public class OpenRoadmInterface221 {
         LOG.info("reading xc {} in node {}", xc, nodeId);
         Optional<RoadmConnections> crossconnection = deviceTransactionManager.getDataFromDevice(nodeId,
             LogicalDatastoreType.CONFIGURATION, xciid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
-        if (crossconnection.isPresent()) {
-            RoadmConnections rc = crossconnection.get();
-            LOG.info("xd {} found", xc);
-            String supportedinter = null;
-            if (!interfaceName.contains("nmc")) {
-                supportedinter = interfaceName.replace("mc", "nmc");
-            }
-            if (rc.getSource().getSrcIf().equals(interfaceName)
+        if (crossconnection.isEmpty()) {
+            LOG.info("xd {} not found !", xc);
+            return false;
+        }
+        RoadmConnections rc = crossconnection.get();
+        LOG.info("xd {} found", xc);
+        String supportedinter =
+            interfaceName.contains("nmc")
+                ? null
+                : interfaceName.replace("mc", "nmc");
+        if (rc.getSource().getSrcIf().equals(interfaceName)
                 || rc.getDestination().getDstIf().equals(interfaceName)
                 || rc.getSource().getSrcIf().equals(supportedinter)
                 || rc.getDestination().getDstIf().equals(supportedinter)) {
-                return true;
-            }
-        } else {
-            LOG.info("xd {} not found !", xc);
+            return true;
         }
         return false;
     }
 
     public boolean isUsedByOtnXc(String nodeId, String interfaceName, String xc,
-        DeviceTransactionManager deviceTransactionManager) {
+            DeviceTransactionManager deviceTransactionManager) {
         InstanceIdentifier<OduConnection> xciid = InstanceIdentifier
             .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
             .child(OduConnection.class, new OduConnectionKey(xc))
@@ -529,15 +516,15 @@ public class OpenRoadmInterface221 {
         LOG.info("reading xc {} in node {}", xc, nodeId);
         Optional<OduConnection> oduConnectionOpt = deviceTransactionManager.getDataFromDevice(nodeId,
             LogicalDatastoreType.CONFIGURATION, xciid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
-        if (oduConnectionOpt.isPresent()) {
-            OduConnection oduXc = oduConnectionOpt.get();
-            LOG.info("xc {} found", xc);
-            if (oduXc.getSource().getSrcIf().equals(interfaceName)
-                || oduXc.getDestination().getDstIf().equals(interfaceName)) {
-                return true;
-            }
-        } else {
+        if (oduConnectionOpt.isEmpty()) {
             LOG.info("xc {} not found !", xc);
+            return false;
+        }
+        OduConnection oduXc = oduConnectionOpt.get();
+        LOG.info("xc {} found", xc);
+        if (oduXc.getSource().getSrcIf().equals(interfaceName)
+                || oduXc.getDestination().getDstIf().equals(interfaceName)) {
+            return true;
         }
         return false;
     }
@@ -549,28 +536,28 @@ public class OpenRoadmInterface221 {
             throw new OpenRoadmInterfaceException(
                     String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
-                logicalConnPoint + "-ODU4");
-        oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
-
-        // ODU interface specific data
-        OduBuilder oduIfBuilder = new OduBuilder()
-                .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.VALUE)
-                .setOpu(opuBldr.build());
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder oduIf1Builder =
-                new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder();
-        oduInterfaceBldr.addAugmentation(oduIf1Builder.setOdu(oduIfBuilder.build()).build());
-
+        InterfaceBuilder oduInterfaceBldr =
+            createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU4")
+                .setSupportingInterface(supportingOtuInterface)
+                .addAugmentation(
+                // Create Interface1 type object required for adding as augmentation
+                // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
+                        .setOdu(
+                        // ODU interface specific data
+                            new OduBuilder()
+                                .setRate(ODU4.VALUE)
+                                .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
+                                .setOduFunction(ODUTTP.VALUE)
+                                .setOpu(
+                                    // Set Opu attributes
+                                    new OpuBuilder()
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("21"))
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("21"))
+                                        .build()
+                                )
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
         this.portMapping.updateMapping(nodeId, portMap);
@@ -578,8 +565,8 @@ public class OpenRoadmInterface221 {
     }
 
     public String createOpenRoadmOtnOdu4Interface(String anodeId, String alogicalConnPoint,
-        String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
-        throws OpenRoadmInterfaceException {
+            String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
+            throws OpenRoadmInterfaceException {
         Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
         if (portMapA == null) {
             throw new OpenRoadmInterfaceException(
@@ -590,33 +577,32 @@ public class OpenRoadmInterface221 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
-            alogicalConnPoint + "-ODU4");
-        oduInterfaceBldr.setSupportingInterface(asupportingOtuInterface);
-
-        // ODU interface specific data
-        OduBuilder oduIfBuilder = new OduBuilder()
-            .setRate(ODU4.VALUE)
-            .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
-            .setTxSapi(portMapA.getLcpHashVal())
-            .setTxDapi(portMapZ.getLcpHashVal())
-            .setExpectedSapi(portMapZ.getLcpHashVal())
-            .setExpectedDapi(portMapA.getLcpHashVal());
-
-
-        // Set Opu attributes
-        OpuBuilder opuBldr = new OpuBuilder()
-            .setPayloadType(PayloadTypeDef.getDefaultInstance("21"))
-            .setExpPayloadType(PayloadTypeDef.getDefaultInstance("21"));
-        oduIfBuilder.setOduFunction(ODUTTP.VALUE)
-            .setOpu(opuBldr.build());
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder();
-        oduInterfaceBldr.addAugmentation(oduIf1Builder.setOdu(oduIfBuilder.build()).build());
-
+        InterfaceBuilder oduInterfaceBldr =
+            createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint + "-ODU4")
+                .setSupportingInterface(asupportingOtuInterface)
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019
+                            .Interface1Builder()
+                        .setOdu(
+                        // ODU interface specific data
+                            new OduBuilder()
+                                .setRate(ODU4.VALUE)
+                                .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
+                                .setTxSapi(portMapA.getLcpHashVal())
+                                .setTxDapi(portMapZ.getLcpHashVal())
+                                .setExpectedSapi(portMapZ.getLcpHashVal())
+                                .setExpectedDapi(portMapA.getLcpHashVal())
+                                .setOduFunction(ODUTTP.VALUE)
+                                .setOpu(
+                                    // Set Opu attributes
+                                    new OpuBuilder()
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("21"))
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("21"))
+                                        .build())
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(anodeId, oduInterfaceBldr);
         this.portMapping.updateMapping(anodeId, portMapA);
index d53a7b65a150a4ca614c6d96860fa0bad8573b21..c57b39166bf4fc4e0f0da9270135a81a8a8a4f5b 100644 (file)
@@ -110,49 +110,35 @@ public class OpenRoadmInterface710 {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        // Ethernet interface specific data
-        EthernetBuilder ethIfBuilder = new EthernetBuilder()
-            .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.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.VALUE) // For 100G OFec mode, the fec is off
-                .setSpeed(Uint32.valueOf(100000));
-        }
-        InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE,
-            logicalConnPoint + "-ETHERNET");
-
-        // Create Interface1 type object required for adding as augmentation
-        Interface1Builder ethIf1Builder = new Interface1Builder();
-        ethInterfaceBldr.addAugmentation(ethIf1Builder.setEthernet(ethIfBuilder.build()).build());
-
+        InterfaceBuilder ethInterfaceBldr =
+            createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE, logicalConnPoint + "-ETHERNET")
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    new Interface1Builder()
+                        .setEthernet(
+                            // Ethernet interface specific data
+                            // We have to differentiate if-100GE vs if-400GE
+                            // Default set to 400G
+                            portMap.getSupportedInterfaceCapability().contains(If100GE.VALUE)
+                                // 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
+                                ? new EthernetBuilder().setFec(Off.VALUE).setSpeed(Uint32.valueOf(100000)).build()
+                                : new EthernetBuilder().setFec(Rsfec.VALUE).setSpeed(Uint32.valueOf(400000)).build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, ethInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack
         openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
-
         return ethInterfaceBldr.getName();
     }
 
     public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint,
-        SpectrumInformation spectrumInformation)
-        throws OpenRoadmInterfaceException {
-
+            SpectrumInformation spectrumInformation)
+            throws OpenRoadmInterfaceException {
         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.VALUE)
-            .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
-            .setModulationFormat(modulationFormat);
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
@@ -160,127 +146,125 @@ public class OpenRoadmInterface710 {
                     nodeId, logicalConnPoint));
         }
         // Create generic interface
-        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
-        org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev200529.Interface1Builder
-            ochIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev200529
-            .Interface1Builder();
-        ochInterfaceBldr.addAugmentation(ochIf1Builder.setOch(ocIfBuilder.build()).build());
-
+        InterfaceBuilder ochInterfaceBldr =
+            createGenericInterfaceBuilder(
+                    portMap, OpticalChannel.VALUE,
+                    spectrumInformation.getIdentifierFromParams(logicalConnPoint))
+                .addAugmentation(
+                // Create Interface1 type object required for adding as augmentation
+                // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev200529
+                            .Interface1Builder()
+                        .setOch(
+                            // OCH interface specific data
+                            new OchBuilder()
+                                .setFrequency(
+                                    new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
+                                .setRate(R100G.VALUE)
+                                .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
+                                .setModulationFormat(modulationFormat)
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, ochInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
         }
-
         return ochInterfaceBldr.getName();
     }
 
     public String createOpenRoadmOtsiInterface(String nodeId, String logicalConnPoint,
             SpectrumInformation spectrumInformation)
             throws OpenRoadmInterfaceException {
-
         ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
         if (modulationFormat == null) {
             throw new OpenRoadmInterfaceException(String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
         }
-
         // OTSI interface specific data
-        OtsiBuilder  otsiBuilder = new OtsiBuilder()
+        OtsiBuilder otsiBuilder = new OtsiBuilder()
             .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
             .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
             .setProvisionMode(ProvisionModeType.Explicit)
             .setFec(Ofec.VALUE)
             .setModulationFormat(modulationFormat);
-
-        // Set the Flexo values
-        FlexoBuilder flexoBuilder = new FlexoBuilder();
-        boolean rateNotFound = false;
         // Use the rate to switch rather than modulation format
         int serviceRate = getServiceRate(modulationFormat, spectrumInformation);
         switch (serviceRate) {
             case 100:
                 LOG.info("Given modulation format and spectral width 50GHz {} and thus rate is 100G",
                     modulationFormat);
+                // TODO check if FOIC and Gbaud logs could not be rationalized
                 LOG.info("FOIC is 1.4 for 31.6 Gbaud and rate is 100");
-                flexoBuilder.setFoicType(Foic14.VALUE)
-                    .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1))));
-                otsiBuilder.setOtsiRate(R100GOtsi.VALUE)
-                    .setFlexo(flexoBuilder.build());
+                otsiBuilder
+                    .setOtsiRate(R100GOtsi.VALUE)
+                    .setFlexo(new FlexoBuilder()
+                        .setFoicType(Foic14.VALUE)
+                        .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1))))
+                        .build());
                 break;
             case 200:
                 LOG.info("Given modulation format is {} and thus rate is 200G", modulationFormat);
+                FlexoBuilder flexoBuilder = new FlexoBuilder()
+                    .setIid(new ArrayList<>(List.of(Uint8.valueOf(1), Uint8.valueOf(2))));
                 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.VALUE)
-                        .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2))));
+                    flexoBuilder.setFoicType(Foic28.VALUE);
                 } else {
                     // default is dp-qpsk for 200G under 63.1 GBaud
-                    flexoBuilder.setFoicType(Foic24.VALUE)
-                        .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2))));
+                    flexoBuilder.setFoicType(Foic24.VALUE);
                 }
-                otsiBuilder.setOtsiRate(R200GOtsi.VALUE)
+                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.VALUE)
-                    .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
-                        Uint8.valueOf(3))));
                 otsiBuilder.setOtsiRate(R300GOtsi.VALUE)
-                    .setFlexo(flexoBuilder.build());
+                    .setFlexo(new FlexoBuilder()
+                        .setFoicType(Foic36.VALUE)
+                        .setIid(new ArrayList<>(List.of(Uint8.valueOf(1), Uint8.valueOf(2), Uint8.valueOf(3))))
+                        .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.VALUE)
-                    .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
-                        Uint8.valueOf(3), Uint8.valueOf(4))));
-                otsiBuilder.setModulationFormat(modulationFormat)
+                otsiBuilder
+                    .setModulationFormat(modulationFormat)
                     .setOtsiRate(R400GOtsi.VALUE)
-                    .setFlexo(flexoBuilder.build());
+                    .setFlexo(new FlexoBuilder()
+                        .setFoicType(Foic48.VALUE)
+                        .setIid(new ArrayList<>(
+                            List.of(Uint8.valueOf(1), Uint8.valueOf(2), Uint8.valueOf(3), Uint8.valueOf(4))))
+                        .build());
                 break;
             default:
                 LOG.error("Rate {} is unsupported", serviceRate);
-                rateNotFound = true;
-                break;
+                throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
         }
-
-        if (rateNotFound) {
-            throw new OpenRoadmInterfaceException(
-                String.format(RATE_EXCEPTION_MESSAGE));
-        }
-
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
         // Create generic interface
-        InterfaceBuilder otsiInterfaceBldr = createGenericInterfaceBuilder(portMap, Otsi.VALUE,
-            spectrumInformation.getIdentifierFromParams(logicalConnPoint));
-        // Create Interface1 type object required for adding as augmentation
-        org.opendaylight.yang.gen.v1.http
-            .org.openroadm.optical.channel.tributary.signal.interfaces.rev200529.Interface1Builder otsiIf1Builder =
-            new org.opendaylight.yang.gen.v1.http
-                .org.openroadm.optical.channel.tributary.signal.interfaces.rev200529.Interface1Builder();
-
-        otsiInterfaceBldr.addAugmentation(otsiIf1Builder.setOtsi(otsiBuilder.build()).build());
-
+        InterfaceBuilder otsiInterfaceBldr =
+            createGenericInterfaceBuilder(
+                    portMap, Otsi.VALUE,
+                    spectrumInformation.getIdentifierFromParams(logicalConnPoint))
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    new org.opendaylight.yang.gen.v1.http
+                            .org.openroadm.optical.channel.tributary.signal.interfaces.rev200529.Interface1Builder()
+                        .setOtsi(otsiBuilder.build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, otsiInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
         }
-
         return otsiInterfaceBldr.getName();
     }
 
@@ -292,8 +276,7 @@ public class OpenRoadmInterface710 {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    nodeId, logicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
         // Check the modulation format
         ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
@@ -302,9 +285,7 @@ public class OpenRoadmInterface710 {
         }
         int serviceRate = getServiceRate(modulationFormat, spectrumInformation);
         // Create an OTSI group object
-        OtsiGroupBuilder otsiGroupBuilder = new OtsiGroupBuilder()
-            .setGroupId(Uint32.valueOf(1));
-        boolean rateNotFound = false;
+        OtsiGroupBuilder otsiGroupBuilder = new OtsiGroupBuilder().setGroupId(Uint32.valueOf(1));
         switch (serviceRate) {
             case 100:
                 otsiGroupBuilder.setGroupRate(R100GOtsi.VALUE);
@@ -320,85 +301,62 @@ public class OpenRoadmInterface710 {
                 break;
             default:
                 LOG.error("Rate {} is not supported", serviceRate);
-                rateNotFound = true;
-                break;
-        }
-        if (rateNotFound) {
-            throw new OpenRoadmInterfaceException(
-                String.format(RATE_EXCEPTION_MESSAGE));
+                throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
         }
-
         // Create generic interface
-        InterfaceBuilder otsiGroupInterfaceBldr = createGenericInterfaceBuilder(portMap, OtsiGroup.VALUE,
-            logicalConnPoint + String.join("-", "", "OTSIGROUP", serviceRate + "G"));
-
-        // Create a list
-        Set<String> listSupportingOtsiInterface = new HashSet<>();
-        listSupportingOtsiInterface.add(supportingOtsiInterface);
-        otsiGroupInterfaceBldr.setSupportingInterfaceList(listSupportingOtsiInterface);
-
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otsi.group.interfaces.rev200529.Interface1Builder
-            otsiGroupIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otsi.group.interfaces.rev200529.Interface1Builder();
-        otsiGroupInterfaceBldr.addAugmentation(otsiGroupIf1Builder.setOtsiGroup(otsiGroupBuilder.build()).build());
-
+        InterfaceBuilder otsiGroupInterfaceBldr =
+            createGenericInterfaceBuilder(
+                    portMap, OtsiGroup.VALUE,
+                    logicalConnPoint + String.join("-", "", "OTSIGROUP", serviceRate + "G"))
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOtsiInterface)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otsi.group.interfaces.rev200529
+                            .Interface1Builder()
+                        .setOtsiGroup(otsiGroupBuilder.build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, otsiGroupInterfaceBldr);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
         }
-
         return otsiGroupInterfaceBldr.getName();
     }
 
     public String createOpenRoadmOchOtsiOtsigroupInterface(String nodeId, String logicalConnPoint,
-        SpectrumInformation spectrumInformation)
-        throws OpenRoadmInterfaceException {
+            SpectrumInformation spectrumInformation)
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        String interfaceOchOtsiOtsigroup = null;
         if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
             // create OCH interface
-            interfaceOchOtsiOtsigroup = createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation);
+            return createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation);
         } 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
-            interfaceOchOtsiOtsigroup = interfaceOtsiName
-                + "#" + createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint, interfaceOtsiName,
-                spectrumInformation);
+            // And Concat the two names for this interface
+            return interfaceOtsiName + "#"
+                + createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint, interfaceOtsiName, spectrumInformation);
         }
-
-        return interfaceOchOtsiOtsigroup;
+        return null;
     }
 
     public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
-        AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
-
+            AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
         Mapping mapping = this.portMapping.getMapping(nodeId, logicalConnPoint);
         if (mapping == null) {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder
-            otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
-            logicalConnPoint + "-OTU4");
-        // Supporting interface list
-        Set<String> listSupportingOChInterface = new HashSet<>();
-        listSupportingOChInterface.add(supportOchInterface);
-        otuInterfaceBldr.setSupportingInterfaceList(listSupportingOChInterface);
-
         // OTU interface specific data
         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.VALUE)
-            .setRate(OTU4.VALUE);
+                otuIfBuilder =
+            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.otu.container.OtuBuilder()
+                .setFec(Scfec.VALUE)
+                .setRate(OTU4.VALUE);
         if (apiInfoA != null) {
             otuIfBuilder.setTxSapi(apiInfoA.getSapi())
                 .setTxDapi(apiInfoA.getDapi())
@@ -411,13 +369,15 @@ public class OpenRoadmInterface710 {
                 .setExpectedSapi(apiInfoZ.getExpectedSapi())
                 .setExpectedDapi(apiInfoZ.getExpectedDapi());
         }
-
-        // Create Interface1 type object required for adding as augmentation
-        // TODO look at imports of different versions of class
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder otuIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder();
-        otuInterfaceBldr.addAugmentation(otuIf1Builder.setOtu(otuIfBuilder.build()).build());
-
+        InterfaceBuilder otuInterfaceBldr =
+            createGenericInterfaceBuilder(mapping, OtnOtu.VALUE, logicalConnPoint + "-OTU4")
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportOchInterface)))
+                .addAugmentation(
+                    // Create Interface1 type object required for adding as augmentation
+                    // TODO look at imports of different versions of class
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder()
+                        .setOtu(otuIfBuilder.build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, otuInterfaceBldr);
         this.portMapping.updateMapping(nodeId, mapping);
@@ -441,7 +401,6 @@ public class OpenRoadmInterface710 {
             .setTimDetectMode(TimDetectMode.Disabled)
             .setDegmIntervals(Uint8.valueOf(2))
             .setDegthrPercentage(Uint16.valueOf(100));
-
         if (apiInfoA != null) {
             otuBuilder.setTxSapi(apiInfoA.getSapi())
                 .setTxDapi(apiInfoA.getDapi())
@@ -456,9 +415,7 @@ public class OpenRoadmInterface710 {
         }
         // Set the OTUCn rate for various rates
         String rate = supportingOtsiGroupInterface.substring(supportingOtsiGroupInterface.lastIndexOf('-') + 1);
-
         String otucnrate = null;
-        boolean rateNotFound = false;
         switch (rate) {
             case "100G":
                 otuBuilder.setOtucnNRate(Uint16.valueOf(1));
@@ -478,27 +435,15 @@ public class OpenRoadmInterface710 {
                 break;
             default:
                 LOG.error("Rate {} is not supported", rate);
-                rateNotFound = true;
-                break;
-        }
-        if (rateNotFound) {
-            throw new OpenRoadmInterfaceException(
-                String.format(RATE_EXCEPTION_MESSAGE));
-        }
-
-        InterfaceBuilder otuInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOtu.VALUE,
-            logicalConnPoint + "-OTUC" + otucnrate);
-
-        // Create a list
-        Set<String> listSupportingOtsiGroupInterface = new HashSet<>();
-        listSupportingOtsiGroupInterface.add(supportingOtsiGroupInterface);
-
-        otuInterfaceBuilder.setSupportingInterfaceList(listSupportingOtsiGroupInterface);
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder otuIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder();
-
-        otuInterfaceBuilder.addAugmentation(otuIf1Builder.setOtu(otuBuilder.build()).build());
-
+                throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+        }
+        InterfaceBuilder otuInterfaceBuilder =
+            createGenericInterfaceBuilder(mapping, OtnOtu.VALUE, logicalConnPoint + "-OTUC" + otucnrate)
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOtsiGroupInterface)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder()
+                        .setOtu(otuBuilder.build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, otuInterfaceBuilder);
         // Post the equipment-state change on the device circuit-pack if xpdr node
@@ -510,8 +455,8 @@ public class OpenRoadmInterface710 {
     }
 
     public String createOpenRoadmOtu4OtucnInterface(String nodeId, String logicalConnPoint,
-        String supportingInterface, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ)
-        throws OpenRoadmInterfaceException {
+            String supportingInterface, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ)
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
@@ -519,48 +464,39 @@ 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.VALUE)) {
             // create OTU4 interface
-            interfaceOtu4Otucn = createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportingInterface,
-                apiInfoA, apiInfoZ);
+            return createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportingInterface, apiInfoA, apiInfoZ);
         } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
             // Create OTUCn
-            interfaceOtu4Otucn = createOpenRoadmOtucnInterface(nodeId, logicalConnPoint, supportingInterface,
-                apiInfoA, apiInfoZ);
+            return createOpenRoadmOtucnInterface(nodeId, logicalConnPoint, supportingInterface, apiInfoA, apiInfoZ);
         }
-
-        return interfaceOtu4Otucn;
+        return null;
     }
 
     public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint,
-        AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
-
+            AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
         Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
         if (mapping == null) {
             throw new OpenRoadmInterfaceException(
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
-            logicalConnPoint + "-ODU4");
-        Set<String> listSupportingOtu4Interface = new HashSet<>();
+        InterfaceBuilder oduInterfaceBldr =
+            createGenericInterfaceBuilder(mapping, OtnOdu.VALUE, logicalConnPoint + "-ODU4");
         if (mapping.getSupportingOtu4() != null) {
-            listSupportingOtu4Interface.add(mapping.getSupportingOtu4());
-            oduInterfaceBldr.setSupportingInterfaceList(listSupportingOtu4Interface);
+            oduInterfaceBldr.setSupportingInterfaceList(new HashSet<>(Set.of(mapping.getSupportingOtu4())));
         }
-
-        // OPU payload
-        OpuBuilder opuBuilder = new OpuBuilder()
-            .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
-            .setPayloadType(PayloadTypeDef.getDefaultInstance("07"));
-
         // Create an ODU4 object
         OduBuilder oduBuilder = new OduBuilder()
             .setRate(ODU4.VALUE)
             .setOduFunction(ODUTTP.VALUE)
             .setMonitoringMode(MonitoringMode.Terminated)
-            .setOpu(opuBuilder.build());
-
+            .setOpu(
+                // OPU payload
+                new OpuBuilder()
+                    .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                    .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                    .build());
         if (apiInfoA != null) {
             oduBuilder.setTxSapi(apiInfoA.getSapi())
                 .setTxDapi(apiInfoA.getDapi())
@@ -573,17 +509,16 @@ public class OpenRoadmInterface710 {
                 .setExpectedSapi(apiInfoZ.getExpectedSapi())
                 .setExpectedDapi(apiInfoZ.getExpectedDapi());
         }
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
-
-        oduInterfaceBldr.addAugmentation(oduIf1Builder.setOdu(oduBuilder.build()).build());
-
+        oduInterfaceBldr
+            .addAugmentation(
+                new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder()
+                    .setOdu(oduBuilder.build())
+                .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
         // Since this is not a CTP, we can update the port-mapping
         LOG.info("{}-{} updating mapping with interface {}", nodeId, logicalConnPoint, oduInterfaceBldr.getName());
         this.portMapping.updateMapping(nodeId, mapping);
-
         return oduInterfaceBldr.getName();
     }
 
@@ -593,173 +528,129 @@ public class OpenRoadmInterface710 {
         Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
         if (mapping == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    nodeId, logicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        // Create ODUcn object
-        // Start with OPU object
-        // OPU payload
-        OpuBuilder opuBuilder = new OpuBuilder()
-            .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
-            .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
-
-        // Create an ODUCn object
-        OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.VALUE)
-            .setOduFunction(ODUTTP.VALUE)
-            .setMonitoringMode(MonitoringMode.Terminated)
-            .setTimActEnabled(false)
-            .setTimDetectMode(TimDetectMode.Disabled)
-            .setDegmIntervals(Uint8.valueOf(2))
-            .setDegthrPercentage(Uint16.valueOf(100))
-            .setOducnNRate(Uint16.valueOf(4))
-            .setOpu(opuBuilder.build());
-
-        // Create a list
-        String supportingOtucn;
-        Set<String> listSupportingOtucnInterface = new HashSet<>();
-        if (mapping.getSupportingOtucn() != null) {
-            listSupportingOtucnInterface.add(mapping.getSupportingOtucn());
-            supportingOtucn = mapping.getSupportingOtucn();
-        } else {
+        if (mapping.getSupportingOtucn() == null) {
             throw new OpenRoadmInterfaceException(
                 String.format("Missing supporting OTUCn interface on port-mapping"));
         }
-
+        String supportingOtucn = mapping.getSupportingOtucn();
         // Set the ODUCn rate from OTUCn interface naming convention
         String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
         // check if the oducnrate is a valid value and if it is invalid, then throw error
         if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
-            throw new OpenRoadmInterfaceException(
-                String.format(RATE_EXCEPTION_MESSAGE));
-        }
-
-        oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
-
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOdu.VALUE,
-            logicalConnPoint + "-ODUC" + oducnrate);
-
-        oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
-
-        oduInterfaceBuilder.addAugmentation(oduIf1Builder.setOdu(oduBuilder.build()).build());
-
+            throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+        }
+        InterfaceBuilder oduInterfaceBuilder =
+            createGenericInterfaceBuilder(mapping, OtnOdu.VALUE, logicalConnPoint + "-ODUC" + oducnrate)
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOtucn)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder()
+                        .setOdu(
+                            // Create an ODUCn object
+                            new OduBuilder()
+                                .setRate(ODUCn.VALUE)
+                                .setOduFunction(ODUTTP.VALUE)
+                                .setMonitoringMode(MonitoringMode.Terminated)
+                                .setTimActEnabled(false)
+                                .setTimDetectMode(TimDetectMode.Disabled)
+                                .setDegmIntervals(Uint8.valueOf(2))
+                                .setDegthrPercentage(Uint16.valueOf(100))
+                                .setOducnNRate(Uint16.valueOf(oducnrate))
+                                .setOpu(
+                                    // OPU payload
+                                    new OpuBuilder()
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                        .build())
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduInterfaceBuilder);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (mapping.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(nodeId, mapping.getSupportingCircuitPackName(), true);
         }
-
         return oduInterfaceBuilder.getName();
     }
 
     // Overloaded methods should be together
     // With SAPI and DAPI information
     public String createOpenRoadmOducnInterface(String anodeId, String alogicalConnPoint,
-        String supportingOtucn, String znodeId, String zlogicalConnPoint)
-        throws OpenRoadmInterfaceException {
+            String supportingOtucn, String znodeId, String zlogicalConnPoint)
+            throws OpenRoadmInterfaceException {
+        // Set the ODUCn rate from OTUCn interface naming convention
+        String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
+        // check if the oducnrate is a valid value and if it is invalid, then throw error
+        if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
+            throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+        }
         Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
-        Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
         if (portMapA == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    anodeId, alogicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
         }
         // On the Zside
+        Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
         if (portMapZ == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    znodeId, zlogicalConnPoint));
-
-        }
-        // Create ODUcn object
-        // Start with OPU object
-        // OPU payload
-        OpuBuilder opuBuilder = new OpuBuilder()
-            .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
-            .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
-
-        // Create an ODUC4 object
-        OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.VALUE)
-            .setOduFunction(ODUTTP.VALUE)
-            .setMonitoringMode(MonitoringMode.Terminated)
-            .setTimActEnabled(false)
-            .setTimDetectMode(TimDetectMode.Disabled)
-            .setDegmIntervals(Uint8.valueOf(2))
-            .setDegthrPercentage(Uint16.valueOf(100))
-            .setOpu(opuBuilder.build())
-            .setTxSapi(portMapA.getLcpHashVal())
-            .setTxDapi(portMapZ.getLcpHashVal())
-            .setExpectedSapi(portMapZ.getLcpHashVal())
-            .setExpectedDapi(portMapZ.getLcpHashVal());
-
-        // Set the ODUCn rate from OTUCn interface naming convention
-        String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
-
-        // check if the oducnrate is a valid value and if it is invalid, then throw error
-        if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
-            throw new OpenRoadmInterfaceException(
-                String.format(RATE_EXCEPTION_MESSAGE));
-        }
-
-        oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
-
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
-            alogicalConnPoint + ODUC + oducnrate);
-
-        // Create a list
-        Set<String> listSupportingOtucnInterface = new HashSet<>();
-        listSupportingOtucnInterface.add(supportingOtucn);
-
-        oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
-
-        oduInterfaceBuilder.addAugmentation(oduIf1Builder.setOdu(oduBuilder.build()).build());
-
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
+        }
+        InterfaceBuilder oduInterfaceBuilder =
+            createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint + ODUC + oducnrate)
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOtucn)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder()
+                        .setOdu(
+                            new OduBuilder()
+                                .setRate(ODUCn.VALUE)
+                                .setOducnNRate(Uint16.valueOf(oducnrate))
+                                .setOduFunction(ODUTTP.VALUE)
+                                .setMonitoringMode(MonitoringMode.Terminated)
+                                .setTimActEnabled(false)
+                                .setTimDetectMode(TimDetectMode.Disabled)
+                                .setDegmIntervals(Uint8.valueOf(2))
+                                .setDegthrPercentage(Uint16.valueOf(100))
+                                .setOpu(
+                                    // OPU payload
+                                    new OpuBuilder()
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                        .build())
+                                .setTxSapi(portMapA.getLcpHashVal())
+                                .setTxDapi(portMapZ.getLcpHashVal())
+                                .setExpectedSapi(portMapZ.getLcpHashVal())
+                                .setExpectedDapi(portMapZ.getLcpHashVal())
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(anodeId, oduInterfaceBuilder);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMapA.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(anodeId, portMapA.getSupportingCircuitPackName(), true);
         }
-
         return oduInterfaceBuilder.getName();
     }
 
 
     // This is only for transponder
     public String createOpenRoadmOduflexInterface(String nodeId, String logicalConnPoint,
-        String supportingOducn)
-        throws OpenRoadmInterfaceException {
+            String supportingOducn)
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    nodeId, logicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-
         // Parent Odu-allocation
         // Set the trib-slot array
         Set<OpucnTribSlotDef> tribslots = new HashSet<>();
         // Here the int stream is based on rate
         // Get the rate, which can be 1, 2, 3 or 4 4=400G, 1=100G
         String rate = supportingOducn.substring(supportingOducn.length() - 1);
-        IntStream.range(1, Integer.parseInt(rate) + 1).forEach(a -> IntStream.range(1, 21).forEach(b -> tribslots.add(
-            OpucnTribSlotDef.getDefaultInstance(a + "." + b))));
-
-        ParentOduAllocationBuilder parentOduAllocationBuilder = new ParentOduAllocationBuilder()
-            .setTribPortNumber(Uint16.valueOf(1))
-            .setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(tribslots).build());
-
-        // OPU payload
-        OpuBuilder opuBuilder = new OpuBuilder();
-
+        IntStream.range(1, Integer.parseInt(rate) + 1)
+            .forEach(a -> IntStream.range(1, 21)
+                .forEach(b -> tribslots.add(OpucnTribSlotDef.getDefaultInstance(a + "." + b))));
         // Create an ODUFlex object
         OduBuilder oduBuilder = new OduBuilder()
             .setOduFunction(ODUTTPCTP.VALUE)
@@ -768,66 +659,65 @@ public class OpenRoadmInterface710 {
             .setTimDetectMode(TimDetectMode.Disabled)
             .setDegmIntervals(Uint8.valueOf(2))
             .setDegthrPercentage(Uint16.valueOf(100))
-            .setParentOduAllocation(parentOduAllocationBuilder.build());
-
+            .setParentOduAllocation(
+                new ParentOduAllocationBuilder()
+                    .setTribPortNumber(Uint16.valueOf(1))
+                    .setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(tribslots).build())
+                    .build());
+        // Build the OPU container to the ODU builder
         if (rate.equals("1")) {
-            opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
-                .setPayloadType(PayloadTypeDef.getDefaultInstance("07"));
-            oduBuilder.setRate(ODU4.VALUE);
+            oduBuilder
+                .setRate(ODU4.VALUE)
+                .setOpu(
+                    new OpuBuilder()
+                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                        .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                        .build());
             logicalConnPoint += "-ODU4";
         } else if (rate.equals("4")) {
-            opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
-                .setPayloadType(PayloadTypeDef.getDefaultInstance("32"));
-            oduBuilder.setRate(ODUflexCbr.VALUE).setOduflexCbrService(ODUflexCbr400G.VALUE);
+            oduBuilder
+                .setRate(ODUflexCbr.VALUE)
+                .setOduflexCbrService(ODUflexCbr400G.VALUE)
+                .setOpu(
+                    new OpuBuilder()
+                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+                        .setPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+                        .build());
             logicalConnPoint += "-ODUFLEX";
-        }
-
-        // Build the OPU container to the ODU builder
-        oduBuilder.setOpu(opuBuilder.build());
-
-        InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
-            logicalConnPoint);
-
-        Set<String> listSupportingOtucnInterface = new HashSet<>();
-        listSupportingOtucnInterface.add(supportingOducn);
-
-        oduflexInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
-
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder
-            oduflexIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
-
-        oduflexInterfaceBuilder.addAugmentation(oduflexIf1Builder.setOdu(oduBuilder.build()).build());
-
+        } else {
+            oduBuilder.setOpu(new OpuBuilder().build());
+        }
+        InterfaceBuilder oduflexInterfaceBuilder =
+            createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint)
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOducn)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder()
+                        .setOdu(oduBuilder.build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduflexInterfaceBuilder);
-
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
         }
-
         return oduflexInterfaceBuilder.getName();
     }
 
     // Overloaded methods should be together
     // This is only for transponder; with SAPI/DAPI information
     public String createOpenRoadmOduflexInterface(String anodeId, String alogicalConnPoint,
-        String supportingOducn, String znodeId, String zlogicalConnPoint)
-        throws OpenRoadmInterfaceException {
+            String supportingOducn, String znodeId, String zlogicalConnPoint)
+            throws OpenRoadmInterfaceException {
         Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
-        Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
         if (portMapA == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    anodeId, alogicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
         }
         // On the Zside
+        Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
         if (portMapZ == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    znodeId, zlogicalConnPoint));
-
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
         }
         // Parent Odu-allocation
         // Set the trib-slot array
@@ -835,16 +725,9 @@ public class OpenRoadmInterface710 {
         // Here the int stream is based on rate
         // Get the rate, which can be 1, 2, 3 or 4 4=400G, 1=100G
         String rate = supportingOducn.substring(supportingOducn.lastIndexOf('-') + 1);
-        IntStream.range(1, Integer.parseInt(rate) + 1).forEach(a -> IntStream.range(1, 21).forEach(b -> tribslots.add(
-            OpucnTribSlotDef.getDefaultInstance(a + "." + b))));
-
-        ParentOduAllocationBuilder parentOduAllocationBuilder = new ParentOduAllocationBuilder()
-            .setTribPortNumber(Uint16.valueOf(1))
-            .setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(tribslots).build());
-
-        // OPU payload
-        OpuBuilder opuBuilder = new OpuBuilder();
-
+        IntStream.range(1, Integer.parseInt(rate) + 1)
+            .forEach(a -> IntStream.range(1, 21)
+                .forEach(b -> tribslots.add(OpucnTribSlotDef.getDefaultInstance(a + "." + b))));
         // Create an ODUFlex object
         OduBuilder oduBuilder = new OduBuilder()
             .setOduFunction(ODUTTPCTP.VALUE)
@@ -853,51 +736,52 @@ public class OpenRoadmInterface710 {
             .setTimDetectMode(TimDetectMode.Disabled)
             .setDegmIntervals(Uint8.valueOf(2))
             .setDegthrPercentage(Uint16.valueOf(100))
-            .setOpu(opuBuilder.build())
-            .setParentOduAllocation(parentOduAllocationBuilder.build());
-
+            // TODO the following line seemed to come a bit early
+            // so it is now commented out and the code was aligned with previous method
+            //.setOpu(opuBuilder.build())
+            .setParentOduAllocation(
+                new ParentOduAllocationBuilder()
+                    .setTribPortNumber(Uint16.valueOf(1))
+                    .setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(tribslots).build())
+                    .build());
         if (rate.equals("1")) {
-            opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
-                .setPayloadType(PayloadTypeDef.getDefaultInstance("07"));
-            oduBuilder.setRate(ODU4.VALUE);
+            oduBuilder
+                .setRate(ODU4.VALUE)
+                .setOpu(
+                    new OpuBuilder()
+                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                        .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+                        .build());
             alogicalConnPoint += "-ODU4";
         } else if (rate.equals("4")) {
-            opuBuilder.setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
-                .setPayloadType(PayloadTypeDef.getDefaultInstance("32"));
-            oduBuilder.setRate(ODUflexCbr.VALUE).setOduflexCbrService(ODUflexCbr400G.VALUE);
+            oduBuilder
+                .setRate(ODUflexCbr.VALUE)
+                .setOduflexCbrService(ODUflexCbr400G.VALUE)
+                .setOpu(
+                    new OpuBuilder()
+                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+                        .setPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+                        .build());
             alogicalConnPoint += "-ODUFLEX";
-        }
-
-        InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
-            alogicalConnPoint);
-
-
-        Set<String> listSupportingOtucnInterface = new HashSet<>();
-        listSupportingOtucnInterface.add(supportingOducn);
-
-        oduflexInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
-
-
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder
-            oduflexIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
-
-        oduflexInterfaceBuilder.addAugmentation(oduflexIf1Builder.setOdu(oduBuilder.build()).build());
-
-        // Post interface on the device
-        openRoadmInterfaces.postInterface(anodeId, oduflexInterfaceBuilder);
-
+        } else {
+            oduBuilder.setOpu(new OpuBuilder().build());
+        }
+        InterfaceBuilder oduflexInterfaceBuilder =
+            createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint)
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOducn)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder()
+                        .setOdu(oduBuilder.build())
+                        .build());
         // Post the equipment-state change on the device circuit-pack if xpdr node
         if (portMapA.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
             this.openRoadmInterfaces.postEquipmentState(anodeId, portMapA.getSupportingCircuitPackName(), true);
         }
-
         return oduflexInterfaceBuilder.getName();
     }
 
     public String createOpenRoadmOdu4OducnOduflex(String nodeId, String logicalConnPoint,
-        AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
-
+            AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
@@ -909,67 +793,54 @@ public class OpenRoadmInterface710 {
         // Depending on OTU4 or OTUCn, supporting interface should reflect that
         if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
             // create OTU4 interface
-            interfaceOdu4OducnOduflex = createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
+            return createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
         } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
             // Create ODUCn and ODUFlex interface.
             String interfaceOducn = createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
-            interfaceOdu4OducnOduflex  = interfaceOducn + "#"
+            return interfaceOducn + "#"
                 + createOpenRoadmOduflexInterface(nodeId, logicalConnPoint, interfaceOducn);
         }
-        return interfaceOdu4OducnOduflex;
+        return null;
     }
 
     public String createOpenRoadmOtnOducnInterface(String nodeId, String logicalConnPoint,
-        String supportingOtucn)
-        throws OpenRoadmInterfaceException {
+            String supportingOtucn)
+            throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    nodeId, logicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
         }
-        // Create ODUcn object
-        // Start with OPU object
-        // OPU payload
-        OpuBuilder opuBuilder = new OpuBuilder()
-            .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
-            .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
-
-        // Create an ODUC4 object
-        OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.VALUE)
-            .setOduFunction(ODUTTP.VALUE)
-            .setMonitoringMode(MonitoringMode.Terminated)
-            .setTimActEnabled(false)
-            .setTimDetectMode(TimDetectMode.Disabled)
-            .setDegmIntervals(Uint8.valueOf(2))
-            .setDegthrPercentage(Uint16.valueOf(100))
-            .setOpu(opuBuilder.build());
-
         // Set the ODUCn rate from OTUCn interface naming convention
         String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
-
         // check if the oducnrate is a valid value and if it is invalid, then throw error
         if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
-            throw new OpenRoadmInterfaceException(
-                String.format(RATE_EXCEPTION_MESSAGE));
-        }
-
-        oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
-
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.VALUE,
-            logicalConnPoint + ODUC + oducnrate);
-
-        // Create a list
-        Set<String> listSupportingOtucnInterface = new HashSet<>();
-        listSupportingOtucnInterface.add(supportingOtucn);
-
-        oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
-
-        oduInterfaceBuilder.addAugmentation(oduIf1Builder.setOdu(oduBuilder.build()).build());
-
+            throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+        }
+        InterfaceBuilder oduInterfaceBuilder =
+            createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + ODUC + oducnrate)
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOtucn)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder()
+                        .setOdu(
+                            // Create an ODUC4 object
+                            new OduBuilder()
+                                .setRate(ODUCn.VALUE)
+                                .setOducnNRate(Uint16.valueOf(oducnrate))
+                                .setOduFunction(ODUTTP.VALUE)
+                                .setMonitoringMode(MonitoringMode.Terminated)
+                                .setTimActEnabled(false)
+                                .setTimDetectMode(TimDetectMode.Disabled)
+                                .setDegmIntervals(Uint8.valueOf(2))
+                                .setDegthrPercentage(Uint16.valueOf(100))
+                                .setOpu(
+                                    // OPU payload
+                                    new OpuBuilder()
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                    .build())
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduInterfaceBuilder);
         // Post the equipment-state change on the device circuit-pack if xpdr node
@@ -984,68 +855,54 @@ public class OpenRoadmInterface710 {
 
     // With SAPI and DAPI information
     public String createOpenRoadmOtnOducnInterface(String anodeId, String alogicalConnPoint,
-        String supportingOtucn, String znodeId, String zlogicalConnPoint)
-        throws OpenRoadmInterfaceException {
+            String supportingOtucn, String znodeId, String zlogicalConnPoint)
+            throws OpenRoadmInterfaceException {
         Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
-        Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
         if (portMapA == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    anodeId, alogicalConnPoint));
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
         }
         // On the Zside
+        Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
         if (portMapZ == null) {
             throw new OpenRoadmInterfaceException(
-                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
-                    znodeId, zlogicalConnPoint));
-
+                String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
         }
-        // Create ODUcn object
-        // Start with OPU object
-        // OPU payload
-        OpuBuilder opuBuilder = new OpuBuilder()
-            .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
-            .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
-
-        // Create an ODUCn object
-        OduBuilder oduBuilder = new OduBuilder()
-            .setRate(ODUCn.VALUE)
-            .setOduFunction(ODUTTP.VALUE)
-            .setMonitoringMode(MonitoringMode.Terminated)
-            .setTimActEnabled(false)
-            .setTimDetectMode(TimDetectMode.Disabled)
-            .setDegmIntervals(Uint8.valueOf(2))
-            .setDegthrPercentage(Uint16.valueOf(100))
-            .setOpu(opuBuilder.build())
-            .setTxSapi(portMapA.getLcpHashVal())
-            .setTxDapi(portMapZ.getLcpHashVal())
-            .setExpectedSapi(portMapZ.getLcpHashVal())
-            .setExpectedDapi(portMapZ.getLcpHashVal());
-
         // Set the ODUCn rate from OTUCn interface naming convention
         String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
-
         // check if the oducnrate is a valid value and if it is invalid, then throw error
         if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
-            throw new OpenRoadmInterfaceException(
-                String.format(RATE_EXCEPTION_MESSAGE));
-        }
-
-        oduBuilder.setOducnNRate(Uint16.valueOf(oducnrate));
-
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE,
-            alogicalConnPoint + ODUC + oducnrate);
-
-        // Create a list
-        Set<String> listSupportingOtucnInterface = new HashSet<>();
-        listSupportingOtucnInterface.add(supportingOtucn);
-
-        oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
-        org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder oduIf1Builder =
-            new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder();
-
-        oduInterfaceBuilder.addAugmentation(oduIf1Builder.setOdu(oduBuilder.build()).build());
-
+            throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+        }
+
+        InterfaceBuilder oduInterfaceBuilder =
+            createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint + ODUC + oducnrate)
+                .setSupportingInterfaceList(new HashSet<>(Set.of(supportingOtucn)))
+                .addAugmentation(
+                    new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.Interface1Builder()
+                        .setOdu(
+                            // Create an ODUCn object
+                            new OduBuilder()
+                                .setRate(ODUCn.VALUE)
+                                .setOducnNRate(Uint16.valueOf(oducnrate))
+                                .setOduFunction(ODUTTP.VALUE)
+                                .setMonitoringMode(MonitoringMode.Terminated)
+                                .setTimActEnabled(false)
+                                .setTimDetectMode(TimDetectMode.Disabled)
+                                .setDegmIntervals(Uint8.valueOf(2))
+                                .setDegthrPercentage(Uint16.valueOf(100))
+                                .setOpu(
+                                    // OPU payload
+                                    new OpuBuilder()
+                                        .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                        .setPayloadType(PayloadTypeDef.getDefaultInstance("22"))
+                                        .build())
+                                .setTxSapi(portMapA.getLcpHashVal())
+                                .setTxDapi(portMapZ.getLcpHashVal())
+                                .setExpectedSapi(portMapZ.getLcpHashVal())
+                                .setExpectedDapi(portMapZ.getLcpHashVal())
+                                .build())
+                        .build());
         // Post interface on the device
         openRoadmInterfaces.postInterface(anodeId, oduInterfaceBuilder);
         // Post the equipment-state change on the device circuit-pack if xpdr node
@@ -1062,8 +919,7 @@ public class OpenRoadmInterface710 {
         return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, logicalConnectionPoint, spectralSlotName);
     }
 
-    private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, InterfaceType type,
-            String key) {
+    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   ")
             .setCircuitId("   TBD    ")
@@ -1075,12 +931,7 @@ public class OpenRoadmInterface710 {
             .withKey(new InterfaceKey(key));
     }
 
-    @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
-        value = "UPM_UNCALLED_PRIVATE_METHOD",
-        justification = "call in call() method")
     private int getServiceRate(ModulationFormat modulationFormat, SpectrumInformation spectrumInformation) {
-
-        int rate;
         switch (modulationFormat) {
             case DpQpsk:
             case DpQam16:
@@ -1104,17 +955,15 @@ public class OpenRoadmInterface710 {
                     // Based on roll-of-factor of 0.2, 87.5 - 12.5 = 75GHz translates to 63.1 GBaud
                     LOG.info("The baud-rate is 63.1 GBaud");
                 }
-                rate = rateMap.get(modulationFormat);
-                break;
+                int rate = rateMap.get(modulationFormat);
+                LOG.info("Given modulation format {} rate is {}", modulationFormat, rate);
+                return rate;
             case DpQam8:
-                rate = 300;
-                break;
+                LOG.info("Given modulation format DpQam8 rate is 300");
+                return 300;
             default:
-                LOG.error("Modulation format is required to select the rate");
+                LOG.error(RATE_EXCEPTION_MESSAGE + " for modulation format {}", modulationFormat);
                 return 0;
         }
-        LOG.info("Given modulation format {} rate is {}", modulationFormat, rate);
-        return rate;
     }
-
 }