From b39614911ce5dc431928dc84c4a42c806301d176 Mon Sep 17 00:00:00 2001 From: Balagangadhar Bathula Date: Fri, 28 Jan 2022 10:43:39 -0500 Subject: [PATCH] Device renderer support for intermediate rates - 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 Change-Id: I7e45d129b3016037626e710c3de95907a1b00cab --- .../transportpce/common/StringConstants.java | 3 + .../common/mapping/PortMappingVersion710.java | 4 +- .../OpenRoadmInterfacesImpl710.java | 17 +- .../common/service/ServiceTypes.java | 2 + .../OpenRoadmInterface710.java | 259 ++++++++++++++---- .../OpenRoadmInterfaceFactory.java | 5 +- .../OpenRoadmOtnInterface710.java | 2 + .../DeviceRendererServiceImpl.java | 32 ++- .../OtnDeviceRendererServiceImpl.java | 54 +++- tests/transportpce_tests/1.2.1/test05_olm.py | 6 +- .../2.2.1/test07_otn_renderer.py | 2 +- tests/transportpce_tests/2.2.1/test09_olm.py | 6 +- 12 files changed, 314 insertions(+), 78 deletions(-) diff --git a/common/src/main/java/org/opendaylight/transportpce/common/StringConstants.java b/common/src/main/java/org/opendaylight/transportpce/common/StringConstants.java index 08aa2d2e2..539707d51 100644 --- a/common/src/main/java/org/opendaylight/transportpce/common/StringConstants.java +++ b/common/src/main/java/org/opendaylight/transportpce/common/StringConstants.java @@ -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 } diff --git a/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java b/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java index 8bdc8d12e..c6fc82c0e 100644 --- a/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java +++ b/common/src/main/java/org/opendaylight/transportpce/common/mapping/PortMappingVersion710.java @@ -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()); } } diff --git a/common/src/main/java/org/opendaylight/transportpce/common/openroadminterfaces/OpenRoadmInterfacesImpl710.java b/common/src/main/java/org/opendaylight/transportpce/common/openroadminterfaces/OpenRoadmInterfacesImpl710.java index 2d0ec8272..35fd0963f 100644 --- a/common/src/main/java/org/opendaylight/transportpce/common/openroadminterfaces/OpenRoadmInterfacesImpl710.java +++ b/common/src/main/java/org/opendaylight/transportpce/common/openroadminterfaces/OpenRoadmInterfacesImpl710.java @@ -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); diff --git a/common/src/main/java/org/opendaylight/transportpce/common/service/ServiceTypes.java b/common/src/main/java/org/opendaylight/transportpce/common/service/ServiceTypes.java index bdad02787..90e888785 100644 --- a/common/src/main/java/org/opendaylight/transportpce/common/service/ServiceTypes.java +++ b/common/src/main/java/org/opendaylight/transportpce/common/service/ServiceTypes.java @@ -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)) { diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface710.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface710.java index cd72a036f..1505752a9 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface710.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterface710.java @@ -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 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 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 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 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 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 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 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 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 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 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 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; + } + } diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterfaceFactory.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterfaceFactory.java index 70aa3ca42..61d3be91e 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterfaceFactory.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterfaceFactory.java @@ -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)) { diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmOtnInterface710.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmOtnInterface710.java index 2d0c4e56c..92ccc8ba5 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmOtnInterface710.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmOtnInterface710.java @@ -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"; } diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java index 4bef899ec..cb39a30a4 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java @@ -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 = 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 interfacesToDelete = new LinkedList<>(); Map> 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)) { diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/OtnDeviceRendererServiceImpl.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/OtnDeviceRendererServiceImpl.java index 0bb56cca7..e0930138f 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/OtnDeviceRendererServiceImpl.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/OtnDeviceRendererServiceImpl.java @@ -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 nodeInterfaces, + private void createOducnTtpInterface(OtnServicePathInput input, List nodeInterfaces, CopyOnWriteArrayList 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()); diff --git a/tests/transportpce_tests/1.2.1/test05_olm.py b/tests/transportpce_tests/1.2.1/test05_olm.py index f9e5d1b6f..27d8ba69c 100644 --- a/tests/transportpce_tests/1.2.1/test05_olm.py +++ b/tests/transportpce_tests/1.2.1/test05_olm.py @@ -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) diff --git a/tests/transportpce_tests/2.2.1/test07_otn_renderer.py b/tests/transportpce_tests/2.2.1/test07_otn_renderer.py index 7cf133da3..864972fb7 100644 --- a/tests/transportpce_tests/2.2.1/test07_otn_renderer.py +++ b/tests/transportpce_tests/2.2.1/test07_otn_renderer.py @@ -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', diff --git a/tests/transportpce_tests/2.2.1/test09_olm.py b/tests/transportpce_tests/2.2.1/test09_olm.py index 63ced0f74..62e352cb0 100644 --- a/tests/transportpce_tests/2.2.1/test09_olm.py +++ b/tests/transportpce_tests/2.2.1/test09_olm.py @@ -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) -- 2.36.6