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 supportingOtuInterface supporting OTU interface
116 * @return Name of the interface if successful, otherwise return null.
117 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
120 public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
121 throws OpenRoadmInterfaceException {
122 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
123 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
124 return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint);
125 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
126 return openRoadmInterface221.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
127 supportingOtuInterface);
128 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
129 // Here ODUCn and ODUflex are combined
130 String interfaceNameOduc4 = openRoadmInterface710.createOpenRoadmOducnInterface(nodeId,
131 logicalConnPoint, supportingOtuInterface);
132 return openRoadmInterface710.createOpenRoadmOduflexInterface(nodeId, logicalConnPoint,
140 * This methods creates an ODU interface on the given termination point.
142 * @param anodeId node ID for A side
143 * @param alogicalConnPoint logical connection point for A side
144 * @param asupportingOtuInterface supporting OTU interface
145 * @param znodeId node ID for Z side
146 * @param zlogicalConnPoint logical connection point for Z side
147 * @return Name of the interface if successful, otherwise return null.
148 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
151 public String createOpenRoadmOdu4Interface(String anodeId, String alogicalConnPoint, String asupportingOtuInterface,
152 String znodeId, String zlogicalConnPoint)
153 throws OpenRoadmInterfaceException {
154 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
155 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
156 return openRoadmInterface121.createOpenRoadmOdu4Interface(anodeId, alogicalConnPoint);
157 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
158 return openRoadmInterface221.createOpenRoadmOdu4Interface(anodeId, alogicalConnPoint,
159 asupportingOtuInterface, znodeId, zlogicalConnPoint);
160 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
161 // Here ODUCn and ODUflex are combined
162 String interfaceNameOduc4 = openRoadmInterface710.createOpenRoadmOducnInterface(anodeId,
163 alogicalConnPoint, asupportingOtuInterface, znodeId, zlogicalConnPoint);
164 return openRoadmInterface710.createOpenRoadmOduflexInterface(anodeId, alogicalConnPoint,
165 interfaceNameOduc4, znodeId, zlogicalConnPoint);
172 * This methods creates an ODU interface on the given termination point.
174 * @param nodeId node ID
175 * @param logicalConnPoint logical connection point
176 * @param isCTP to distinguish with a TTP odu interface
177 * @param apiInfoA sapi and dapi for A end of the service
178 * @param apiInfoZ sapi and dapi for Z end of the service
179 * @param payload payload type of the OPU container
180 * @return Name of the interface if successful, otherwise return null.
181 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
184 public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isCTP,
185 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ, String payload) throws OpenRoadmInterfaceException {
186 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
187 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
188 return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint);
189 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
190 return openRoadmInterface221.createOpenRoadmOdu4HOInterface(nodeId, logicalConnPoint, isCTP,
191 apiInfoA, apiInfoZ, payload);
198 * This methods creates an OTU interface on the given termination point.
200 * @param nodeId node ID
201 * @param logicalConnPoint logical connection point
202 * @param supportOchInterface supporting OCH interface
203 * @param apiInfoA sapi and dapi for A end of the service
204 * @param apiInfoZ sapi and dapi for Z end of the service
205 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
208 public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
209 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ) throws OpenRoadmInterfaceException {
210 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
211 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
212 return openRoadmInterface121
213 .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface);
214 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
215 return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface,
217 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
218 return openRoadmInterface710.createOpenRoadmOtucnInterface(nodeId, logicalConnPoint,
219 supportOchInterface);
226 public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, String spectralSlotNumber) {
227 return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotNumber);
230 public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
231 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
232 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
233 return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId, mapping);
234 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
235 return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId, mapping);
241 public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
242 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
243 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
244 return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId, mapping);
245 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
246 return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId, mapping);
252 public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
253 DeviceTransactionManager deviceTransactionManager) {
254 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
255 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
256 return openRoadmInterface121.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
257 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
258 return openRoadmInterface221.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
264 public boolean isUsedByOtnXc(String nodeId, String interfaceName, String xc,
265 DeviceTransactionManager deviceTransactionManager) {
266 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
267 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
268 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
270 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
271 return openRoadmInterface221.isUsedByOtnXc(nodeId, interfaceName, xc, deviceTransactionManager);
277 public String createOpenRoadmEth1GInterface(String nodeId,
278 String logicalConnPoint) throws OpenRoadmInterfaceException {
279 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
280 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
281 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
283 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
284 return openRoadmOtnInterface221.createOpenRoadmEth1GInterface(nodeId, logicalConnPoint);
290 public String createOpenRoadmEth10GInterface(String nodeId,
291 String logicalConnPoint) throws OpenRoadmInterfaceException {
292 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
293 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
294 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
296 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
297 return openRoadmOtnInterface221.createOpenRoadmEth10GInterface(nodeId, logicalConnPoint);
304 public String createOpenRoadmEth100GInterface(String nodeId,
305 String logicalConnPoint) throws OpenRoadmInterfaceException {
307 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
308 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
309 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
311 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
312 LOG.warn("Use Ethernet interface creation for 2.2.1, instead this method of Ether 100G");
313 return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
314 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
315 return openRoadmOtnInterface710.createOpenRoadmEth100GInterface(nodeId, logicalConnPoint);
322 public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
323 String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlot)
324 throws OpenRoadmInterfaceException {
325 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
326 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
327 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
329 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
330 return openRoadmOtnInterface221.createOpenRoadmOdu0Interface(
331 nodeId, logicalConnPoint, servicename, payLoad, isNetworkPort, tribPortNumber, tribSlot);
337 public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String servicename,
338 String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlotIndex)
339 throws OpenRoadmInterfaceException {
340 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
341 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
342 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
344 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
345 return openRoadmOtnInterface221.createOpenRoadmOdu2Interface(
346 nodeId, logicalConnPoint, servicename, payLoad, isNetworkPort, tribPortNumber, tribSlotIndex);
352 public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename,
353 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ)
354 throws OpenRoadmInterfaceException {
355 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
356 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
357 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
359 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
360 return openRoadmOtnInterface221.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint, servicename,
361 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ);
368 public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint,
369 String serviceName, String payLoad, boolean isNetworkPort,
370 OpucnTribSlotDef minTribSlotNumber, OpucnTribSlotDef maxTribSlotNumber)
371 throws OpenRoadmInterfaceException {
373 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
374 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
375 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
377 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
378 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG);
380 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
381 return openRoadmOtnInterface710.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, serviceName,
382 payLoad, isNetworkPort, minTribSlotNumber, maxTribSlotNumber);
388 public String createOpenRoadmOtnOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
389 throws OpenRoadmInterfaceException {
390 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
391 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
392 return openRoadmInterface221
393 .createOpenRoadmOtnOdu4Interface(nodeId, logicalConnPoint, supportingOtuInterface);
399 public String createOpenRoadmOtnOdu4Interface(String anodeId, String alogicalConnPoint,
400 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
401 throws OpenRoadmInterfaceException {
402 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
403 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
404 return openRoadmInterface221
405 .createOpenRoadmOtnOdu4Interface(anodeId, alogicalConnPoint, asupportingOtuInterface,
406 znodeId, zlogicalConnPoint);
412 public String createOpenRoadmOtnOduc4Interface(String nodeId, String logicalConnPoint,
413 String supportingOtuInterface)
414 throws OpenRoadmInterfaceException {
415 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
416 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
417 return openRoadmInterface710
418 .createOpenRoadmOtnOducnInterface(nodeId, logicalConnPoint, supportingOtuInterface);
424 public String createOpenRoadmOtnOduc4Interface(String anodeId, String alogicalConnPoint,
425 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
426 throws OpenRoadmInterfaceException {
427 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
428 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
429 return openRoadmInterface710
430 .createOpenRoadmOtnOducnInterface(anodeId, alogicalConnPoint, asupportingOtuInterface,
431 znodeId, zlogicalConnPoint);