blob: 4af663c7b79ee68636f9a6120385d2a681f49e6f [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;
17
18import java.util.Objects;
19
20import static com.google.common.base.MoreObjects.toStringHelper;
Toru Furusawa0f5da692016-01-07 14:51:47 -080021import static com.google.common.base.Preconditions.checkNotNull;
Marc De Leenheerbb382352015-04-23 18:20:34 -070022
23/**
24 * Implementation of ODU client port (Optical channel Data Unit).
25 * Also referred to as a T-port or wide band port.
26 * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)"
HIGUCHI Yuta4c0ef6b2016-05-02 19:45:41 -070027 *
28 * @deprecated in Goldeneye (1.6.0)
Marc De Leenheerbb382352015-04-23 18:20:34 -070029 */
HIGUCHI Yuta4c0ef6b2016-05-02 19:45:41 -070030@Deprecated
Marc De Leenheerbb382352015-04-23 18:20:34 -070031public class OduCltPort extends DefaultPort {
32
Toru Furusawa72ee30c2016-01-08 13:29:04 -080033 private final CltSignalType signalType;
Marc De Leenheerbb382352015-04-23 18:20:34 -070034
35 /**
36 * Creates an ODU client port in the specified network element.
37 *
38 * @param element parent network element
39 * @param number port number
40 * @param isEnabled port enabled state
41 * @param signalType ODU client signal type
42 * @param annotations optional key/value annotations
43 */
44 public OduCltPort(Element element, PortNumber number, boolean isEnabled,
Toru Furusawa72ee30c2016-01-08 13:29:04 -080045 CltSignalType signalType, Annotations... annotations) {
46 super(element, number, isEnabled, Type.ODUCLT, checkNotNull(signalType).bitRate(), annotations);
47 this.signalType = signalType;
Marc De Leenheerbb382352015-04-23 18:20:34 -070048 }
49
50 /**
51 * Returns ODU client signal type.
52 *
53 * @return ODU client signal type
54 */
Toru Furusawa72ee30c2016-01-08 13:29:04 -080055 public CltSignalType signalType() {
Marc De Leenheerbb382352015-04-23 18:20:34 -070056 return signalType;
57 }
58
59 @Override
60 public int hashCode() {
61 return Objects.hash(number(), isEnabled(), type(), signalType, annotations());
62 }
63
64 @Override
65 public boolean equals(Object obj) {
66 if (this == obj) {
67 return true;
68 }
Satish K7cfdc632015-11-27 19:48:41 +053069 if (obj != null && getClass() == obj.getClass()) {
Marc De Leenheerbb382352015-04-23 18:20:34 -070070 final OduCltPort other = (OduCltPort) obj;
71 return Objects.equals(this.element().id(), other.element().id()) &&
72 Objects.equals(this.number(), other.number()) &&
73 Objects.equals(this.isEnabled(), other.isEnabled()) &&
74 Objects.equals(this.signalType, other.signalType) &&
75 Objects.equals(this.annotations(), other.annotations());
76 }
77 return false;
78 }
79
80
81 @Override
82 public String toString() {
83 return toStringHelper(this)
84 .add("element", element().id())
85 .add("number", number())
86 .add("isEnabled", isEnabled())
87 .add("type", type())
88 .add("signalType", signalType)
89 .toString();
90 }
91
92}