X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderer%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Frenderer%2Fopenroadminterface%2FOpenRoadmInterfaceFactory.java;h=608b0e47b31cb0cecfda23fb90a0144b22421c0e;hb=4378fca1d31d1f75c0480c752aa711fb885e6135;hp=51a4e102d3f36dd230b60582c18d4f2f8ae1c2dc;hpb=c8ee06305ef3e445b10ff207a220c7d5b40a8e3c;p=transportpce.git 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 51a4e102d..608b0e47b 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 @@ -11,9 +11,10 @@ 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.mapping.MappingUtils; import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev170228.network.nodes.Mapping; +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; @@ -21,24 +22,24 @@ public class OpenRoadmInterfaceFactory { private final MappingUtils mappingUtils; private final OpenRoadmInterface121 openRoadmInterface121; - private final OpenRoadmInterface22 openRoadmInterface22; + private final OpenRoadmInterface221 openRoadmInterface221; public OpenRoadmInterfaceFactory(MappingUtils mappingUtils, OpenRoadmInterface121 openRoadmInterface121, - OpenRoadmInterface22 openRoadmInterface22) { + OpenRoadmInterface221 openRoadmInterface221) { this.mappingUtils = mappingUtils; this.openRoadmInterface121 = openRoadmInterface121; - this.openRoadmInterface22 = openRoadmInterface22; + this.openRoadmInterface221 = openRoadmInterface221; } - public String createOpenRoadmEthInterface(String nodeId, - String logicalConnPoint) throws OpenRoadmInterfaceException { + public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint) + throws OpenRoadmInterfaceException { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.createOpenRoadmEthInterface(nodeId, logicalConnPoint); - case StringConstants.OPENROADM_DEVICE_VERSION_2_2: - return openRoadmInterface22.createOpenRoadmEthInterface(nodeId, logicalConnPoint); + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint); default: return null; } @@ -49,8 +50,13 @@ public class OpenRoadmInterfaceFactory { * This methods creates an OCH interface on the given termination point on * Roadm. * + * @param nodeId node ID + * @param logicalConnPoint logical connection point * @param waveNumber wavelength number of the OCH interface. + * * @return Name of the interface if successful, otherwise return null. + * + * @throws OpenRoadmInterfaceException OpenRoadm interface exception */ public List createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber) @@ -59,8 +65,8 @@ public class OpenRoadmInterfaceFactory { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint,waveNumber); - case StringConstants.OPENROADM_DEVICE_VERSION_2_2: - return openRoadmInterface22.createFlexOCH(nodeId, logicalConnPoint,waveNumber); + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.createFlexOCH(nodeId, logicalConnPoint,waveNumber); default: return null; } @@ -73,8 +79,8 @@ public class OpenRoadmInterfaceFactory { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint, waveNumber, rate, format); - case StringConstants.OPENROADM_DEVICE_VERSION_2_2: - return openRoadmInterface22.createOpenRoadmOchInterface(nodeId,logicalConnPoint,waveNumber); + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.createOpenRoadmOchInterface(nodeId,logicalConnPoint,waveNumber); default: return null; } @@ -83,7 +89,13 @@ public class OpenRoadmInterfaceFactory { /** * 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 createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface) @@ -92,8 +104,8 @@ public class OpenRoadmInterfaceFactory { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, supportingOtuInterface); - case StringConstants.OPENROADM_DEVICE_VERSION_2_2: - return openRoadmInterface22.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, supportingOtuInterface); default: return null; @@ -103,7 +115,13 @@ public class OpenRoadmInterfaceFactory { /** * This methods creates an OTU interface on the given termination 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 */ public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface) @@ -112,8 +130,8 @@ public class OpenRoadmInterfaceFactory { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.createOpenRoadmOtu4Interface(nodeId, logicalConnPoint,supportOchInterface); - case StringConstants.OPENROADM_DEVICE_VERSION_2_2: - return openRoadmInterface22.createOpenRoadmOtu4Interface(nodeId,logicalConnPoint, supportOchInterface); + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId,logicalConnPoint, supportOchInterface); default: return null; } @@ -127,8 +145,8 @@ public class OpenRoadmInterfaceFactory { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId,mapping); - case StringConstants.OPENROADM_DEVICE_VERSION_2_2: - return openRoadmInterface22.createOpenRoadmOmsInterface(nodeId,mapping); + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId,mapping); default: return null; } @@ -138,15 +156,24 @@ public class OpenRoadmInterfaceFactory { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId,mapping); - case StringConstants.OPENROADM_DEVICE_VERSION_2_2: - return openRoadmInterface22.createOpenRoadmOtsInterface(nodeId,mapping); + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId,mapping); default: return null; } } - - + 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); + case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: + return openRoadmInterface221.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager); + default: + return false; + } + } }