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; |
Toru Furusawa | 72ee30c | 2016-01-08 13:29:04 -0800 | [diff] [blame] | 19 | import org.onosproject.net.CltSignalType; |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 20 | import org.onosproject.net.Port; |
| 21 | import org.onosproject.net.PortNumber; |
| 22 | import org.onosproject.net.SparseAnnotations; |
| 23 | |
| 24 | /** |
| 25 | * Default implementation of immutable ODU client port description. |
HIGUCHI Yuta | 4c0ef6b | 2016-05-02 19:45:41 -0700 | [diff] [blame] | 26 | * |
| 27 | * @deprecated in Goldeneye (1.6.0) |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 28 | */ |
HIGUCHI Yuta | 4c0ef6b | 2016-05-02 19:45:41 -0700 | [diff] [blame] | 29 | @Deprecated |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 30 | public class OduCltPortDescription extends DefaultPortDescription { |
| 31 | |
Toru Furusawa | 72ee30c | 2016-01-08 13:29:04 -0800 | [diff] [blame] | 32 | private final CltSignalType signalType; |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * Creates ODU client port description based on the supplied information. |
| 36 | * |
| 37 | * @param number port number |
| 38 | * @param isEnabled port enabled state |
| 39 | * @param signalType ODU client signal type |
| 40 | * @param annotations optional key/value annotations map |
| 41 | */ |
Toru Furusawa | 72ee30c | 2016-01-08 13:29:04 -0800 | [diff] [blame] | 42 | public OduCltPortDescription(PortNumber number, boolean isEnabled, CltSignalType signalType, |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 43 | SparseAnnotations... annotations) { |
| 44 | super(number, isEnabled, Port.Type.ODUCLT, 0, annotations); |
| 45 | this.signalType = signalType; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Creates ODU client port description based on the supplied information. |
| 50 | * |
| 51 | * @param base PortDescription to get basic information from |
| 52 | * @param signalType ODU client signal type |
| 53 | * @param annotations optional key/value annotations map |
| 54 | */ |
Toru Furusawa | 72ee30c | 2016-01-08 13:29:04 -0800 | [diff] [blame] | 55 | public OduCltPortDescription(PortDescription base, CltSignalType signalType, |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 56 | SparseAnnotations annotations) { |
| 57 | super(base, annotations); |
| 58 | this.signalType = signalType; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Returns ODU client signal type. |
| 63 | * |
| 64 | * @return ODU client signal type |
| 65 | */ |
Toru Furusawa | 72ee30c | 2016-01-08 13:29:04 -0800 | [diff] [blame] | 66 | public CltSignalType signalType() { |
Marc De Leenheer | bb38235 | 2015-04-23 18:20:34 -0700 | [diff] [blame] | 67 | return signalType; |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public String toString() { |
| 72 | return MoreObjects.toStringHelper(getClass()) |
| 73 | .add("number", portNumber()) |
| 74 | .add("isEnabled", isEnabled()) |
| 75 | .add("type", type()) |
| 76 | .add("signalType", signalType) |
| 77 | .toString(); |
| 78 | } |
| 79 | |
| 80 | } |