Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 3 | * |
| 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 | */ |
| 16 | package org.onosproject.net.device; |
| 17 | |
| 18 | import com.google.common.base.MoreObjects; |
HIGUCHI Yuta | 34a3f69 | 2016-01-09 21:08:57 -0800 | [diff] [blame] | 19 | |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 20 | import org.onosproject.net.OchSignal; |
| 21 | import org.onosproject.net.OduSignalType; |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 22 | import org.onosproject.net.Port; |
| 23 | import org.onosproject.net.PortNumber; |
| 24 | import org.onosproject.net.SparseAnnotations; |
| 25 | |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 26 | import static com.google.common.base.Preconditions.checkNotNull; |
| 27 | |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 28 | /** |
| 29 | * Default implementation of immutable OCh port description. |
HIGUCHI Yuta | 34a3f69 | 2016-01-09 21:08:57 -0800 | [diff] [blame] | 30 | * |
| 31 | * @deprecated in Goldeneye (1.6.0) |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 32 | */ |
HIGUCHI Yuta | 34a3f69 | 2016-01-09 21:08:57 -0800 | [diff] [blame] | 33 | @Deprecated |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 34 | public class OchPortDescription extends DefaultPortDescription { |
| 35 | |
Sho SHIMIZU | 014c33a | 2015-04-30 11:40:37 -0700 | [diff] [blame] | 36 | private final OduSignalType signalType; |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 37 | private final boolean isTunable; |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 38 | private final OchSignal lambda; |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 39 | |
| 40 | /** |
| 41 | * Creates OCH port description based on the supplied information. |
| 42 | * |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 43 | * @param number port number |
| 44 | * @param isEnabled port enabled state |
| 45 | * @param signalType ODU signal type |
| 46 | * @param isTunable tunable wavelength capability |
Marc De Leenheer | 1afa2a0 | 2015-05-13 09:18:07 -0700 | [diff] [blame] | 47 | * @param lambda OCh signal |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 48 | * @param annotations optional key/value annotations map |
HIGUCHI Yuta | 34a3f69 | 2016-01-09 21:08:57 -0800 | [diff] [blame] | 49 | * |
| 50 | * @deprecated in Goldeneye (1.6.0) |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 51 | */ |
HIGUCHI Yuta | 34a3f69 | 2016-01-09 21:08:57 -0800 | [diff] [blame] | 52 | @Deprecated |
Sho SHIMIZU | 014c33a | 2015-04-30 11:40:37 -0700 | [diff] [blame] | 53 | public OchPortDescription(PortNumber number, boolean isEnabled, OduSignalType signalType, |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 54 | boolean isTunable, OchSignal lambda, SparseAnnotations... annotations) { |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 55 | super(number, isEnabled, Port.Type.OCH, 0, annotations); |
| 56 | this.signalType = signalType; |
| 57 | this.isTunable = isTunable; |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 58 | this.lambda = checkNotNull(lambda); |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Creates OCH port description based on the supplied information. |
| 63 | * |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 64 | * @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 Yuta | 34a3f69 | 2016-01-09 21:08:57 -0800 | [diff] [blame] | 69 | * |
| 70 | * @deprecated in Goldeneye (1.6.0) |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 71 | */ |
HIGUCHI Yuta | 34a3f69 | 2016-01-09 21:08:57 -0800 | [diff] [blame] | 72 | @Deprecated |
Sho SHIMIZU | 014c33a | 2015-04-30 11:40:37 -0700 | [diff] [blame] | 73 | public OchPortDescription(PortDescription base, OduSignalType signalType, boolean isTunable, |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 74 | OchSignal lambda, SparseAnnotations annotations) { |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 75 | super(base, annotations); |
| 76 | this.signalType = signalType; |
| 77 | this.isTunable = isTunable; |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 78 | this.lambda = checkNotNull(lambda); |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Returns ODU signal type. |
| 83 | * |
| 84 | * @return ODU signal type |
| 85 | */ |
Sho SHIMIZU | 014c33a | 2015-04-30 11:40:37 -0700 | [diff] [blame] | 86 | public OduSignalType signalType() { |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 87 | 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 SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 100 | * Returns OCh signal. |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 101 | * |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 102 | * @return OCh signal |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 103 | */ |
Sho SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 104 | public OchSignal lambda() { |
| 105 | return lambda; |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 106 | } |
| 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 SHIMIZU | 0abceb8 | 2015-05-04 09:20:53 -0700 | [diff] [blame] | 116 | .add("lambda", lambda) |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 117 | .add("annotations", annotations()) |
| 118 | .toString(); |
| 119 | } |
| 120 | |
| 121 | } |