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.rev220922.mapping.Mapping;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.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 // Below method differenciates 100G vs 400G based on supported-if-cap type
60 return openRoadmInterface710.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
66 public List<String> createOpenRoadmOchInterfaces(String nodeId, String logicalConnPoint,
67 SpectrumInformation spectrumInformation)
68 throws OpenRoadmInterfaceException {
69 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
70 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
71 return openRoadmInterface121.createOpenRoadmOchInterfaces(nodeId, logicalConnPoint,
73 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
74 return openRoadmInterface221.createFlexOCH(nodeId, logicalConnPoint, spectrumInformation);
82 * This methods creates an OCH interface on the given termination point on Roadm.
84 * @param nodeId node ID
85 * @param logicalConnPoint logical connection point
86 * @param spectrumInformation spectrum information.
87 * @return Name of the interface if successful, otherwise return null.
88 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
90 public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint,
91 SpectrumInformation spectrumInformation) throws OpenRoadmInterfaceException {
92 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
93 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
94 return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint,
96 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
97 return openRoadmInterface221.createOpenRoadmOchInterface(nodeId, logicalConnPoint,
99 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
100 return openRoadmInterface710.createOpenRoadmOchOtsiOtsigroupInterface(nodeId, logicalConnPoint,
101 spectrumInformation);
108 * This methods creates an ODU interface on the given termination point.
110 * @param nodeId node ID
111 * @param logicalConnPoint logical connection point
112 * @param isCTP to distinguish with a TTP odu interface
113 * @param apiInfoA sapi and dapi for A end of the service
114 * @param apiInfoZ sapi and dapi for Z end of the service
115 * @param payloadType payload type of the opu when terminated
116 * @return Name of the interface if successful, otherwise return null.
117 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
120 public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isCTP,
121 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ, String payloadType)
122 throws OpenRoadmInterfaceException {
124 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
125 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
126 return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint);
127 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
128 return openRoadmInterface221.createOpenRoadmOdu4HOInterface(nodeId, logicalConnPoint, isCTP,
129 apiInfoA, apiInfoZ, payloadType);
130 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
131 return openRoadmInterface710.createOpenRoadmOdu4OducnOduflex(nodeId, logicalConnPoint,
138 public String createOpenRoadmOducn(String nodeId, String logicalConnPoint)
139 throws OpenRoadmInterfaceException {
141 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
142 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
143 return openRoadmInterface710.createOpenRoadmOducnInterface(nodeId, logicalConnPoint);
150 * This methods creates an OTU interface on the given termination point.
152 * @param nodeId node ID
153 * @param logicalConnPoint logical connection point
154 * @param supportOchInterface supporting OCH interface
155 * @param apiInfoA sapi and dapi for A end of the service
156 * @param apiInfoZ sapi and dapi for Z end of the service
157 * @return Name of the interface if successful, otherwise return null.
158 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
161 public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
162 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ)
163 throws OpenRoadmInterfaceException {
165 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
166 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
167 return openRoadmInterface121
168 .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface);
169 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
170 return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface,
172 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
173 return openRoadmInterface710.createOpenRoadmOtu4OtucnInterface(nodeId, logicalConnPoint,
174 supportOchInterface, apiInfoA, apiInfoZ);
181 public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, String spectralSlotNumber) {
182 return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotNumber);
185 public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
186 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
187 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
188 return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId, mapping);
189 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
190 return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId, mapping);
196 public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
197 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
198 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
199 return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId, mapping);
200 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
201 return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId, mapping);
207 public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
208 DeviceTransactionManager deviceTransactionManager) {
209 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
210 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
211 return openRoadmInterface121.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
212 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
213 return openRoadmInterface221.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
219 public boolean isUsedByOtnXc(String nodeId, String interfaceName, String xc,
220 DeviceTransactionManager deviceTransactionManager) {
221 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
222 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
223 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
225 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
226 return openRoadmInterface221.isUsedByOtnXc(nodeId, interfaceName, xc, deviceTransactionManager);
232 public String createOpenRoadmEth1GInterface(String nodeId,String logicalConnPoint)
233 throws OpenRoadmInterfaceException {
235 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
236 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
237 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
239 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
240 return openRoadmOtnInterface221.createOpenRoadmEth1GInterface(nodeId, logicalConnPoint);
246 public String createOpenRoadmEth10GInterface(String nodeId, String logicalConnPoint)
247 throws OpenRoadmInterfaceException {
249 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
250 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
251 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
253 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
254 return openRoadmOtnInterface221.createOpenRoadmEth10GInterface(nodeId, logicalConnPoint);
260 public String createOpenRoadmEth100GInterface(String nodeId, String logicalConnPoint)
261 throws OpenRoadmInterfaceException {
263 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
264 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
265 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
267 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
268 LOG.warn("Use Ethernet interface creation for 2.2.1, instead this method of Ether 100G");
269 return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
270 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
271 return openRoadmOtnInterface710.createOpenRoadmEth100GInterface(nodeId, logicalConnPoint);
277 public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
278 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
280 throws OpenRoadmInterfaceException {
282 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
283 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
284 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
286 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
287 return openRoadmOtnInterface221.createOpenRoadmOdu0Interface(nodeId, logicalConnPoint, servicename,
288 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
294 public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String servicename,
295 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
297 throws OpenRoadmInterfaceException {
298 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
299 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
300 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
302 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
303 return openRoadmOtnInterface221.createOpenRoadmOdu2Interface(nodeId, logicalConnPoint, servicename,
304 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
310 public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename,
311 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
313 throws OpenRoadmInterfaceException {
315 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
316 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
317 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
319 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
320 return openRoadmOtnInterface221.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint, servicename,
321 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
327 public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint, String serviceName,
328 String payLoad, boolean isNetworkPort, OpucnTribSlotDef minTribSlotNumber,
329 OpucnTribSlotDef maxTribSlotNumber)
330 throws OpenRoadmInterfaceException {
332 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
333 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
334 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
336 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
337 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG);
339 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
340 return openRoadmOtnInterface710.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, serviceName,
341 payLoad, isNetworkPort, minTribSlotNumber, maxTribSlotNumber);
348 public String createOpenRoadmOtnOdu4Interface(String anodeId, String alogicalConnPoint,
349 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
350 throws OpenRoadmInterfaceException {
351 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
352 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
353 return openRoadmInterface221
354 .createOpenRoadmOtnOdu4Interface(anodeId, alogicalConnPoint, asupportingOtuInterface,
355 znodeId, zlogicalConnPoint);
361 public String createOpenRoadmOtnOduc4Interface(String nodeId, String logicalConnPoint,
362 String supportingOtuInterface)
363 throws OpenRoadmInterfaceException {
364 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
365 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
366 return openRoadmInterface710
367 .createOpenRoadmOtnOducnInterface(nodeId, logicalConnPoint, supportingOtuInterface);
373 public String createOpenRoadmOtnOducnInterface(String anodeId, String alogicalConnPoint,
374 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
375 throws OpenRoadmInterfaceException {
376 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
377 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
378 return openRoadmInterface710
379 .createOpenRoadmOtnOducnInterface(anodeId, alogicalConnPoint, asupportingOtuInterface,
380 znodeId, zlogicalConnPoint);