blob: 54955247b826891c5cdcbb48abb24191f3074386 [file] [log] [blame]
Rimon Ashkenazy8ebfff02016-02-01 11:56:36 +02001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Rimon Ashkenazy8ebfff02016-02-01 11:56:36 +02003 *
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;
19
20import org.onosproject.net.OtuSignalType;
21import org.onosproject.net.Port;
22import org.onosproject.net.PortNumber;
23import org.onosproject.net.SparseAnnotations;
24
25/**
26 * Default implementation of immutable OTU port description.
HIGUCHI Yuta5be3e822016-05-03 13:51:42 -070027 *
28 * @deprecated in Goldeneye (1.6.0)
Rimon Ashkenazy8ebfff02016-02-01 11:56:36 +020029 */
HIGUCHI Yuta5be3e822016-05-03 13:51:42 -070030@Deprecated
Rimon Ashkenazy8ebfff02016-02-01 11:56:36 +020031public 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}