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=b62ee33fddc9e0e0d366bc2e4d8c4d19c802f005;hb=b5ee86a522ce3cf5c6216f10647edb08b31c72e9;hp=c21ee1fa1548c8b732530b8d0d164c7252f61f97;hpb=67763b4d82e44c68fdbc765cdeec5496ff65b01e;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 c21ee1fa1..b62ee33fd 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 @@ -15,29 +15,36 @@ 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.rev210315.mapping.Mapping; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.AEndApiInfo; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.ZEndApiInfo; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mapping.Mapping; +import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef; 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"; + "OTN functions are not supported by Openroadm models 1.2.1"; + private static final String OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG = + "OTN functions are not supported by Openroadm models 2.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 OpenRoadmInterface710 openRoadmInterface710; - private final OpenRoadmOtnInterface221 openRoadmOtnInterface; + private final OpenRoadmOtnInterface221 openRoadmOtnInterface221; + private final OpenRoadmOtnInterface710 openRoadmOtnInterface710; public OpenRoadmInterfaceFactory(MappingUtils mappingUtils, OpenRoadmInterface121 openRoadmInterface121, OpenRoadmInterface221 openRoadmInterface221, OpenRoadmInterface710 openRoadmInterface710, - OpenRoadmOtnInterface221 openRoadmOTNInterface) { + OpenRoadmOtnInterface221 openRoadmOTNInterface221, OpenRoadmOtnInterface710 openRoadmOtnInterface710) { this.mappingUtils = mappingUtils; this.openRoadmInterface121 = openRoadmInterface121; this.openRoadmInterface221 = openRoadmInterface221; this.openRoadmInterface710 = openRoadmInterface710; - this.openRoadmOtnInterface = openRoadmOTNInterface; + this.openRoadmOtnInterface221 = openRoadmOTNInterface221; + this.openRoadmOtnInterface710 = openRoadmOtnInterface710; } public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint) @@ -48,7 +55,7 @@ public class OpenRoadmInterfaceFactory { return openRoadmInterface121.createOpenRoadmEthInterface(nodeId, logicalConnPoint); case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint); - case StringConstants.OPENROADM_DEVICE_VERSION_7_1_0: + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: return openRoadmInterface710.createOpenRoadmEthInterface(nodeId, logicalConnPoint); default: return null; @@ -88,7 +95,7 @@ public class OpenRoadmInterfaceFactory { case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: return openRoadmInterface221.createOpenRoadmOchInterface(nodeId, logicalConnPoint, spectrumInformation); - case StringConstants.OPENROADM_DEVICE_VERSION_7_1_0: + 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 String interfaceOtsiName = openRoadmInterface710.createOpenRoadmOtsiInterface(nodeId, logicalConnPoint, @@ -114,12 +121,11 @@ public class OpenRoadmInterfaceFactory { throws OpenRoadmInterfaceException { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: - return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, - supportingOtuInterface); + return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint); case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: return openRoadmInterface221.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, supportingOtuInterface); - case StringConstants.OPENROADM_DEVICE_VERSION_7_1_0: + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: // Here ODUCn and ODUflex are combined String interfaceNameOduc4 = openRoadmInterface710.createOpenRoadmOducnInterface(nodeId, logicalConnPoint, supportingOtuInterface); @@ -147,12 +153,11 @@ public class OpenRoadmInterfaceFactory { throws OpenRoadmInterfaceException { switch (mappingUtils.getOpenRoadmVersion(anodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: - return openRoadmInterface121.createOpenRoadmOdu4Interface(anodeId, alogicalConnPoint, - asupportingOtuInterface); + return openRoadmInterface121.createOpenRoadmOdu4Interface(anodeId, alogicalConnPoint); case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: return openRoadmInterface221.createOpenRoadmOdu4Interface(anodeId, alogicalConnPoint, asupportingOtuInterface, znodeId, zlogicalConnPoint); - case StringConstants.OPENROADM_DEVICE_VERSION_7_1_0: + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: // Here ODUCn and ODUflex are combined String interfaceNameOduc4 = openRoadmInterface710.createOpenRoadmOducnInterface(anodeId, alogicalConnPoint, asupportingOtuInterface, znodeId, zlogicalConnPoint); @@ -164,27 +169,26 @@ public class OpenRoadmInterfaceFactory { } /** - * This methods creates an OTU interface on the given termination point. + * This methods creates an ODU interface on the given termination point. * - * @param nodeId node ID - * @param logicalConnPoint logical connection point - * @param supportOchInterface supporting OCH interface + * @param nodeId node ID + * @param logicalConnPoint logical connection point + * @param isCTP to distinguish with a TTP odu interface + * @param apiInfoA sapi and dapi for A end of the service + * @param apiInfoZ sapi and dapi for Z end of the service + * @param payload payload type of the OPU container * @return Name of the interface if successful, otherwise return null. * @throws OpenRoadmInterfaceException OpenRoadm interface exception */ - public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface) - throws OpenRoadmInterfaceException { + public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isCTP, + AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ, String payload) throws OpenRoadmInterfaceException { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: - return openRoadmInterface121 - .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface); + return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint); case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: - return openRoadmInterface221 - .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface); - case StringConstants.OPENROADM_DEVICE_VERSION_7_1_0: - return openRoadmInterface710.createOpenRoadmOtucnInterface(nodeId, logicalConnPoint, - supportOchInterface); + return openRoadmInterface221.createOpenRoadmOdu4HOInterface(nodeId, logicalConnPoint, isCTP, + apiInfoA, apiInfoZ, payload); default: return null; } @@ -193,34 +197,32 @@ public class OpenRoadmInterfaceFactory { /** * 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. - * + * @param nodeId node ID + * @param logicalConnPoint logical connection point + * @param supportOchInterface supporting OCH interface + * @param apiInfoA sapi and dapi for A end of the service + * @param apiInfoZ sapi and dapi for Z end of the service * @throws OpenRoadmInterfaceException OpenRoadm interface exception */ - public String createOpenRoadmOtu4Interface(String anodeId, String alogicalConnPoint, String asupportOchInterface, - String znodeId, String zlogicalConnPoint) - throws OpenRoadmInterfaceException { - switch (mappingUtils.getOpenRoadmVersion(anodeId)) { + public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface, + AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException { + switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: - return openRoadmInterface121.createOpenRoadmOtu4Interface(anodeId, - alogicalConnPoint, asupportOchInterface); + return openRoadmInterface121 + .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface); case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1: - return openRoadmInterface221.createOpenRoadmOtu4Interface(anodeId, alogicalConnPoint, - asupportOchInterface, znodeId, zlogicalConnPoint); - case StringConstants.OPENROADM_DEVICE_VERSION_7_1_0: - return openRoadmInterface710.createOpenRoadmOtucnInterface(anodeId, alogicalConnPoint, - asupportOchInterface, znodeId, zlogicalConnPoint); + return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface, + apiInfoA, apiInfoZ); + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: + return openRoadmInterface710.createOpenRoadmOtucnInterface(nodeId, logicalConnPoint, + supportOchInterface); default: return null; } } + public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, String spectralSlotNumber) { return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotNumber); } @@ -248,7 +250,7 @@ public class OpenRoadmInterfaceFactory { } public boolean isUsedByXc(String nodeId, String interfaceName, String xc, - DeviceTransactionManager deviceTransactionManager) { + DeviceTransactionManager deviceTransactionManager) { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1: return openRoadmInterface121.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager); @@ -273,26 +275,44 @@ public class OpenRoadmInterfaceFactory { } public String createOpenRoadmEth1GInterface(String nodeId, - String logicalConnPoint) throws OpenRoadmInterfaceException { + 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); + return openRoadmOtnInterface221.createOpenRoadmEth1GInterface(nodeId, logicalConnPoint); default: return null; } } public String createOpenRoadmEth10GInterface(String nodeId, - String logicalConnPoint) throws OpenRoadmInterfaceException { + 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 openRoadmOtnInterface221.createOpenRoadmEth10GInterface(nodeId, logicalConnPoint); + default: + return null; + } + + } + + public String createOpenRoadmEth100GInterface(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); + LOG.warn("Use Ethernet interface creation for 2.2.1, instead this method of Ether 100G"); + return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint); + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: + return openRoadmOtnInterface710.createOpenRoadmEth100GInterface(nodeId, logicalConnPoint); default: return null; } @@ -307,7 +327,7 @@ public class OpenRoadmInterfaceFactory { 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( + return openRoadmOtnInterface221.createOpenRoadmOdu0Interface( nodeId, logicalConnPoint, servicename, payLoad, isNetworkPort, tribPortNumber, tribSlot); default: return null; @@ -322,7 +342,7 @@ public class OpenRoadmInterfaceFactory { 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( + return openRoadmOtnInterface221.createOpenRoadmOdu2Interface( nodeId, logicalConnPoint, servicename, payLoad, isNetworkPort, tribPortNumber, tribSlotIndex); default: return null; @@ -330,21 +350,41 @@ public class OpenRoadmInterfaceFactory { } public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename, - String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlotIndex) + boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) 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); + return openRoadmOtnInterface221.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint, servicename, + isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ); default: return null; } } + public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint, + String serviceName, String payLoad, boolean isNetworkPort, + OpucnTribSlotDef minTribSlotNumber, OpucnTribSlotDef maxTribSlotNumber) + 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: + LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG); + return null; + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: + return openRoadmOtnInterface710.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, serviceName, + payLoad, isNetworkPort, minTribSlotNumber, maxTribSlotNumber); + default: + return null; + } + } + public String createOpenRoadmOtnOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface) throws OpenRoadmInterfaceException { switch (mappingUtils.getOpenRoadmVersion(nodeId)) { @@ -368,4 +408,29 @@ public class OpenRoadmInterfaceFactory { return null; } } + + public String createOpenRoadmOtnOduc4Interface(String nodeId, String logicalConnPoint, + String supportingOtuInterface) + throws OpenRoadmInterfaceException { + switch (mappingUtils.getOpenRoadmVersion(nodeId)) { + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: + return openRoadmInterface710 + .createOpenRoadmOtnOducnInterface(nodeId, logicalConnPoint, supportingOtuInterface); + default: + return null; + } + } + + public String createOpenRoadmOtnOduc4Interface(String anodeId, String alogicalConnPoint, + String asupportingOtuInterface, String znodeId, String zlogicalConnPoint) + throws OpenRoadmInterfaceException { + switch (mappingUtils.getOpenRoadmVersion(anodeId)) { + case StringConstants.OPENROADM_DEVICE_VERSION_7_1: + return openRoadmInterface710 + .createOpenRoadmOtnOducnInterface(anodeId, alogicalConnPoint, asupportingOtuInterface, + znodeId, zlogicalConnPoint); + default: + return null; + } + } }