blob: 6397764d9f4420f1a2365a8cda9210c03b9b72b3 [file] [log] [blame]
Marc De Leenheerbb382352015-04-23 18:20:34 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Marc De Leenheerbb382352015-04-23 18:20:34 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.net.device;
17
18import com.google.common.base.MoreObjects;
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080019
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070020import org.onosproject.net.OchSignal;
21import org.onosproject.net.OduSignalType;
Marc De Leenheerbb382352015-04-23 18:20:34 -070022import org.onosproject.net.Port;
23import org.onosproject.net.PortNumber;
24import org.onosproject.net.SparseAnnotations;
25
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070026import static com.google.common.base.Preconditions.checkNotNull;
27
Marc De Leenheerbb382352015-04-23 18:20:34 -070028/**
29 * Default implementation of immutable OCh port description.
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080030 *
31 * @deprecated in Goldeneye (1.6.0)
Marc De Leenheerbb382352015-04-23 18:20:34 -070032 */
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080033@Deprecated
Marc De Leenheerbb382352015-04-23 18:20:34 -070034public class OchPortDescription extends DefaultPortDescription {
35
Sho SHIMIZU014c33a2015-04-30 11:40:37 -070036 private final OduSignalType signalType;
Marc De Leenheerbb382352015-04-23 18:20:34 -070037 private final boolean isTunable;
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070038 private final OchSignal lambda;
Marc De Leenheerbb382352015-04-23 18:20:34 -070039
40 /**
41 * Creates OCH port description based on the supplied information.
42 *
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070043 * @param number port number
44 * @param isEnabled port enabled state
45 * @param signalType ODU signal type
46 * @param isTunable tunable wavelength capability
Marc De Leenheer1afa2a02015-05-13 09:18:07 -070047 * @param lambda OCh signal
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070048 * @param annotations optional key/value annotations map
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080049 *
50 * @deprecated in Goldeneye (1.6.0)
Marc De Leenheerbb382352015-04-23 18:20:34 -070051 */
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080052 @Deprecated
Sho SHIMIZU014c33a2015-04-30 11:40:37 -070053 public OchPortDescription(PortNumber number, boolean isEnabled, OduSignalType signalType,
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070054 boolean isTunable, OchSignal lambda, SparseAnnotations... annotations) {
Marc De Leenheerbb382352015-04-23 18:20:34 -070055 super(number, isEnabled, Port.Type.OCH, 0, annotations);
56 this.signalType = signalType;
57 this.isTunable = isTunable;
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070058 this.lambda = checkNotNull(lambda);
Marc De Leenheerbb382352015-04-23 18:20:34 -070059 }
60
61 /**
62 * Creates OCH port description based on the supplied information.
63 *
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070064 * @param base PortDescription to get basic information from
65 * @param signalType ODU signal type
66 * @param isTunable tunable wavelength capability
67 * @param lambda OCh signal
68 * @param annotations optional key/value annotations map
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080069 *
70 * @deprecated in Goldeneye (1.6.0)
Marc De Leenheerbb382352015-04-23 18:20:34 -070071 */
HIGUCHI Yuta34a3f692016-01-09 21:08:57 -080072 @Deprecated
Sho SHIMIZU014c33a2015-04-30 11:40:37 -070073 public OchPortDescription(PortDescription base, OduSignalType signalType, boolean isTunable,
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070074 OchSignal lambda, SparseAnnotations annotations) {
Marc De Leenheerbb382352015-04-23 18:20:34 -070075 super(base, annotations);
76 this.signalType = signalType;
77 this.isTunable = isTunable;
Sho SHIMIZU0abceb82015-05-04 09:20:53 -070078 this.lambda = checkNotNull(lambda);
Marc De Leenheerbb382352015-04-23 18:20:34 -070079 }
80
81 /**
82 * Returns ODU signal type.
83 *
84 * @return ODU signal type
85 */
Sho SHIMIZU014c33a2015-04-30 11:40:37 -070086 public OduSignalType signalType() {
Marc De Leenheerbb382352015-04-23 18:20:34 -070087 return signalType;
88 }
89
90 /**
91 * Returns true if port is wavelength tunable.
92 *
93 * @return tunable wavelength capability
94 */
95 public boolean isTunable() {
96 return isTunable;
97 }
98
99 /**
Sho SHIMIZU0abceb82015-05-04 09:20:53 -0700100 * Returns OCh signal.
Marc De Leenheerbb382352015-04-23 18:20:34 -0700101 *
Sho SHIMIZU0abceb82015-05-04 09:20:53 -0700102 * @return OCh signal
Marc De Leenheerbb382352015-04-23 18:20:34 -0700103 */
Sho SHIMIZU0abceb82015-05-04 09:20:53 -0700104 public OchSignal lambda() {
105 return lambda;
Marc De Leenheerbb382352015-04-23 18:20:34 -0700106 }
107
108 @Override
109 public String toString() {
110 return MoreObjects.toStringHelper(getClass())
111 .add("number", portNumber())
112 .add("isEnabled", isEnabled())
113 .add("type", type())
114 .add("signalType", signalType)
115 .add("isTunable", isTunable)
Sho SHIMIZU0abceb82015-05-04 09:20:53 -0700116 .add("lambda", lambda)
Marc De Leenheerbb382352015-04-23 18:20:34 -0700117 .add("annotations", annotations())
118 .toString();
119 }
120
121}