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.rev220114.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 //TODO: 7.1 device can also have 100G transponder
102 String interfaceOtsiName = openRoadmInterface710.createOpenRoadmOtsiInterface(nodeId, logicalConnPoint,
103 spectrumInformation);
104 return openRoadmInterface710.createOpenRoadmOtsiGroupInterface(nodeId, logicalConnPoint,
105 interfaceOtsiName, spectrumInformation);
112 * This methods creates an ODU interface on the given termination point.
114 * @param nodeId node ID
115 * @param logicalConnPoint logical connection point
116 * @param isCTP to distinguish with a TTP odu interface
117 * @param apiInfoA sapi and dapi for A end of the service
118 * @param apiInfoZ sapi and dapi for Z end of the service
119 * @param payloadType payload type of the opu when terminated
120 * @return Name of the interface if successful, otherwise return null.
121 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
124 public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isCTP,
125 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ, String payloadType)
126 throws OpenRoadmInterfaceException {
128 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
129 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
130 return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint);
131 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
132 return openRoadmInterface221.createOpenRoadmOdu4HOInterface(nodeId, logicalConnPoint, isCTP,
133 apiInfoA, apiInfoZ, payloadType);
134 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
135 // Here ODUCn and ODUflex are combined
136 String interfaceNameOduc4 = openRoadmInterface710.createOpenRoadmOducnInterface(nodeId,
138 return openRoadmInterface710.createOpenRoadmOduflexInterface(nodeId, logicalConnPoint,
146 * This methods creates an OTU interface on the given termination point.
148 * @param nodeId node ID
149 * @param logicalConnPoint logical connection point
150 * @param supportOchInterface supporting OCH interface
151 * @param apiInfoA sapi and dapi for A end of the service
152 * @param apiInfoZ sapi and dapi for Z end of the service
153 * @return Name of the interface if successful, otherwise return null.
154 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
157 public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
158 AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ)
159 throws OpenRoadmInterfaceException {
161 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
162 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
163 return openRoadmInterface121
164 .createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface);
165 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
166 return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId, logicalConnPoint, supportOchInterface,
168 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
169 return openRoadmInterface710.createOpenRoadmOtucnInterface(nodeId, logicalConnPoint,
170 supportOchInterface, apiInfoA, apiInfoZ);
177 public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, String spectralSlotNumber) {
178 return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR,logicalConnectionPoint, spectralSlotNumber);
181 public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
182 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
183 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
184 return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId, mapping);
185 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
186 return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId, mapping);
192 public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
193 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
194 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
195 return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId, mapping);
196 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
197 return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId, mapping);
203 public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
204 DeviceTransactionManager deviceTransactionManager) {
205 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
206 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
207 return openRoadmInterface121.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
208 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
209 return openRoadmInterface221.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
215 public boolean isUsedByOtnXc(String nodeId, String interfaceName, String xc,
216 DeviceTransactionManager deviceTransactionManager) {
217 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
218 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
219 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
221 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
222 return openRoadmInterface221.isUsedByOtnXc(nodeId, interfaceName, xc, deviceTransactionManager);
228 public String createOpenRoadmEth1GInterface(String nodeId,String logicalConnPoint)
229 throws OpenRoadmInterfaceException {
231 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
232 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
233 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
235 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
236 return openRoadmOtnInterface221.createOpenRoadmEth1GInterface(nodeId, logicalConnPoint);
242 public String createOpenRoadmEth10GInterface(String nodeId, String logicalConnPoint)
243 throws OpenRoadmInterfaceException {
245 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
246 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
247 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
249 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
250 return openRoadmOtnInterface221.createOpenRoadmEth10GInterface(nodeId, logicalConnPoint);
256 public String createOpenRoadmEth100GInterface(String nodeId, String logicalConnPoint)
257 throws OpenRoadmInterfaceException {
259 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
260 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
261 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
263 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
264 LOG.warn("Use Ethernet interface creation for 2.2.1, instead this method of Ether 100G");
265 return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
266 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
267 return openRoadmOtnInterface710.createOpenRoadmEth100GInterface(nodeId, logicalConnPoint);
273 public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
274 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
276 throws OpenRoadmInterfaceException {
278 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
279 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
280 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
282 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
283 return openRoadmOtnInterface221.createOpenRoadmOdu0Interface(nodeId, logicalConnPoint, servicename,
284 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
290 public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String servicename,
291 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
293 throws OpenRoadmInterfaceException {
294 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
295 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
296 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
298 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
299 return openRoadmOtnInterface221.createOpenRoadmOdu2Interface(nodeId, logicalConnPoint, servicename,
300 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
306 public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename,
307 boolean isCTP, int tribPortNumber, int tribSlotIndex, AEndApiInfo apiInfoA, ZEndApiInfo apiInfoZ,
309 throws OpenRoadmInterfaceException {
311 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
312 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
313 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
315 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
316 return openRoadmOtnInterface221.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint, servicename,
317 isCTP, tribPortNumber, tribSlotIndex, apiInfoA, apiInfoZ, payLoadType);
323 public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint,
324 String serviceName, String payLoad, boolean isNetworkPort,
325 OpucnTribSlotDef minTribSlotNumber, OpucnTribSlotDef maxTribSlotNumber)
326 throws OpenRoadmInterfaceException {
328 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
329 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
330 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
332 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
333 LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_2_2_1_MSG);
335 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
336 return openRoadmOtnInterface710.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint, serviceName,
337 payLoad, isNetworkPort, minTribSlotNumber, maxTribSlotNumber);
344 public String createOpenRoadmOtnOdu4Interface(String anodeId, String alogicalConnPoint,
345 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
346 throws OpenRoadmInterfaceException {
347 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
348 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
349 return openRoadmInterface221
350 .createOpenRoadmOtnOdu4Interface(anodeId, alogicalConnPoint, asupportingOtuInterface,
351 znodeId, zlogicalConnPoint);
357 public String createOpenRoadmOtnOduc4Interface(String nodeId, String logicalConnPoint,
358 String supportingOtuInterface)
359 throws OpenRoadmInterfaceException {
360 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
361 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
362 return openRoadmInterface710
363 .createOpenRoadmOtnOducnInterface(nodeId, logicalConnPoint, supportingOtuInterface);
369 public String createOpenRoadmOtnOducnInterface(String anodeId, String alogicalConnPoint,
370 String asupportingOtuInterface, String znodeId, String zlogicalConnPoint)
371 throws OpenRoadmInterfaceException {
372 switch (mappingUtils.getOpenRoadmVersion(anodeId)) {
373 case StringConstants.OPENROADM_DEVICE_VERSION_7_1:
374 return openRoadmInterface710
375 .createOpenRoadmOtnOducnInterface(anodeId, alogicalConnPoint, asupportingOtuInterface,
376 znodeId, zlogicalConnPoint);