blob: 379f54e270c0e759187d654bb23d67de31aea88a [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;
Toru Furusawa72ee30c2016-01-08 13:29:04 -080019import org.onosproject.net.CltSignalType;
Marc De Leenheerbb382352015-04-23 18:20:34 -070020import org.onosproject.net.Port;
21import org.onosproject.net.PortNumber;
22import org.onosproject.net.SparseAnnotations;
23
24/**
25 * Default implementation of immutable ODU client port description.
26 */
27public class OduCltPortDescription extends DefaultPortDescription {
28
Toru Furusawa72ee30c2016-01-08 13:29:04 -080029 private final CltSignalType signalType;
Marc De Leenheerbb382352015-04-23 18:20:34 -070030
31 /**
32 * Creates ODU client port description based on the supplied information.
33 *
34 * @param number port number
35 * @param isEnabled port enabled state
36 * @param signalType ODU client signal type
37 * @param annotations optional key/value annotations map
38 */
Toru Furusawa72ee30c2016-01-08 13:29:04 -080039 public OduCltPortDescription(PortNumber number, boolean isEnabled, CltSignalType signalType,
Marc De Leenheerbb382352015-04-23 18:20:34 -070040 SparseAnnotations... annotations) {
41 super(number, isEnabled, Port.Type.ODUCLT, 0, annotations);
42 this.signalType = signalType;
43 }
44
45 /**
46 * Creates ODU client port description based on the supplied information.
47 *
48 * @param base PortDescription to get basic information from
49 * @param signalType ODU client signal type
50 * @param annotations optional key/value annotations map
51 */
Toru Furusawa72ee30c2016-01-08 13:29:04 -080052 public OduCltPortDescription(PortDescription base, CltSignalType signalType,
Marc De Leenheerbb382352015-04-23 18:20:34 -070053 SparseAnnotations annotations) {
54 super(base, annotations);
55 this.signalType = signalType;
56 }
57
58 /**
59 * Returns ODU client signal type.
60 *
61 * @return ODU client signal type
62 */
Toru Furusawa72ee30c2016-01-08 13:29:04 -080063 public CltSignalType signalType() {
Marc De Leenheerbb382352015-04-23 18:20:34 -070064 return signalType;
65 }
66
67 @Override
68 public String toString() {
69 return MoreObjects.toStringHelper(getClass())
70 .add("number", portNumber())
71 .add("isEnabled", isEnabled())
72 .add("type", type())
73 .add("signalType", signalType)
74 .toString();
75 }
76
77}