package org.opendaylight.transportpce.renderer.openroadminterface;
import java.util.List;
-
import org.opendaylight.transportpce.common.StringConstants;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
+import org.opendaylight.transportpce.common.fixedflex.GridConstant;
+import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation;
import org.opendaylight.transportpce.common.mapping.MappingUtils;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200128.network.nodes.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.RateIdentity;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210310.network.nodes.Mapping;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class OpenRoadmInterfaceFactory {
+ private static final String OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG =
+ "OTN funtions are not supported by Openroadm models 1.2.1";
+ private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterfaceFactory.class);
private final MappingUtils mappingUtils;
private final OpenRoadmInterface121 openRoadmInterface121;
private final OpenRoadmInterface221 openRoadmInterface221;
-
+ private final OpenRoadmOtnInterface221 openRoadmOtnInterface;
public OpenRoadmInterfaceFactory(MappingUtils mappingUtils, OpenRoadmInterface121 openRoadmInterface121,
- OpenRoadmInterface221 openRoadmInterface221) {
+ OpenRoadmInterface221 openRoadmInterface221, OpenRoadmOtnInterface221 openRoadmOTNInterface) {
this.mappingUtils = mappingUtils;
this.openRoadmInterface121 = openRoadmInterface121;
this.openRoadmInterface221 = openRoadmInterface221;
+ this.openRoadmOtnInterface = openRoadmOTNInterface;
}
public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint)
- throws OpenRoadmInterfaceException {
+ throws OpenRoadmInterfaceException {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
}
}
+ public List<String> createOpenRoadmOchInterfaces(String nodeId, String logicalConnPoint,
+ SpectrumInformation spectrumInformation)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ return openRoadmInterface121.createOpenRoadmOchInterfaces(nodeId, logicalConnPoint,
+ spectrumInformation);
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmInterface221.createFlexOCH(nodeId, logicalConnPoint, spectrumInformation);
+ default:
+ return null;
+ }
+ }
+
/**
- * This methods creates an OCH interface on the given termination point on
- * Roadm.
+ * This methods creates an OCH interface on the given termination point on Roadm.
*
- * @param nodeId node ID
+ * @param nodeId node ID
* @param logicalConnPoint logical connection point
- * @param waveNumber wavelength number of the OCH interface.
- *
+ * @param spectrumInformation spectrum information.
* @return Name of the interface if successful, otherwise return null.
- *
* @throws OpenRoadmInterfaceException OpenRoadm interface exception
*/
-
- public List<String> createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber)
- throws OpenRoadmInterfaceException {
-
+ public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint,
+ SpectrumInformation spectrumInformation) throws OpenRoadmInterfaceException {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
- return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint,waveNumber);
+ return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint,
+ spectrumInformation);
case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
- return openRoadmInterface221.createFlexOCH(nodeId, logicalConnPoint,waveNumber);
+ return openRoadmInterface221.createOpenRoadmOchInterface(nodeId, logicalConnPoint,
+ spectrumInformation);
+
default:
return null;
}
}
+ /**
+ * This methods creates an ODU interface on the given termination point.
+ *
+ * @param nodeId node ID
+ * @param logicalConnPoint logical connection point
+ * @param supportingOtuInterface supporting OTU interface
+ * @return Name of the interface if successful, otherwise return null.
+ * @throws OpenRoadmInterfaceException OpenRoadm interface exception
+ */
- public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber,
- Class<? extends RateIdentity> rate, OchAttributes.ModulationFormat format) throws OpenRoadmInterfaceException {
+ public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
+ throws OpenRoadmInterfaceException {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
- return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint, waveNumber,
- rate, format);
+ return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
+ supportingOtuInterface);
case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
- return openRoadmInterface221.createOpenRoadmOchInterface(nodeId,logicalConnPoint,waveNumber);
+ return openRoadmInterface221.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
+ supportingOtuInterface);
default:
return null;
}
/**
* This methods creates an ODU interface on the given termination point.
*
- * @param nodeId node ID
- * @param logicalConnPoint logical connection point
- * @param supportingOtuInterface supporting OTU interface
- *
+ * @param anodeId node ID for A side
+ * @param alogicalConnPoint logical connection point for A side
+ * @param asupportingOtuInterface supporting OTU interface
+ * @param znodeId node ID for Z side
+ * @param zlogicalConnPoint logical connection point for Z side
* @return Name of the interface if successful, otherwise return null.
- *
* @throws OpenRoadmInterfaceException OpenRoadm interface exception
*/
- public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
+ public String createOpenRoadmOdu4Interface(String anodeId, String alogicalConnPoint, String asupportingOtuInterface,
+ String znodeId, String zlogicalConnPoint)
throws OpenRoadmInterfaceException {
- switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
- return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
- supportingOtuInterface);
+ return openRoadmInterface121.createOpenRoadmOdu4Interface(anodeId, alogicalConnPoint,
+ asupportingOtuInterface);
case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
- return openRoadmInterface221.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
- supportingOtuInterface);
+ return openRoadmInterface221.createOpenRoadmOdu4Interface(anodeId, alogicalConnPoint,
+ asupportingOtuInterface, znodeId, zlogicalConnPoint);
default:
return null;
}
/**
* This methods creates an OTU interface on the given termination point.
*
- * @param nodeId node ID
- * @param logicalConnPoint logical connection point
+ * @param nodeId node ID
+ * @param logicalConnPoint logical connection point
* @param supportOchInterface supporting OCH interface
- *
* @return Name of the interface if successful, otherwise return null.
- *
* @throws OpenRoadmInterfaceException OpenRoadm interface exception
*/
throws OpenRoadmInterfaceException {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
- return openRoadmInterface121.createOpenRoadmOtu4Interface(nodeId,
- logicalConnPoint,supportOchInterface);
+ return openRoadmInterface121
+ .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface);
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmInterface221
+ .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface);
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * This methods creates an OTU interface on the given termination point.
+ *
+ * @param anodeId node ID for A side
+ * @param alogicalConnPoint logical connection point for A side
+ * @param asupportOchInterface supporting OCH interface
+ * @param znodeId node ID for the Z side
+ * @param zlogicalConnPoint logical connection point for Z side
+ * @return Name of the interface if successful, otherwise return null.
+ *
+ * @throws OpenRoadmInterfaceException OpenRoadm interface exception
+ */
+
+ public String createOpenRoadmOtu4Interface(String anodeId, String alogicalConnPoint, String asupportOchInterface,
+ String znodeId, String zlogicalConnPoint)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ return openRoadmInterface121.createOpenRoadmOtu4Interface(anodeId,
+ alogicalConnPoint, asupportOchInterface);
case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
- return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId,logicalConnPoint, supportOchInterface);
+ return openRoadmInterface221.createOpenRoadmOtu4Interface(anodeId, alogicalConnPoint,
+ asupportOchInterface, znodeId, zlogicalConnPoint);
default:
return null;
}
}
- public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, Long waveNumber) {
- return logicalConnectionPoint + "-" + waveNumber;
+ public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, String spectralSlotNumber) {
+ return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotNumber);
}
public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
- return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId,mapping);
+ return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId, mapping);
case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
- return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId,mapping);
+ return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId, mapping);
default:
return null;
}
public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
- return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId,mapping);
+ return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId, mapping);
case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
- return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId,mapping);
+ return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId, mapping);
default:
return null;
}
}
- public boolean isUsedbyXc(String nodeId, String interfaceName, String xc,
- DeviceTransactionManager deviceTransactionManager) {
+ public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
+ DeviceTransactionManager deviceTransactionManager) {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
return openRoadmInterface121.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
}
}
+ public boolean isUsedByOtnXc(String nodeId, String interfaceName, String xc,
+ DeviceTransactionManager deviceTransactionManager) {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return false;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmInterface221.isUsedByOtnXc(nodeId, interfaceName, xc, deviceTransactionManager);
+ default:
+ return false;
+ }
+ }
+ public String createOpenRoadmEth1GInterface(String nodeId,
+ String logicalConnPoint) throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface.createOpenRoadmEth1GInterface(nodeId, logicalConnPoint);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmEth10GInterface(String nodeId,
+ String logicalConnPoint) throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface.createOpenRoadmEth10GInterface(nodeId, logicalConnPoint);
+ default:
+ return null;
+ }
+
+ }
+
+ public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
+ String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlot)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface.createOpenRoadmOdu0Interface(
+ nodeId, logicalConnPoint, servicename, payLoad, isNetworkPort, tribPortNumber, tribSlot);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String servicename,
+ String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlotIndex)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface.createOpenRoadmOdu2Interface(
+ nodeId, logicalConnPoint, servicename, payLoad, isNetworkPort, tribPortNumber, tribSlotIndex);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename,
+ String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlotIndex)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmOtnInterface.createOpenRoadmOdu2eInterface(
+ nodeId, logicalConnPoint, servicename, payLoad, isNetworkPort, tribPortNumber, tribSlotIndex);
+ default:
+ return null;
+ }
+
+ }
+
+ public String createOpenRoadmOtnOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmInterface221
+ .createOpenRoadmOtnOdu4Interface(nodeId, logicalConnPoint, supportingOtuInterface);
+ default:
+ return null;
+ }
+ }
+
+ public String createOpenRoadmOtnOdu4Interface(String anodeId, String alogicalConnPoint,
+ String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
+ throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmInterface221
+ .createOpenRoadmOtnOdu4Interface(anodeId, alogicalConnPoint, asupportingOtuInterface,
+ znodeId, zlogicalConnPoint);
+ default:
+ return null;
+ }
+ }
}