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.mapping.MappingUtils;
15 import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev170228.network.nodes.Mapping;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.OchAttributes;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.RateIdentity;
20 public class OpenRoadmInterfaceFactory {
22 private final MappingUtils mappingUtils;
23 private final OpenRoadmInterface121 openRoadmInterface121;
24 private final OpenRoadmInterface22 openRoadmInterface22;
27 public OpenRoadmInterfaceFactory(MappingUtils mappingUtils, OpenRoadmInterface121 openRoadmInterface121,
28 OpenRoadmInterface22 openRoadmInterface22) {
29 this.mappingUtils = mappingUtils;
30 this.openRoadmInterface121 = openRoadmInterface121;
31 this.openRoadmInterface22 = openRoadmInterface22;
34 public String createOpenRoadmEthInterface(String nodeId,
35 String logicalConnPoint) throws OpenRoadmInterfaceException {
37 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
38 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
39 return openRoadmInterface121.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
40 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
41 return openRoadmInterface22.createOpenRoadmEthInterface(nodeId, logicalConnPoint);
49 * This methods creates an OCH interface on the given termination point on
52 * @param waveNumber wavelength number of the OCH interface.
53 * @return Name of the interface if successful, otherwise return null.
56 public List<String> createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber)
57 throws OpenRoadmInterfaceException {
59 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
60 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
61 return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint,waveNumber);
62 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
63 return openRoadmInterface22.createFlexOCH(nodeId, logicalConnPoint,waveNumber);
70 public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber,
71 Class<? extends RateIdentity> rate, OchAttributes.ModulationFormat format) throws OpenRoadmInterfaceException {
72 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
73 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
74 return openRoadmInterface121.createOpenRoadmOchInterface(nodeId, logicalConnPoint, waveNumber,
76 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
77 return openRoadmInterface22.createOpenRoadmOchInterface(nodeId,logicalConnPoint,waveNumber);
84 * This methods creates an ODU interface on the given termination point.
86 * @return Name of the interface if successful, otherwise return null.
89 public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
90 throws OpenRoadmInterfaceException {
91 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
92 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
93 return openRoadmInterface121.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
94 supportingOtuInterface);
95 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
96 return openRoadmInterface22.createOpenRoadmOdu4Interface(nodeId, logicalConnPoint,
97 supportingOtuInterface);
104 * This methods creates an OTU interface on the given termination point.
106 * @return Name of the interface if successful, otherwise return null.
109 public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface)
110 throws OpenRoadmInterfaceException {
111 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
112 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
113 return openRoadmInterface121.createOpenRoadmOtu4Interface(nodeId,
114 logicalConnPoint,supportOchInterface);
115 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
116 return openRoadmInterface22.createOpenRoadmOtu4Interface(nodeId,logicalConnPoint, supportOchInterface);
122 public String createOpenRoadmOchInterfaceName(String logicalConnectionPoint, Long waveNumber) {
123 return logicalConnectionPoint + "-" + waveNumber;
126 public String createOpenRoadmOmsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
127 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
128 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
129 return openRoadmInterface121.createOpenRoadmOmsInterface(nodeId,mapping);
130 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
131 return openRoadmInterface22.createOpenRoadmOmsInterface(nodeId,mapping);
137 public String createOpenRoadmOtsInterface(String nodeId, Mapping mapping) throws OpenRoadmInterfaceException {
138 switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
139 case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
140 return openRoadmInterface121.createOpenRoadmOtsInterface(nodeId,mapping);
141 case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
142 return openRoadmInterface22.createOpenRoadmOtsInterface(nodeId,mapping);