2 * Copyright © 2017 AT&T and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.transportpce.renderer.openroadminterface;
11 import java.util.List;
12 import org.opendaylight.transportpce.common.StringConstants;
13 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
14 import org.opendaylight.transportpce.common.fixedflex.GridConstant;
15 import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation;
16 import org.opendaylight.transportpce.common.mapping.MappingUtils;
17 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
18 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.AEndApiInfo;
19 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.ZEndApiInfo;
20 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.mapping.Mapping;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
25 public class OpenRoadmInterfaceFactory {
27 private static final String OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG =
28 "OTN functions are not supported by Openroadm models 1.2.1";
29 private static final String OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG =
30 "OTN functions are not supported by Openroadm models 2.2.1";
31 private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterfaceFactory.class);
32 private final MappingUtils mappingUtils;
33 private final OpenRoadmInterface121 openRoadmInterface121;
34 private final OpenRoadmInterface221 openRoadmInterface221;
35 private final OpenRoadmInterface710 openRoadmInterface710;
36 private final OpenRoadmOtnInterface221 openRoadmOtnInterface221;
37 private final OpenRoadmOtnInterface710 openRoadmOtnInterface710;
39 public OpenRoadmInterfaceFactory(MappingUtils mappingUtils, OpenRoadmInterface121 openRoadmInterface121,
40 OpenRoadmInterface221 openRoadmInterface221, OpenRoadmInterface710 openRoadmInterface710,
41 OpenRoadmOtnInterface221 openRoadmOTNInterface221, OpenRoadmOtnInterface710 openRoadmOtnInterface710) {
42 this.mappingUtils = mappingUtils;
43 this.openRoadmInterface121 = openRoadmInterface121;
44 this.openRoadmInterface221 = openRoadmInterface221;
45 this.openRoadmInterface710 = openRoadmInterface710;
46 this.openRoadmOtnInterface221 = openRoadmOTNInterface221;
47 this.openRoadmOtnInterface710 = openRoadmOtnInterface710;
50 public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint)
51 throws OpenRoadmInterfaceException {
53 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
54 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
55 return openRoadmInterface121.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
56 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
57 return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
58 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
59 return openRoadmInterface710.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
65 public List<String> createOpenRoadmOchInterfaces(String nodeId, String logicalConnPoint,
66 SpectrumInformation spectrumInformation)
67 throws OpenRoadmInterfaceException {
68 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
69 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
70 return openRoadmInterface121.createOpenRoadmOchInterfaces(nodeId, logicalConnPoint,
72 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
73 return openRoadmInterface221.createFlexOCH(nodeId, logicalConnPoint, spectrumInformation);
81 * This methods creates an OCH interface on the given termination point on Roadm.
83 * @param nodeId node ID
84 * @param logicalConnPoint logical connection point
85 * @param spectrumInformation spectrum information.
86 * @return Name of the interface if successful, otherwise return null.
87 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
89 public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint,
90 SpectrumInformation spectrumInformation) throws OpenRoadmInterfaceException {
91 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
92 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
93 return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint,
95 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
96 return openRoadmInterface221.createOpenRoadmOchInterface(nodeId, logicalConnPoint,
98 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
99 // In the case of 710 device, we logically combine the OTSi and OTSiGroup interface and represent
101 String interfaceOtsiName = openRoadmInterface710.createOpenRoadmOtsiInterface(nodeId, logicalConnPoint,
102 spectrumInformation);
103 return openRoadmInterface710.createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint,
111 * This methods creates an ODU interface on the given termination point.
113 * @param nodeId node ID
114 * @param logicalConnPoint logical connection point
115 * @param isCTP to distinguish with a TTP odu interface
116 * @param apiInfoA sapi and dapi for A end of the service
117 * @param apiInfoZ sapi and dapi for Z end of the service
118 * @param payloadType payload type of the opu when terminated
119 * @return Name of the interface if successful, otherwise return null.
120 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
123 public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isCTP,
124 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ, String payloadType)
125 throws OpenRoadmInterfaceException {
127 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
128 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
129 return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint);
130 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
131 return openRoadmInterface221.createOpenRoadmOdu4HOInterface(nodeId, logicalConnPoint, isCTP,
132 apiInfoA, apiInfoZ, payloadType);
133 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
134 return openRoadmInterface710.createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
141 * This methods creates an OTU interface on the given termination point.
143 * @param nodeId node ID
144 * @param logicalConnPoint logical connection point
145 * @param supportOchInterface supporting OCH interface
146 * @param apiInfoA sapi and dapi for A end of the service
147 * @param apiInfoZ sapi and dapi for Z end of the service
148 * @return Name of the interface if successful, otherwise return null.
149 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
152 public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
153 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ)
154 throws OpenRoadmInterfaceException {
156 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
157 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
158 return openRoadmInterface121
159 .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface);
160 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
161 return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface,
163 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
164 return openRoadmInterface710.createOpenRoadmOtucnInterface(nodeId, logicalConnPoint,
165 supportOchInterface, apiInfoA, apiInfoZ);
172 public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, String spectralSlotNumber) {
173 return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotNumber);
176 public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
177 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
178 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
179 return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId, mapping);
180 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
181 return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId, mapping);
187 public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
188 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
189 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
190 return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId, mapping);
191 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
192 return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId, mapping);
198 public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
199 DeviceTransactionManager deviceTransactionManager) {
200 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
201 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
202 return openRoadmInterface121.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
203 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
204 return openRoadmInterface221.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
210 public boolean isUsedByOtnXc(String nodeId, String interfaceName, String xc,
211 DeviceTransactionManager deviceTransactionManager) {
212 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
213 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
214 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
216 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
217 return openRoadmInterface221.isUsedByOtnXc(nodeId, interfaceName, xc, deviceTransactionManager);
223 public String createOpenRoadmEth1GInterface(String nodeId,String logicalConnPoint)
224 throws OpenRoadmInterfaceException {
226 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
227 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
228 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
230 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
231 return openRoadmOtnInterface221.createOpenRoadmEth1GInterface(nodeId, logicalConnPoint);
237 public String createOpenRoadmEth10GInterface(String nodeId, String logicalConnPoint)
238 throws OpenRoadmInterfaceException {
240 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
241 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
242 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
244 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
245 return openRoadmOtnInterface221.createOpenRoadmEth10GInterface(nodeId, logicalConnPoint);
251 public String createOpenRoadmEth100GInterface(String nodeId, String logicalConnPoint)
252 throws OpenRoadmInterfaceException {
254 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
255 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
256 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
258 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
259 LOG.warn("Use Ethernet interface creation for 2.2.1, instead this method of Ether 100G");
260 return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
261 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
262 return openRoadmOtnInterface710.createOpenRoadmEth100GInterface(nodeId, logicalConnPoint);
268 public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
269 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
271 throws OpenRoadmInterfaceException {
273 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
274 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
275 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
277 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
278 return openRoadmOtnInterface221.createOpenRoadmOdu0Interface(nodeId, logicalConnPoint, servicename,
279 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
285 public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String servicename,
286 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
288 throws OpenRoadmInterfaceException {
289 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
290 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
291 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
293 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
294 return openRoadmOtnInterface221.createOpenRoadmOdu2Interface(nodeId, logicalConnPoint, servicename,
295 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
301 public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename,
302 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
304 throws OpenRoadmInterfaceException {
306 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
307 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
308 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
310 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
311 return openRoadmOtnInterface221.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint, servicename,
312 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
318 public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint,
319 String serviceName, String payLoad, boolean isNetworkPort,
320 OpucnTribSlotDef minTribSlotNumber, OpucnTribSlotDef maxTribSlotNumber)
321 throws OpenRoadmInterfaceException {
323 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
324 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
325 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
327 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
328 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG);
330 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
331 return openRoadmOtnInterface710.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, serviceName,
332 payLoad, isNetworkPort, minTribSlotNumber, maxTribSlotNumber);
339 public String createOpenRoadmOtnOdu4Interface(String anodeId, String alogicalConnPoint,
340 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
341 throws OpenRoadmInterfaceException {
342 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
343 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
344 return openRoadmInterface221
345 .createOpenRoadmOtnOdu4Interface(anodeId, alogicalConnPoint, asupportingOtuInterface,
346 znodeId, zlogicalConnPoint);
352 public String createOpenRoadmOtnOduc4Interface(String nodeId, String logicalConnPoint,
353 String supportingOtuInterface)
354 throws OpenRoadmInterfaceException {
355 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
356 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
357 return openRoadmInterface710
358 .createOpenRoadmOtnOducnInterface(nodeId, logicalConnPoint, supportingOtuInterface);
364 public String createOpenRoadmOtnOduc4Interface(String anodeId, String alogicalConnPoint,
365 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
366 throws OpenRoadmInterfaceException {
367 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
368 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
369 return openRoadmInterface710
370 .createOpenRoadmOtnOducnInterface(anodeId, alogicalConnPoint, asupportingOtuInterface,
371 znodeId, zlogicalConnPoint);