blob: 60456cdb4be8c75eb0aa3131e40bcdfe7ac5018f [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;
17
18import java.util.Objects;
19
20import static com.google.common.base.MoreObjects.toStringHelper;
21
22/**
23 * Implementation of OTU port (Optical channel Transport Unit).
HIGUCHI Yuta5be3e822016-05-03 13:51:42 -070024 *
25 * @deprecated in Goldeneye (1.6.0)
Rimon Ashkenazy8ebfff02016-02-01 11:56:36 +020026 */
HIGUCHI Yuta5be3e822016-05-03 13:51:42 -070027@Deprecated
Rimon Ashkenazy8ebfff02016-02-01 11:56:36 +020028public class OtuPort extends DefaultPort {
29
30 private final OtuSignalType signalType;
31
32 /**
33 * Creates an OTU port in the specified network element.
34 *
35 * @param element parent network element
36 * @param number port number
37 * @param isEnabled port enabled state
38 * @param signalType OTU signal type
39 * @param annotations optional key/value annotations
40 */
41 public OtuPort(Element element, PortNumber number, boolean isEnabled,
42 OtuSignalType signalType, Annotations... annotations) {
43 super(element, number, isEnabled, Type.OTU, 0, annotations);
44 this.signalType = signalType;
45 }
46
47 /**
48 * Returns OTU signal type.
49 *
50 * @return OTU signal type
51 */
52 public OtuSignalType signalType() {
53 return signalType;
54 }
55
56 @Override
57 public int hashCode() {
58 return Objects.hash(number(), isEnabled(), type(), signalType, annotations());
59 }
60
61 @Override
62 public boolean equals(Object obj) {
63 if (this == obj) {
64 return true;
65 }
66 if (obj instanceof OtuPort) {
67 final OtuPort other = (OtuPort) obj;
68 return Objects.equals(this.element().id(), other.element().id()) &&
69 Objects.equals(this.number(), other.number()) &&
70 Objects.equals(this.isEnabled(), other.isEnabled()) &&
71 Objects.equals(this.signalType, other.signalType) &&
72 Objects.equals(this.annotations(), other.annotations());
73 }
74 return false;
75 }
76
77
78 @Override
79 public String toString() {
80 return toStringHelper(this)
81 .add("element", element().id())
82 .add("number", number())
83 .add("isEnabled", isEnabled())
84 .add("type", type())
85 .add("signalType", signalType)
86 .toString();
87 }
88
89}