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;
13 import org.opendaylight.transportpce.common.StringConstants;
14 import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
15 import org.opendaylight.transportpce.common.mapping.MappingUtils;
16 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200128.network.nodes.Mapping;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.RateIdentity;
21 public class OpenRoadmInterfaceFactory {
23 private final MappingUtils mappingUtils;
24 private final OpenRoadmInterface121 openRoadmInterface121;
25 private final OpenRoadmInterface221 openRoadmInterface221;
26 private final OpenRoadmOTNInterface openRoadmOTNInterface;
28 public OpenRoadmInterfaceFactory(MappingUtils mappingUtils, OpenRoadmInterface121 openRoadmInterface121,
29 OpenRoadmInterface221 openRoadmInterface221, OpenRoadmOTNInterface openRoadmOTNInterface) {
30 this.mappingUtils = mappingUtils;
31 this.openRoadmInterface121 = openRoadmInterface121;
32 this.openRoadmInterface221 = openRoadmInterface221;
33 this.openRoadmOTNInterface = openRoadmOTNInterface;
36 public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint)
37 throws OpenRoadmInterfaceException {
39 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
40 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
41 return openRoadmInterface121.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
42 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
43 return openRoadmInterface221.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
51 * This methods creates an OCH interface on the given termination point on
54 * @param nodeId node ID
55 * @param logicalConnPoint logical connection point
56 * @param waveNumber wavelength number of the OCH interface.
58 * @return Name of the interface if successful, otherwise return null.
60 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
63 public List<String> createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber)
64 throws OpenRoadmInterfaceException {
66 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
67 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
68 return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint,waveNumber);
69 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
70 return openRoadmInterface221.createFlexOCH(nodeId, logicalConnPoint,waveNumber);
77 public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber,
78 Class<? extends RateIdentity> rate, OchAttributes.ModulationFormat format) throws OpenRoadmInterfaceException {
79 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
80 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
81 return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint, waveNumber,
83 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
84 return openRoadmInterface221.createOpenRoadmOchInterface(nodeId,logicalConnPoint,waveNumber);
91 * This methods creates an ODU interface on the given termination point.
93 * @param nodeId node ID
94 * @param logicalConnPoint logical connection point
95 * @param supportingOtuInterface supporting OTU interface
97 * @return Name of the interface if successful, otherwise return null.
99 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
102 public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
103 throws OpenRoadmInterfaceException {
104 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
105 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
106 return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
107 supportingOtuInterface);
108 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
109 return openRoadmInterface221.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
110 supportingOtuInterface);
117 * This methods creates an OTU interface on the given termination point.
119 * @param nodeId node ID
120 * @param logicalConnPoint logical connection point
121 * @param supportOchInterface supporting OCH interface
123 * @return Name of the interface if successful, otherwise return null.
125 * @throws OpenRoadmInterfaceException OpenRoadm interface exception
128 public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface)
129 throws OpenRoadmInterfaceException {
130 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
131 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
132 return openRoadmInterface121.createOpenRoadmOtu4Interface(nodeId,
133 logicalConnPoint,supportOchInterface);
134 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
135 return openRoadmInterface221.createOpenRoadmOtu4Interface(nodeId,logicalConnPoint, supportOchInterface);
141 public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, Long waveNumber) {
142 return logicalConnectionPoint + "-" + waveNumber;
145 public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
146 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
147 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
148 return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId,mapping);
149 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
150 return openRoadmInterface221.createOpenRoadmOmsInterface(nodeId,mapping);
156 public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
157 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
158 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
159 return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId,mapping);
160 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
161 return openRoadmInterface221.createOpenRoadmOtsInterface(nodeId,mapping);
167 public boolean isUsedbyXc(String nodeId, String interfaceName, String xc,
168 DeviceTransactionManager deviceTransactionManager) {
169 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
170 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
171 return openRoadmInterface121.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
172 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
173 return openRoadmInterface221.isUsedByXc(nodeId, interfaceName, xc, deviceTransactionManager);
179 public String createOpenRoadmEth1GInterface(String nodeId,
180 String logicalConnPoint) throws OpenRoadmInterfaceException {
181 return openRoadmOTNInterface.createOpenRoadmEth1GInterface(nodeId,logicalConnPoint);
184 public String createOpenRoadmEth10GInterface(String nodeId,
185 String logicalConnPoint) throws OpenRoadmInterfaceException {
186 return openRoadmOTNInterface.createOpenRoadmEth10GInterface(nodeId,logicalConnPoint);
189 public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
190 String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlot)
191 throws OpenRoadmInterfaceException {
192 return openRoadmOTNInterface.createOpenRoadmOdu0Interface(nodeId, logicalConnPoint, servicename, payLoad,
193 isNetworkPort, tribPortNumber, tribSlot);
196 public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String servicename,
197 String payLoad, boolean isNetworkPort)
198 throws OpenRoadmInterfaceException {
199 return openRoadmOTNInterface.createOpenRoadmOdu2Interface(nodeId, logicalConnPoint, servicename, payLoad,
203 public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename,
204 String payLoad, boolean isNetworkPort)
205 throws OpenRoadmInterfaceException {
206 return openRoadmOTNInterface.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint, servicename, payLoad,