Device renderer support for intermediate rates 04/99304/14
authorBalagangadhar Bathula <bb4341@att.com>
Fri, 28 Jan 2022 15:43:39 +0000 (10:43 -0500)
committerBalagangadhar Bathula <bb4341@att.com>
Fri, 28 Jan 2022 16:26:01 +0000 (11:26 -0500)
- Includes 200G (2x100G), 300G (3x100G) line rates
- OTUC2 (ODUC2), OTUC3 (ODUC3) support
- Create and delete interfaces.
- Modify functional-tests wherever necessary.

JIRA: TRNSPRTPCE-525

Signed-off-by: Balagangadhar Bathula <bb4341@att.com>
Change-Id: I7e45d129b3016037626e710c3de95907a1b00cab

12 files changed:
common/src/main/java/org/opendaylight/transportpce/common/StringConstants.java
common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java
common/src/main/java/org/opendaylight/transportpce/common/openroadminterfaces/OpenRoadmInterfacesImpl710.java
common/src/main/java/org/opendaylight/transportpce/common/service/ServiceTypes.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface710.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterfaceFactory.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmOtnInterface710.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/OtnDeviceRendererServiceImpl.java
tests/transportpce_tests/1.2.1/test05_olm.py
tests/transportpce_tests/2.2.1/test07_otn_renderer.py
tests/transportpce_tests/2.2.1/test09_olm.py

index 08aa2d2e281914da6e8990e2b6b0317dc1362d3a..539707d5132ce856f7476b0dd99c92d0806a4723 100644 (file)
@@ -39,8 +39,11 @@ public final class StringConstants {
     public static final String SERVICE_TYPE_1GE = "1GE";
 
     public static final String SERVICE_TYPE_ODU4 = "ODU4";
+    public static final String SERVICE_TYPE_ODUC2 = "ODUC2";
+    public static final String SERVICE_TYPE_ODUC3 = "ODUC3";
     public static final String SERVICE_TYPE_ODUC4 = "ODUC4";
 
+
     private StringConstants() {
         // hiding the default constructor
     }
index 8bdc8d12eee4c346ad00004473d870ba1bc87e1c..c6fc82c0e46aaf1b6110b7b156a448b38ca8c43b 100644 (file)
@@ -970,7 +970,7 @@ public class PortMappingVersion710 {
             }
             if ((interfaceType.equals(OtnOtu.class))
                 && (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
-                .equals("OTUC4"))) {
+                .contains("OTUC"))) {
                 mpBldr.setSupportingOtucn(interfaces.getInterfaceName());
             }
             if (interfaceType.equals(OtnOdu.class)
@@ -980,7 +980,7 @@ public class PortMappingVersion710 {
             }
             if ((interfaceType.equals(OtnOdu.class))
                 && (interfaceName.substring(interfaceName.lastIndexOf("-") + 1)
-                .equals("ODUC4"))) {
+                .contains("ODUC"))) {
                 mpBldr.setSupportingOducn(interfaces.getInterfaceName());
             }
         }
index 2d0ec82726cf01baf3f878179833f0009d2ecd27..35fd0963fc5177efb2607334ea205a3954d43a3e 100644 (file)
@@ -119,9 +119,20 @@ public class OpenRoadmInterfacesImpl710 {
         }
         if (intf2DeleteOpt.isPresent()) {
             Interface intf2Delete = intf2DeleteOpt.get();
-            // State admin state to out of service
-            InterfaceBuilder ifBuilder = new InterfaceBuilder(intf2Delete);
-            ifBuilder.setAdministrativeState(AdminStates.OutOfService);
+            // set the name and set the type. Having these two lines will post the interface with just
+            // name, type and admin-state, without all the default values such as maint-testsignal
+            //  delete the interfaces successfully
+            // just build a new Interface builder without the arguments for inter2Delete
+            InterfaceBuilder ifBuilder = new InterfaceBuilder()
+                .setAdministrativeState(AdminStates.OutOfService)
+                // Though these could be redundant, but 'when' statements are causing problem,
+                // when deleting the interfaces trying to be deleted
+                .setName(intf2Delete.getName())
+                .setType(intf2Delete.getType())
+                // CP name and the ports are needed, since the post interface is validated
+                .setSupportingCircuitPackName(intf2Delete.getSupportingCircuitPackName())
+                .setSupportingPort(intf2Delete.getSupportingPort());
+
             // post interface with updated admin state
             try {
                 postInterface(nodeId, ifBuilder);
index bdad027878c0ba96a93d392756972a0bf7941a5b..90e8887853ad82320fabee6ac6a3edfad4f66762 100644 (file)
@@ -65,6 +65,8 @@ public final class ServiceTypes {
                     Uint32.valueOf(400), StringConstants.SERVICE_TYPE_OTUC4),
             "ODU", Map.of(
                     Uint32.valueOf(100), StringConstants.SERVICE_TYPE_ODU4,
+                    Uint32.valueOf(200), StringConstants.SERVICE_TYPE_ODUC2,
+                    Uint32.valueOf(300), StringConstants.SERVICE_TYPE_ODUC3,
                     Uint32.valueOf(400), StringConstants.SERVICE_TYPE_ODUC4));
 
         if (!otnMap.containsKey(serviceFormat)) {
index cd72a036fb08ea37d42d5677cceb72b1a46eac4d..1505752a989d24550cd63adfcd4543f0417c3150 100644 (file)
@@ -27,10 +27,14 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.attributes.rev2003
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.attributes.rev200327.parent.odu.allocation.ParentOduAllocationBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.attributes.rev200327.parent.odu.allocation.parent.odu.allocation.trib.slots.choice.OpucnBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev191129.PowerDBm;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.Foic24;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.Foic36;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.Foic48;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.FrequencyTHz;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.ModulationFormat;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.ProvisionModeType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.R200GOtsi;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.R300GOtsi;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.R400GOtsi;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev200529.Ofec;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev200529.Rsfec;
@@ -46,8 +50,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev191129.OtnO
 import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev191129.Otsi;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev191129.OtsiGroup;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.loopback.rev191129.maint.loopback.MaintLoopbackBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev200529.maint.testsignal.MaintTestsignal.TestPattern;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.maintenance.testsignal.rev200529.maint.testsignal.MaintTestsignalBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.tributary.signal.interfaces.rev200529.otsi.attributes.FlexoBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.tributary.signal.interfaces.rev200529.otsi.container.OtsiBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODUCn;
@@ -66,15 +68,27 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.otsi.group.interfaces.rev
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint8;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class OpenRoadmInterface710 {
     private static final String MAPPING_ERROR_EXCEPTION_MESSAGE =
         "Unable to get mapping from PortMapping for node % and logical connection port %s";
-    private static final String ODUC4 = "-ODUC4";
+    private static final String MODULATION_FMT_EXCEPTION_MESSAGE =
+        "Unable to get the modulation format";
+    private static final String RATE_EXCEPTION_MESSAGE =
+        "Unable to get the rate";
+    private static final String ODUC = "-ODUC";
+    private static final List<String> SUPPORTED_ODUCN_RATES = new ArrayList<>() {
+        {
+            add("2");
+            add("3");
+            add("4");
+        }
+    };
     private final PortMapping portMapping;
     private final OpenRoadmInterfaces openRoadmInterfaces;
-
+    private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterface710.class);
 
     public OpenRoadmInterface710(PortMapping portMapping, OpenRoadmInterfaces openRoadmInterfaces) {
         this.portMapping = portMapping;
@@ -113,28 +127,67 @@ public class OpenRoadmInterface710 {
     public String createOpenRoadmOtsiInterface(String nodeId, String logicalConnPoint,
             SpectrumInformation spectrumInformation)
             throws OpenRoadmInterfaceException {
-        // TODO : Check this method
-        ModulationFormat modulationFormat = ModulationFormat.DpQam16;
+
+        ModulationFormat modulationFormat;
         Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
             .forName(spectrumInformation.getModulationFormat());
         if (optionalModulationFormat.isPresent()) {
             modulationFormat =  optionalModulationFormat.get();
+        } else {
+            throw new OpenRoadmInterfaceException(
+                String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
         }
-        // Set the Flexo values
-        FlexoBuilder flexoBuilder = new FlexoBuilder()
-            .setFoicType(Foic48.class)
-            .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
-                Uint8.valueOf(3), Uint8.valueOf(4))));
 
         // OTSI interface specific data
         OtsiBuilder  otsiBuilder = new OtsiBuilder()
             .setFrequency(new FrequencyTHz(spectrumInformation.getCenterFrequency()))
             .setTransmitPower(new PowerDBm(new BigDecimal("-5")))
-            .setModulationFormat(modulationFormat)
-            .setOtsiRate(R400GOtsi.class)
             .setProvisionMode(ProvisionModeType.Explicit)
             .setFec(Ofec.class)
-            .setFlexo(flexoBuilder.build());
+            .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);
+        switch (serviceRate) {
+            case 200:
+                LOG.info("Given modulation format is {} and thus rate is 200G", modulationFormat);
+                flexoBuilder.setFoicType(Foic24.class)
+                    .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2))));
+                otsiBuilder.setOtsiRate(R200GOtsi.class)
+                    .setFlexo(flexoBuilder.build());
+                break;
+            case 300:
+                LOG.info("Given modulation format is {} and thus rate is 300G", modulationFormat);
+                flexoBuilder.setFoicType(Foic36.class)
+                    .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
+                        Uint8.valueOf(3))));
+                otsiBuilder.setOtsiRate(R300GOtsi.class)
+                    .setFlexo(flexoBuilder.build());
+                break;
+            case 400:
+                // Default baud-rate is 63.1 Gbaud
+                LOG.info("Given modulation format is {} and thus rate is 400G", modulationFormat);
+                flexoBuilder.setFoicType(Foic48.class)
+                    .setIid(new ArrayList<>(Arrays.asList(Uint8.valueOf(1), Uint8.valueOf(2),
+                        Uint8.valueOf(3), Uint8.valueOf(4))));
+                otsiBuilder.setModulationFormat(modulationFormat)
+                    .setOtsiRate(R400GOtsi.class)
+                    .setFlexo(flexoBuilder.build());
+                break;
+            default:
+                LOG.error("Rate {} is unsupported", serviceRate);
+                rateNotFound = true;
+                break;
+        }
+
+        if (rateNotFound) {
+            throw new OpenRoadmInterfaceException(
+                String.format(RATE_EXCEPTION_MESSAGE));
+        }
+
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(
@@ -143,10 +196,9 @@ public class OpenRoadmInterface710 {
         // Create generic interface
         InterfaceBuilder otsiInterfaceBldr = createGenericInterfaceBuilder(portMap, Otsi.class,
             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 =
+            .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();
 
@@ -166,7 +218,7 @@ public class OpenRoadmInterface710 {
     // This is a transponder use-case where the supporting port is just one, but YANG model
     // requires supporting port to be list
     public String createOpenRoadmOtsiGroupInterface(String nodeId, String logicalConnPoint,
-            String supportingOtsiInterface)
+            String supportingOtsiInterface, SpectrumInformation spectrumInformation)
             throws OpenRoadmInterfaceException {
         Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
@@ -174,14 +226,44 @@ public class OpenRoadmInterface710 {
                 String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
                     nodeId, logicalConnPoint));
         }
+        // Check the modulation format
+        ModulationFormat modulationFormat;
+        Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
+            .forName(spectrumInformation.getModulationFormat());
+        if (optionalModulationFormat.isPresent()) {
+            modulationFormat =  optionalModulationFormat.get();
+        } else {
+            throw new OpenRoadmInterfaceException(
+                String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
+        }
+        int serviceRate = getServiceRate(modulationFormat);
         // Create an OTSI group object
         OtsiGroupBuilder otsiGroupBuilder = new OtsiGroupBuilder()
-            .setGroupId(Uint32.valueOf(1))
-            .setGroupRate(R400GOtsi.class);
+            .setGroupId(Uint32.valueOf(1));
+        boolean rateNotFound = false;
+        switch (serviceRate) {
+            case 200:
+                otsiGroupBuilder.setGroupRate(R200GOtsi.class);
+                break;
+            case 300:
+                otsiGroupBuilder.setGroupRate(R300GOtsi.class);
+                break;
+            case 400:
+                otsiGroupBuilder.setGroupRate(R400GOtsi.class);
+                break;
+            default:
+                LOG.error("Rate {} is not supported", serviceRate);
+                rateNotFound = true;
+                break;
+        }
+        if (rateNotFound) {
+            throw new OpenRoadmInterfaceException(
+                String.format(RATE_EXCEPTION_MESSAGE));
+        }
 
         // Create generic interface
         InterfaceBuilder otsiGroupInterfaceBldr = createGenericInterfaceBuilder(portMap, OtsiGroup.class,
-            logicalConnPoint + String.join("-","", "OTSIGROUP", "400G"));
+            logicalConnPoint + String.join("-", "", "OTSIGROUP", serviceRate + "G"));
 
         // Create a list
         List<String> listSupportingOtsiInterface = new ArrayList<>();
@@ -189,7 +271,7 @@ public class OpenRoadmInterface710 {
         otsiGroupInterfaceBldr.setSupportingInterfaceList(listSupportingOtsiInterface);
 
         org.opendaylight.yang.gen.v1.http.org.openroadm.otsi.group.interfaces.rev200529.Interface1Builder
-                otsiGroupIf1Builder =
+            otsiGroupIf1Builder =
             new org.opendaylight.yang.gen.v1.http.org.openroadm.otsi.group.interfaces.rev200529.Interface1Builder();
         otsiGroupInterfaceBldr.addAugmentation(otsiGroupIf1Builder.setOtsiGroup(otsiGroupBuilder.build()).build());
 
@@ -218,7 +300,6 @@ public class OpenRoadmInterface710 {
         maintLoopbackBuilder.setEnabled(false);
         OtuBuilder otuBuilder = new OtuBuilder()
             .setRate(OTUCn.class)
-            .setOtucnNRate(Uint16.valueOf(4))
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
             .setDegmIntervals(Uint8.valueOf(2))
@@ -236,9 +317,36 @@ public class OpenRoadmInterface710 {
                 .setExpectedSapi(apiInfoZ.getExpectedSapi())
                 .setExpectedDapi(apiInfoZ.getExpectedDapi());
         }
+        // Set the OTUCn rate for various rates
+        String rate = supportingOtsiGroupInterface.substring(supportingOtsiGroupInterface.lastIndexOf('-') + 1);
+
+        String otucnrate = null;
+        boolean rateNotFound = false;
+        switch (rate) {
+            case "200G":
+                otuBuilder.setOtucnNRate(Uint16.valueOf(2));
+                otucnrate = "2";
+                break;
+            case "300G":
+                otuBuilder.setOtucnNRate(Uint16.valueOf(3));
+                otucnrate = "3";
+                break;
+            case "400G":
+                otuBuilder.setOtucnNRate(Uint16.valueOf(4));
+                otucnrate = "4";
+                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.class,
-            logicalConnPoint + "-OTUC4");
+            logicalConnPoint + "-OTUC" + otucnrate);
 
         // Create a list
         List<String> listSupportingOtsiGroupInterface = new ArrayList<>();
@@ -275,27 +383,42 @@ public class OpenRoadmInterface710 {
             .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
             .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
 
-        // Create an ODUC4 object
+        // Create an ODUCn object
         OduBuilder oduBuilder = new OduBuilder()
             .setRate(ODUCn.class)
-            .setOducnNRate(Uint16.valueOf(4))
             .setOduFunction(ODUTTP.class)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
             .setTimDetectMode(TimDetectMode.Disabled)
             .setDegmIntervals(Uint8.valueOf(2))
             .setDegthrPercentage(Uint16.valueOf(100))
+            .setOducnNRate(Uint16.valueOf(4))
             .setOpu(opuBuilder.build());
 
-        InterfaceBuilder oduInterfaceBuilder = createGenericInterfaceBuilder(mapping, OtnOdu.class,
-            logicalConnPoint + "-ODUC4");
-
         // Create a list
+        String supportingOtucn;
         List<String> listSupportingOtucnInterface = new ArrayList<>();
         if (mapping.getSupportingOtucn() != null) {
             listSupportingOtucnInterface.add(mapping.getSupportingOtucn());
+            supportingOtucn = mapping.getSupportingOtucn();
+        } else {
+            throw new OpenRoadmInterfaceException(
+                String.format("Missing supporting OTUCn interface on port-mapping"));
         }
 
+        // 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.class,
+            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();
@@ -341,7 +464,6 @@ public class OpenRoadmInterface710 {
         // Create an ODUC4 object
         OduBuilder oduBuilder = new OduBuilder()
             .setRate(ODUCn.class)
-            .setOducnNRate(Uint16.valueOf(4))
             .setOduFunction(ODUTTP.class)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
@@ -354,8 +476,19 @@ public class OpenRoadmInterface710 {
             .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.class,
-            alogicalConnPoint + ODUC4);
+            alogicalConnPoint + ODUC + oducnrate);
 
         // Create a list
         List<String> listSupportingOtucnInterface = new ArrayList<>();
@@ -397,7 +530,6 @@ public class OpenRoadmInterface710 {
         // Create an ODUC4 object
         OduBuilder oduBuilder = new OduBuilder()
             .setRate(ODUCn.class)
-            .setOducnNRate(Uint16.valueOf(4))
             .setOduFunction(ODUTTP.class)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
@@ -406,8 +538,19 @@ public class OpenRoadmInterface710 {
             .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.class,
-            logicalConnPoint + ODUC4);
+            logicalConnPoint + ODUC + oducnrate);
 
         // Create a list
         List<String> listSupportingOtucnInterface = new ArrayList<>();
@@ -421,7 +564,6 @@ public class OpenRoadmInterface710 {
 
         // Post interface on the device
         openRoadmInterfaces.postInterface(nodeId, oduInterfaceBuilder);
-
         // 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);
@@ -457,10 +599,9 @@ public class OpenRoadmInterface710 {
             .setExpPayloadType(PayloadTypeDef.getDefaultInstance("22"))
             .setPayloadType(PayloadTypeDef.getDefaultInstance("22"));
 
-        // Create an ODUC4 object
+        // Create an ODUCn object
         OduBuilder oduBuilder = new OduBuilder()
             .setRate(ODUCn.class)
-            .setOducnNRate(Uint16.valueOf(4))
             .setOduFunction(ODUTTP.class)
             .setMonitoringMode(MonitoringMode.Terminated)
             .setTimActEnabled(false)
@@ -473,8 +614,19 @@ public class OpenRoadmInterface710 {
             .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.class,
-            alogicalConnPoint + ODUC4);
+            alogicalConnPoint + ODUC + oducnrate);
 
         // Create a list
         List<String> listSupportingOtucnInterface = new ArrayList<>();
@@ -488,7 +640,6 @@ public class OpenRoadmInterface710 {
 
         // 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);
@@ -585,12 +736,6 @@ public class OpenRoadmInterface710 {
             .setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
             .setPayloadType(PayloadTypeDef.getDefaultInstance("32"));
 
-        // Maint test signal
-        MaintTestsignalBuilder maintTestsignal = new MaintTestsignalBuilder()
-            // PRBS value should be PRBS31 if enabled is true
-            .setTestPattern(TestPattern.PRBS31)
-            .setEnabled(false);
-
         // Parent Odu-allocation
         // Set the trib-slot array
         List<OpucnTribSlotDef> tribslots = new ArrayList<>();
@@ -616,7 +761,6 @@ public class OpenRoadmInterface710 {
             .setExpectedSapi(portMapZ.getLcpHashVal())
             .setExpectedDapi(portMapA.getLcpHashVal())
             .setOpu(opuBuilder.build())
-            .setMaintTestsignal(maintTestsignal.build())
             .setParentOduAllocation(parentOduAllocationBuilder.build());
 
         InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
@@ -647,7 +791,7 @@ public class OpenRoadmInterface710 {
 
     // This creates the name of the interface with slot numbers at the end
     public String createOpenRoadmOtsiInterfaceName(String logicalConnectionPoint, String spectralSlotName) {
-        return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotName);
+        return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, logicalConnectionPoint, spectralSlotName);
     }
 
     private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
@@ -663,4 +807,27 @@ 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) {
+
+        switch (modulationFormat) {
+            case DpQpsk:
+                LOG.info("Given modulation format is {} and thus rate is 200G", modulationFormat);
+                return 200;
+            case DpQam8:
+                LOG.info("Given modulation format is {} and thus rate is 300G", modulationFormat);
+                return 300;
+            case DpQam16:
+                // Based on roll-of-factor of 0.5, 87.5 - 12.5 = 75GHz translates to 63.1 GBaud
+                LOG.info("Given modulation format is {} and thus rate is 400G", modulationFormat);
+                return 400;
+            default:
+                LOG.error("Modulation format is required to select the rate");
+                break;
+        }
+        return 0;
+    }
+
 }
index 70aa3ca42e269438a0fb741498c4d77f9810085e..61d3be91e7b26f12f0e52182e7b31f94eb030408 100644 (file)
@@ -98,10 +98,11 @@ public class OpenRoadmInterfaceFactory {
             case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
                 // In the case of 710 device, we logically combine the OTSi and OTSiGroup interface and represent
                 // as OCh
+                //TODO: 7.1 device can also have 100G transponder
                 String interfaceOtsiName = openRoadmInterface710.createOpenRoadmOtsiInterface(nodeId, logicalConnPoint,
                     spectrumInformation);
                 return openRoadmInterface710.createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint,
-                    interfaceOtsiName);
+                    interfaceOtsiName, spectrumInformation);
             default:
                 return null;
         }
@@ -365,7 +366,7 @@ public class OpenRoadmInterfaceFactory {
         }
     }
 
-    public String createOpenRoadmOtnOduc4Interface(String anodeId, String alogicalConnPoint,
+    public String createOpenRoadmOtnOducnInterface(String anodeId, String alogicalConnPoint,
             String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
             throws OpenRoadmInterfaceException {
         switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
index 2d0c4e56c78d9e80a93d8cbe3d6082c8a4cc18bb..92ccc8ba53fbf4ce76d10ca7eeb2800dc359d7a7 100644 (file)
@@ -99,6 +99,8 @@ public class OpenRoadmOtnInterface710 {
         String supportingInterface = null;
         if (isNetworkPort) {
             supportingInterface = portMap.getSupportingOducn();
+            // TODO: remove this log
+            LOG.info("ODUCn supporting interface on port mapping {}", supportingInterface);
         } else {
             supportingInterface = logicalConnPoint + "-ETHERNET-100G";
         }
index 4bef899ecf3a3515ed341c7595bf7c2c16646b32..cb39a30a4b140b7a81017d2056a1e9c4ef1dd9f1 100644 (file)
@@ -256,7 +256,7 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
         forkJoinPool.shutdown();
 
         if (success.get()) {
-            results.add("Roadm-connection successfully created for nodes: " + String.join(", ", nodesProvisioned));
+            results.add("Interfaces created successfully for nodes: " + String.join(", ", nodesProvisioned));
         }
         // setting topology in the service list data store
         try {
@@ -290,7 +290,7 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
     @Override
     public ServicePathOutput deleteServicePath(ServicePathInput input) {
         if (!alarmSuppressionNodeRegistration(input)) {
-            LOG.warn("Alarm suppresion node registraion failed!!!!");
+            LOG.warn("Alarm suppression node registration failed!!!!");
         }
         List<Nodes> nodes = input.getNodes();
         AtomicBoolean success = new AtomicBoolean(true);
@@ -388,13 +388,17 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
 
         OpenroadmNodeVersion nodeOpenRoadmVersion =
                 this.portMapping.getNode(nodeId).getNodeInfo().getOpenroadmVersion();
+
         List<String> interfacesToDelete = new LinkedList<>();
         Map<String, List<String>> suffixListMap =
             nodeOpenRoadmVersion.equals(OpenroadmNodeVersion._71)
                 ? Map.of(
-                    "ODU",  List.of("ODUC4","ODUFLEX"),
-                    // -400G added due to the change in naming convention
-                    "other", List.of("OTUC4", "OTSIGROUP-400G", spectralSlotName))
+                    // We don't need ODUC2, ODUC3 here, since they are handled in OTN service-path
+                    "ODU",  List.of("ODUC4", "ODUFLEX"),
+                    // Add intermediate OTUCn rates (OTUC2, OTUC3)
+                    "other", List.of("OTUC2", "OTUC3", "OTUC4",
+                    "OTSIGROUP-400G", "OTSIGROUP-300G",  "OTSIGROUP-200G",
+                    spectralSlotName))
                 : Map.of(
                     "ODU", List.of("ODU", "ODU4"),
                     "other", List.of("OTU", spectralSlotName));
@@ -418,8 +422,22 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
                         suffixListMap.get("ODU")),
                     e);
             }
-            for (String suffix : suffixListMap.get("other")) {
-                interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix));
+            try {
+                for (String suffix : suffixListMap.get("other")) {
+                    if (this.openRoadmInterfaces.getInterface(
+                        nodeId, String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix)).isPresent()) {
+                        LOG.info("Deleting the interface {}",
+                            String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix));
+                        interfacesToDelete.add(String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, destTp, suffix));
+                    }
+                }
+            }
+            catch (OpenRoadmInterfaceException e) {
+                LOG.error("impossible to get one of the interfaces {}",
+                    destTp + GridConstant.NAME_PARAMETERS_SEPARATOR + String.join(
+                        " or " + destTp + GridConstant.NAME_PARAMETERS_SEPARATOR,
+                        suffixListMap.get("ODU")),
+                    e);
             }
         }
         if (srcTp.contains(StringConstants.NETWORK_TOKEN)) {
index 0bb56cca7470a8ba9969631a00b10911a1ea132a..e0930138f556ff7f558e3787859e27bea9e49d7d 100644 (file)
@@ -93,8 +93,12 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
                 case StringConstants.SERVICE_TYPE_ODU4:
                     createHighOrderInterfaces(input, nodeInterfaces, otnLinkTps);
                     break;
+                // For all the intermediate rates, device renderer is generalized as
+                // ODUCnTTPinterface method
+                case StringConstants.SERVICE_TYPE_ODUC2:
+                case StringConstants.SERVICE_TYPE_ODUC3:
                 case StringConstants.SERVICE_TYPE_ODUC4:
-                    createOduc4TtpInterface(input, nodeInterfaces, otnLinkTps);
+                    createOducnTtpInterface(input, nodeInterfaces, otnLinkTps);
                     break;
                 case StringConstants.SERVICE_TYPE_100GE_S:
                     LOG.info("Calling Node interface for service-type {}", serviceType);
@@ -206,18 +210,21 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
                         connectionNumber = getConnectionNumber(null, node, networkTp, "ODU4");
                     }
                     break;
+                case StringConstants.SERVICE_TYPE_ODUC2:
+                case StringConstants.SERVICE_TYPE_ODUC3:
                 case StringConstants.SERVICE_TYPE_ODUC4:
                     if (node.getClientTp() == null && node.getNetwork2Tp() == null) {
-                        interfacesToDelete.add(networkTp + "-ODUC4");
+                        // Service-type can be ODUC2, ODUC3, ODUC4
+                        interfacesToDelete.add(networkTp + "-" + serviceType);
                         otnLinkTps.add(new LinkTpBuilder()
                             .setNodeId(nodeId)
                             .setTpId(networkTp)
                             .build());
                     }
                     if (node.getClientTp() == null && node.getNetwork2Tp() != null) {
-                        interfacesToDelete.add(networkTp + "-ODUC4");
-                        interfacesToDelete.add(node.getNetwork2Tp() + "-ODUC4");
-                        connectionNumber = getConnectionNumber(null, node, networkTp, "ODUC4");
+                        interfacesToDelete.add(networkTp + "-" + serviceType);
+                        interfacesToDelete.add(node.getNetwork2Tp() + "-" + serviceType);
+                        connectionNumber = getConnectionNumber(null, node, networkTp, serviceType);
                     }
                     break;
                 case StringConstants.SERVICE_TYPE_10GE:
@@ -250,7 +257,8 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
                     if (supportedInterface == null) {
                         continue;
                     }
-                    if ((input.getServiceRate().intValue() == 100 && !supportedInterface.contains("ODUC4"))
+                    // Here ODUC can be ODUC2, ODUC3, ODUC4
+                    if ((input.getServiceRate().intValue() == 100 && !supportedInterface.contains("ODUC"))
                         || (input.getServiceRate().intValue() != 100 && !supportedInterface.contains("ODU4"))) {
                         interfacesToDelete.add(supportedInterface);
                     }
@@ -505,15 +513,39 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
         }
     }
 
-    private void createOduc4TtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
+    private void createOducnTtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
         CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
         if (input.getNodes() == null) {
             return;
         }
-        LOG.info("Creation of ODUC4 TTP interface in OTN service path {}", input);
+        if (input.getServiceRate() == null) {
+            LOG.error("Missing service rate for ODUCn interface");
+            return;
+        }
+        LOG.info("Creation of ODUCn TTP interface in OTN service path {}", input);
         for (int i = 0; i < input.getNodes().size(); i++) {
             Nodes node = input.getNodes().get(i);
-            String supportingOtuInterface = node.getNetworkTp() + "-OTUC4";
+            // Based on the service rate, we will know if it is a OTUC4, OTUC3 or OTUC2
+            String supportingOtuInterface = node.getNetworkTp();
+            boolean serviceRateNotSupp = false;
+
+            switch (input.getServiceRate().intValue()) {
+                case 200:
+                    supportingOtuInterface += "-OTUC2";
+                    break;
+                case 300:
+                    supportingOtuInterface += "-OTUC3";
+                    break;
+                case 400:
+                    supportingOtuInterface += "-OTUC4";
+                    break;
+                default:
+                    serviceRateNotSupp = true;
+                    break;
+            }
+            if (serviceRateNotSupp) {
+                LOG.error("Service rate {} is not supported", input.getServiceRate());
+            }
 
             Nodes tgtNode =
                 i + 1 == input.getNodes().size()
@@ -525,8 +557,8 @@ public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
                     .withKey(new NodeInterfaceKey(node.getNodeId()))
                     .setNodeId(node.getNodeId())
                     .setOduInterfaceId(List.of(
-                        // though this is odu, actually it has ODUC4 interfaces
-                        openRoadmInterfaceFactory.createOpenRoadmOtnOduc4Interface(node.getNodeId(),
+                        // though this is odu, actually it has ODUCn interfaces
+                        openRoadmInterfaceFactory.createOpenRoadmOtnOducnInterface(node.getNodeId(),
                             node.getNetworkTp(), supportingOtuInterface, tgtNode.getNodeId(), tgtNode.getNetworkTp())))
                     .build());
             linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
index f9e5d1b6fa610f06f10fe957f8905c9a0d57be20..27d8ba69cb53dba99d03dc01819d0bb2ee7f5df7 100644 (file)
@@ -235,7 +235,7 @@ class TransportOlmTesting(unittest.TestCase):
                                                    768)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
+        self.assertIn('Interfaces created successfully for nodes', res["output"]["result"])
         # time.sleep(40)
         time.sleep(10)
 
@@ -253,7 +253,7 @@ class TransportOlmTesting(unittest.TestCase):
                                                    768)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
+        self.assertIn('Interfaces created successfully for nodes', res["output"]["result"])
         # time.sleep(40)
         time.sleep(10)
 
@@ -497,7 +497,7 @@ class TransportOlmTesting(unittest.TestCase):
                                                    760)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
+        self.assertIn('Interfaces created successfully for nodes', res["output"]["result"])
         # time.sleep(40)
         time.sleep(10)
 
index 7cf133da3c63522005fd82242e5a720ef8b46a0a..864972fb701a36023d41e594c4652a5e9db63959 100644 (file)
@@ -99,7 +99,7 @@ class TransportPCEtesting(unittest.TestCase):
         time.sleep(3)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertIn('Roadm-connection successfully created for nodes: ', res["output"]["result"])
+        self.assertIn('Interfaces created successfully for nodes: ', res["output"]["result"])
         self.assertTrue(res["output"]["success"])
         self.assertIn(
             {'node-id': 'SPDR-SA1',
index 63ced0f742a591c969d35798ae5ebf0662e873c5..62e352cb0f703796c8013e303bdcd239577431d3 100644 (file)
@@ -236,7 +236,7 @@ class TransportOlmTesting(unittest.TestCase):
                                                    768)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
+        self.assertIn('Interfaces created successfully for nodes', res["output"]["result"])
         # time.sleep(40)
         time.sleep(10)
 
@@ -254,7 +254,7 @@ class TransportOlmTesting(unittest.TestCase):
                                                    768)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
+        self.assertIn('Interfaces created successfully for nodes', res["output"]["result"])
         # time.sleep(40)
         time.sleep(10)
 
@@ -485,7 +485,7 @@ class TransportOlmTesting(unittest.TestCase):
                                                    760)
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"])
+        self.assertIn('Interfaces created successfully for nodes', res["output"]["result"])
         # time.sleep(40)
         time.sleep(10)