Rimon Ashkenazy | 8ebfff0 | 2016-02-01 11:56:36 +0200 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Rimon Ashkenazy | 8ebfff0 | 2016-02-01 11:56:36 +0200 | [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; |
| 19 | |
| 20 | import org.onosproject.net.OtuSignalType; |
| 21 | import org.onosproject.net.Port; |
| 22 | import org.onosproject.net.PortNumber; |
| 23 | import org.onosproject.net.SparseAnnotations; |
| 24 | |
| 25 | /** |
| 26 | * Default implementation of immutable OTU port description. |
HIGUCHI Yuta | 5be3e82 | 2016-05-03 13:51:42 -0700 | [diff] [blame] | 27 | * |
| 28 | * @deprecated in Goldeneye (1.6.0) |
Rimon Ashkenazy | 8ebfff0 | 2016-02-01 11:56:36 +0200 | [diff] [blame] | 29 | */ |
HIGUCHI Yuta | 5be3e82 | 2016-05-03 13:51:42 -0700 | [diff] [blame] | 30 | @Deprecated |
Rimon Ashkenazy | 8ebfff0 | 2016-02-01 11:56:36 +0200 | [diff] [blame] | 31 | public class OtuPortDescription extends DefaultPortDescription { |
| 32 | |
| 33 | private final OtuSignalType signalType; |
| 34 | |
| 35 | /** |
| 36 | * Creates OTU port description based on the supplied information. |
| 37 | * |
| 38 | * @param number port number |
| 39 | * @param isEnabled port enabled state |
| 40 | * @param signalType OTU signal type |
| 41 | * @param annotations optional key/value annotations map |
| 42 | */ |
| 43 | public OtuPortDescription(PortNumber number, boolean isEnabled, OtuSignalType signalType, |
| 44 | SparseAnnotations... annotations) { |
| 45 | super(number, isEnabled, Port.Type.OTU, 0, annotations); |
| 46 | this.signalType = signalType; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Creates OTU port description based on the supplied information. |
| 51 | * |
| 52 | * @param base PortDescription to get basic information from |
| 53 | * @param signalType OTU signal type |
| 54 | * @param annotations optional key/value annotations map |
| 55 | */ |
| 56 | public OtuPortDescription(PortDescription base, OtuSignalType signalType, |
| 57 | SparseAnnotations annotations) { |
| 58 | super(base, annotations); |
| 59 | this.signalType = signalType; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Returns OTU signal type. |
| 64 | * |
| 65 | * @return OTU signal type |
| 66 | */ |
| 67 | public OtuSignalType signalType() { |
| 68 | return signalType; |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public String toString() { |
| 73 | return MoreObjects.toStringHelper(getClass()) |
| 74 | .add("number", portNumber()) |
| 75 | .add("isEnabled", isEnabled()) |
| 76 | .add("type", type()) |
| 77 | .add("signalType", signalType) |
| 78 | .toString(); |
| 79 | } |
| 80 | |
| 81 | } |