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;
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;
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;
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(
// 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();
// 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) {
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<>();
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());
maintLoopbackBuilder.setEnabled(false);
OtuBuilder otuBuilder = new OtuBuilder()
.setRate(OTUCn.class)
- .setOtucnNRate(Uint16.valueOf(4))
.setTimActEnabled(false)
.setTimDetectMode(TimDetectMode.Disabled)
.setDegmIntervals(Uint8.valueOf(2))
.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<>();
.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();
// Create an ODUC4 object
OduBuilder oduBuilder = new OduBuilder()
.setRate(ODUCn.class)
- .setOducnNRate(Uint16.valueOf(4))
.setOduFunction(ODUTTP.class)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.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<>();
// Create an ODUC4 object
OduBuilder oduBuilder = new OduBuilder()
.setRate(ODUCn.class)
- .setOducnNRate(Uint16.valueOf(4))
.setOduFunction(ODUTTP.class)
.setMonitoringMode(MonitoringMode.Terminated)
.setTimActEnabled(false)
.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<>();
// 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);
.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)
.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<>();
// 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);
.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<>();
.setExpectedSapi(portMapZ.getLcpHashVal())
.setExpectedDapi(portMapA.getLcpHashVal())
.setOpu(opuBuilder.build())
- .setMaintTestsignal(maintTestsignal.build())
.setParentOduAllocation(parentOduAllocationBuilder.build());
InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMapA, OtnOdu.class,
// 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,
.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;
+ }
+
}
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);
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:
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);
}
}
}
- 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()
.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());