public class OpenRoadmInterface121 {
- private static final String MAPPING_MSG_ERROR =
- "Unable to get mapping from PortMapping for node % and logical connection port %s";
private final PortMapping portMapping;
private final OpenRoadmInterfaces openRoadmInterfaces;
private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterface121.class);
throws OpenRoadmInterfaceException {
Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
- throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
+ throw new OpenRoadmInterfaceException(
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
InterfaceBuilder ethInterfaceBldr =
createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE, logicalConnPoint + "-ETHERNET")
throws OpenRoadmInterfaceException {
Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
- throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
+ throw new OpenRoadmInterfaceException(
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Create generic interface
InterfaceBuilder otuInterfaceBldr =
createGenericInterfaceBuilder(portMap, OtnOtu.VALUE, logicalConnPoint + "-OTU")
.setSupportingInterface(supportOchInterface)
.addAugmentation(
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1Builder()
.setOtu(
// OTU interface specific data
throws OpenRoadmInterfaceException {
Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
- throw new OpenRoadmInterfaceException(String.format(MAPPING_MSG_ERROR, nodeId, logicalConnPoint));
+ throw new OpenRoadmInterfaceException(
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
InterfaceBuilder oduInterfaceBldr =
createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU");
}
oduInterfaceBldr.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev161014.Interface1Builder()
.setOdu(
// ODU interface specific data
throws OpenRoadmInterfaceException {
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
- throw new OpenRoadmInterfaceException(String.format(
- "Unable to get mapping from PortMapping for node %s and logical connection port %s",
- nodeId, logicalConnPoint));
+ throw new OpenRoadmInterfaceException(
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Create generic interface
InterfaceBuilder ochInterfaceBldr =
}
ochInterfaceBldr.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1Builder()
.setOch(
// OCH interface specific data
SpectrumInformation spectrumInformation) throws OpenRoadmInterfaceException {
Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
- throw new OpenRoadmInterfaceException(String.format(
- "Unable to get mapping from PortMapping for node %s and logical connection port %s",
- nodeId, logicalConnPoint));
+ throw new OpenRoadmInterfaceException(
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
ModulationFormat modulationFormat =
OchAttributes.ModulationFormat.forName(spectrumInformation.getModulationFormat());
spectrumInformation.getIdentifierFromParams(logicalConnPoint))
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014
.Interface1Builder()
.setOch(
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.OTU4;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.OduFunctionIdentity;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.PayloadTypeDef;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.OduAttributes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.OduAttributes.MonitoringMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.odu.container.OduBuilder;
public class OpenRoadmInterface221 {
- private static final String MAPPING_ERROR_EXCEPTION_MESSAGE =
- "Unable to get mapping from PortMapping for node % and logical connection port %s";
private final PortMapping portMapping;
private final OpenRoadmInterfaces openRoadmInterfaces;
private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterface221.class);
Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
if (mapping == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Post interface on the device
InterfaceBuilder ethInterfaceBldr =
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
List<String> interfacesCreated = new ArrayList<>();
String mcInterfaceCreated = "";
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
- // TODO : Check this method
LOG.info("MC interface Freq Start {} and Freq End {} and center-Freq {}",
spectrumInformation.getMinFrequency(), spectrumInformation.getMaxFrequency(),
spectrumInformation.getCenterFrequency());
public String createNMCInterface(String nodeId, String logicalConnPoint,
SpectrumInformation spectrumInformation, String mcName)
throws OpenRoadmInterfaceException {
- //TODO improve logs messages
- LOG.info("This is the central frequency {}", spectrumInformation.getCenterFrequency());
- LOG.info("This is the nmc width {}", spectrumInformation.getWidth());
- // TODO : Check this method
+ LOG.info("The central frequency is {} and the nmc width is {}",
+ spectrumInformation.getCenterFrequency(), spectrumInformation.getWidth());
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
- //TODO : Check this method
InterfaceBuilder nmcInterfaceBldr =
createGenericInterfaceBuilder(
portMap, NetworkMediaChannelConnectionTerminationPoint.VALUE,
public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint,
SpectrumInformation spectrumInformation)
throws OpenRoadmInterfaceException {
- // TODO : Check this method
ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
if (modulationFormat == null) {
modulationFormat = ModulationFormat.DpQpsk;
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format("Unable to get mapping from PortMapping for node %s and logical connection port %s",
- nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Create generic interface
InterfaceBuilder ochInterfaceBldr =
spectrumInformation.getIdentifierFromParams(logicalConnPoint))
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019
.Interface1Builder()
.setOch(
Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
if (mapping == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
InterfaceBuilder oduInterfaceBldr =
createGenericInterfaceBuilder(mapping, OtnOdu.VALUE, logicalConnPoint + "-ODU4");
if (mapping.getSupportingEthernet() != null) {
oduInterfaceBldr.setSupportingInterface(mapping.getSupportingEthernet());
}
- // ODU interface specific data
- OduFunctionIdentity oduFunction;
- MonitoringMode monitoringMode;
- Opu opu = null;
if (isCTP) {
- oduFunction = ODUCTP.VALUE;
- monitoringMode = MonitoringMode.Monitored;
- } else {
- oduFunction =
- // For TPDR it can be both CTP and TTP
- // For switch-ponder we still use TTP
- mapping.getXponderType() == XpdrNodeTypes.Tpdr
- ? ODUTTPCTP.VALUE
- : ODUTTP.VALUE;
- monitoringMode = MonitoringMode.Terminated;
- opu = new OpuBuilder()
- .setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
- .setExpPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
- .build();
+ // Create Interface1 type object required for adding as augmentation
+ oduInterfaceBldr.addAugmentation(
+ createOdu4HOInterface1(ODUCTP.VALUE, MonitoringMode.Monitored, null, apiInfoA, apiInfoZ));
+ // Post interface on the device
+ openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
+ return oduInterfaceBldr.getName();
}
+ // Create Interface1 type object required for adding as augmentation
+ oduInterfaceBldr.addAugmentation(
+ createOdu4HOInterface1(
+ // For TPDR it can be both CTP and TTP - For switch-ponder we still use TTP
+ mapping.getXponderType() == XpdrNodeTypes.Tpdr ? ODUTTPCTP.VALUE : ODUTTP.VALUE,
+ MonitoringMode.Terminated,
+ new OpuBuilder()
+ .setPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance(payloadType))
+ .build(),
+ apiInfoA, apiInfoZ));
+ // Post interface on the device
+ openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
+ LOG.info("{}-{} updating mapping with interface {}", nodeId, logicalConnPoint, oduInterfaceBldr.getName());
+ this.portMapping.updateMapping(nodeId, mapping);
+ return oduInterfaceBldr.getName();
+ }
+
+ private Interface1 createOdu4HOInterface1(
+ OduFunctionIdentity oduFunction, MonitoringMode monitoringMode, Opu opu,
+ AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) {
OduBuilder oduIfBuilder = new OduBuilder()
.setRate(ODU4.VALUE)
.setOduFunction(oduFunction)
.setExpectedSapi(apiInfoZ.getExpectedSapi())
.setExpectedDapi(apiInfoZ.getExpectedDapi());
}
- // Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
- oduInterfaceBldr.addAugmentation(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
- .setOdu(oduIfBuilder.build())
- .build());
- // Post interface on the device
- openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
- //TODO isCTP is checked twice. There is room for refactoring here
- // and also likely for an intermediate fonction to create oduIfBuilder
- if (!isCTP) {
- LOG.info("{}-{} updating mapping with interface {}", nodeId, logicalConnPoint, oduInterfaceBldr.getName());
- this.portMapping.updateMapping(nodeId, mapping);
- }
- return oduInterfaceBldr.getName();
+ return new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
+ .setOdu(oduIfBuilder.build())
+ .build();
}
+
+
public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
throws OpenRoadmInterfaceException {
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
InterfaceBuilder oduInterfaceBldr =
createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU")
.setSupportingInterface(supportingOtuInterface)
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
.setOdu(
// ODU interface specific data
Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
if (portMapA == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(anodeId, alogicalConnPoint));
}
if (portMapZ == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(znodeId, zlogicalConnPoint));
}
InterfaceBuilder oduInterfaceBldr =
createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint + "-ODU")
.setSupportingInterface(supportingOtuInterface)
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
.setOdu(
new OduBuilder()
Mapping mapping = this.portMapping.getMapping(nodeId, logicalConnPoint);
if (mapping == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// OTU interface specific data
OtuBuilder otuIfBuilder = new OtuBuilder()
.setSupportingInterface(supportOchInterface)
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.Interface1Builder()
.setOtu(otuIfBuilder.build())
.build());
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
InterfaceBuilder oduInterfaceBldr =
createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + "-ODU4")
.setSupportingInterface(supportingOtuInterface)
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
.setOdu(
// ODU interface specific data
Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
if (portMapA == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(anodeId, alogicalConnPoint));
}
Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
if (portMapZ == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(znodeId, zlogicalConnPoint));
}
InterfaceBuilder oduInterfaceBldr =
createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint + "-ODU4")
.setSupportingInterface(asupportingOtuInterface)
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019
.Interface1Builder()
.setOdu(
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 MODULATION_FMT_EXCEPTION_MESSAGE =
"Unable to get the modulation format";
private static final String RATE_EXCEPTION_MESSAGE =
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
InterfaceBuilder ethInterfaceBldr =
createGenericInterfaceBuilder(portMap, EthernetCsmacd.VALUE, logicalConnPoint + "-ETHERNET")
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format("Unable to get mapping from PortMapping for node %s and logical connection port %s",
- nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Create generic interface
InterfaceBuilder ochInterfaceBldr =
spectrumInformation.getIdentifierFromParams(logicalConnPoint))
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev200529
.Interface1Builder()
.setOch(
throws OpenRoadmInterfaceException {
ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
if (modulationFormat == null) {
- throw new OpenRoadmInterfaceException(String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
+ throw new OpenRoadmInterfaceException(MODULATION_FMT_EXCEPTION_MESSAGE);
}
// OTSI interface specific data
OtsiBuilder otsiBuilder = new OtsiBuilder()
break;
default:
LOG.error("Rate {} is unsupported", serviceRate);
- throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+ throw new OpenRoadmInterfaceException(RATE_EXCEPTION_MESSAGE);
}
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Create generic interface
InterfaceBuilder otsiInterfaceBldr =
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Check the modulation format
ModulationFormat modulationFormat = ModulationFormat.forName(spectrumInformation.getModulationFormat());
if (modulationFormat == null) {
- throw new OpenRoadmInterfaceException(String.format(MODULATION_FMT_EXCEPTION_MESSAGE));
+ throw new OpenRoadmInterfaceException(MODULATION_FMT_EXCEPTION_MESSAGE);
}
int serviceRate = getServiceRate(modulationFormat, spectrumInformation);
// Create an OTSI group object
break;
default:
LOG.error("Rate {} is not supported", serviceRate);
- throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+ throw new OpenRoadmInterfaceException(RATE_EXCEPTION_MESSAGE);
}
// Create generic interface
InterfaceBuilder otsiGroupInterfaceBldr =
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
// create OCH interface
return createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation);
- } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
+ }
+ if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
// Create OTSi and OTSi-group and concat the names of the interface
String interfaceOtsiName = createOpenRoadmOtsiInterface(nodeId, logicalConnPoint, spectrumInformation);
// And Concat the two names for this interface
Mapping mapping = this.portMapping.getMapping(nodeId, logicalConnPoint);
if (mapping == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// OTU interface specific data
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.otu.container.OtuBuilder
.setSupportingInterfaceList(new HashSet<>(Set.of(supportOchInterface)))
.addAugmentation(
// Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev200529.Interface1Builder()
.setOtu(otuIfBuilder.build())
.build());
Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
if (mapping == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE,
- nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Create an OTUCn object
OtuBuilder otuBuilder = new OtuBuilder()
break;
default:
LOG.error("Rate {} is not supported", rate);
- throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+ throw new OpenRoadmInterfaceException(RATE_EXCEPTION_MESSAGE);
}
InterfaceBuilder otuInterfaceBuilder =
createGenericInterfaceBuilder(mapping, OtnOtu.VALUE, logicalConnPoint + "-OTUC" + otucnrate)
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Depending on OCH-OTU4-ODU4 interface or OTSi-OTSi-group, supporting interface should
// reflect that
if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
// create OTU4 interface
return createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportingInterface, apiInfoA, apiInfoZ);
- } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
+ }
+ if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
// Create OTUCn
return createOpenRoadmOtucnInterface(nodeId, logicalConnPoint, supportingInterface, apiInfoA, apiInfoZ);
}
Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
if (mapping == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
InterfaceBuilder oduInterfaceBldr =
createGenericInterfaceBuilder(mapping, OtnOdu.VALUE, logicalConnPoint + "-ODU4");
Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
if (mapping == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
if (mapping.getSupportingOtucn() == null) {
- throw new OpenRoadmInterfaceException(
- String.format("Missing supporting OTUCn interface on port-mapping"));
+ throw new OpenRoadmInterfaceException("Missing supporting OTUCn interface on port-mapping");
}
String supportingOtucn = mapping.getSupportingOtucn();
// Set the ODUCn rate from OTUCn interface naming convention
String oducnrate = supportingOtucn.substring(supportingOtucn.length() - 1);
// check if the oducnrate is a valid value and if it is invalid, then throw error
if (!SUPPORTED_ODUCN_RATES.contains(oducnrate)) {
- throw new OpenRoadmInterfaceException(String.format(RATE_EXCEPTION_MESSAGE));
+ throw new OpenRoadmInterfaceException(RATE_EXCEPTION_MESSAGE);
}
InterfaceBuilder oduInterfaceBuilder =
createGenericInterfaceBuilder(mapping, OtnOdu.VALUE, logicalConnPoint + "-ODUC" + oducnrate)
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));
+ throw new OpenRoadmInterfaceException(RATE_EXCEPTION_MESSAGE);
}
Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
if (portMapA == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(anodeId, alogicalConnPoint));
}
// On the Zside
Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
if (portMapZ == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(znodeId, zlogicalConnPoint));
}
InterfaceBuilder oduInterfaceBuilder =
createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint + ODUC + oducnrate)
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Parent Odu-allocation
// Set the trib-slot array
.setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(tribslots).build())
.build());
// Build the OPU container to the ODU builder
- if (rate.equals("1")) {
- oduBuilder
- .setRate(ODU4.VALUE)
- .setOpu(
- new OpuBuilder()
- .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
- .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
- .build());
- logicalConnPoint += "-ODU4";
- } else if (rate.equals("4")) {
- oduBuilder
- .setRate(ODUflexCbr.VALUE)
- .setOduflexCbrService(ODUflexCbr400G.VALUE)
- .setOpu(
- new OpuBuilder()
- .setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
- .setPayloadType(PayloadTypeDef.getDefaultInstance("32"))
- .build());
- logicalConnPoint += "-ODUFLEX";
- } else {
- oduBuilder.setOpu(new OpuBuilder().build());
+ switch (rate) {
+ case "1":
+ oduBuilder
+ .setRate(ODU4.VALUE)
+ .setOpu(
+ new OpuBuilder()
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+ .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+ .build());
+ logicalConnPoint += "-ODU4";
+ break;
+ case "4":
+ oduBuilder
+ .setRate(ODUflexCbr.VALUE)
+ .setOduflexCbrService(ODUflexCbr400G.VALUE)
+ .setOpu(
+ new OpuBuilder()
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+ .setPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+ .build());
+ logicalConnPoint += "-ODUFLEX";
+ break;
+ default:
+ oduBuilder.setOpu(new OpuBuilder().build());
+ break;
}
InterfaceBuilder oduflexInterfaceBuilder =
createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint)
Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
if (portMapA == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(anodeId, alogicalConnPoint));
}
// On the Zside
Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
if (portMapZ == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(znodeId, zlogicalConnPoint));
}
// Parent Odu-allocation
// Set the trib-slot array
.setTribPortNumber(Uint16.valueOf(1))
.setTribSlotsChoice(new OpucnBuilder().setOpucnTribSlots(tribslots).build())
.build());
- if (rate.equals("1")) {
- oduBuilder
- .setRate(ODU4.VALUE)
- .setOpu(
- new OpuBuilder()
- .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
- .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
- .build());
- alogicalConnPoint += "-ODU4";
- } else if (rate.equals("4")) {
- oduBuilder
- .setRate(ODUflexCbr.VALUE)
- .setOduflexCbrService(ODUflexCbr400G.VALUE)
- .setOpu(
- new OpuBuilder()
- .setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
- .setPayloadType(PayloadTypeDef.getDefaultInstance("32"))
- .build());
- alogicalConnPoint += "-ODUFLEX";
- } else {
- oduBuilder.setOpu(new OpuBuilder().build());
+ switch (rate) {
+ case "1":
+ oduBuilder
+ .setRate(ODU4.VALUE)
+ .setOpu(
+ new OpuBuilder()
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+ .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+ .build());
+ alogicalConnPoint += "-ODU4";
+ break;
+ case "4":
+ oduBuilder
+ .setRate(ODUflexCbr.VALUE)
+ .setOduflexCbrService(ODUflexCbr400G.VALUE)
+ .setOpu(
+ new OpuBuilder()
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+ .setPayloadType(PayloadTypeDef.getDefaultInstance("32"))
+ .build());
+ alogicalConnPoint += "-ODUFLEX";
+ break;
+ default:
+ oduBuilder.setOpu(new OpuBuilder().build());
+ break;
}
InterfaceBuilder oduflexInterfaceBuilder =
createGenericInterfaceBuilder(portMapA, OtnOdu.VALUE, alogicalConnPoint)
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// Depending on OTU4 or OTUCn, supporting interface should
// reflect that
if (portMap.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.VALUE)) {
// create OTU4 interface
return createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, apiInfoA, apiInfoZ);
- } else if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
+ }
+ if (portMap.getSupportedInterfaceCapability().contains(IfOtsiOtsigroup.VALUE)) {
// Create ODUCn and ODUFlex interface.
String interfaceOducn = createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
return interfaceOducn + "#"
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(nodeId, logicalConnPoint));
}
// 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));
+ throw new OpenRoadmInterfaceException(RATE_EXCEPTION_MESSAGE);
}
InterfaceBuilder oduInterfaceBuilder =
createGenericInterfaceBuilder(portMap, OtnOdu.VALUE, logicalConnPoint + ODUC + oducnrate)
Mapping portMapA = portMapping.getMapping(anodeId, alogicalConnPoint);
if (portMapA == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, anodeId, alogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(anodeId, alogicalConnPoint));
}
// On the Zside
Mapping portMapZ = portMapping.getMapping(znodeId, zlogicalConnPoint);
if (portMapZ == null) {
throw new OpenRoadmInterfaceException(
- String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, znodeId, zlogicalConnPoint));
+ OpenRoadmInterfaceException.mapping_msg_err(znodeId, zlogicalConnPoint));
}
// 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));
+ throw new OpenRoadmInterfaceException(RATE_EXCEPTION_MESSAGE);
}
InterfaceBuilder oduInterfaceBuilder =
double spectralWidth = (spectrumInformation.getHigherSpectralSlotNumber()
- spectrumInformation.getLowerSpectralSlotNumber() + 1) * GridConstant.GRANULARITY;
LOG.info("The width with guard band {}", spectralWidth);
- Map<ModulationFormat, Integer> rateMap;
if (spectralWidth == 50.0) {
- rateMap = Map.of(
+ LOG.info("The baud-rate is 31.6 GBaud");
+ return Map.of(
ModulationFormat.DpQpsk , 100,
- ModulationFormat.DpQam16 , 200);
+ ModulationFormat.DpQam16 , 200)
+ .get(modulationFormat);
// Based on roll-of-factor of 0.2, 50 - 12.5 = 37.5GHz translates to 31.6 GBaud
- LOG.info("The baud-rate is 31.6 GBaud");
- return rateMap.get(modulationFormat);
- } else {
- rateMap = Map.of(
- ModulationFormat.DpQpsk , 200,
- ModulationFormat.DpQam16 , 400);
- // Based on roll-of-factor of 0.2, 87.5 - 12.5 = 75GHz translates to 63.1 GBaud
- LOG.info("The baud-rate is 63.1 GBaud");
}
+ LOG.info("The baud-rate is 63.1 GBaud");
+ Map<ModulationFormat, Integer> rateMap = Map.of(
+ ModulationFormat.DpQpsk , 200,
+ ModulationFormat.DpQam16 , 400);
+ // Based on roll-of-factor of 0.2, 87.5 - 12.5 = 75GHz translates to 63.1 GBaud
int rate = rateMap.get(modulationFormat);
LOG.info("Given modulation format {} rate is {}", modulationFormat, rate);
return rate;