blob: 4d88476fcee6222832e4ce72d3224ec8d7871149 [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;
19import org.onlab.util.Frequency;
20import org.onosproject.net.Port;
21import org.onosproject.net.PortNumber;
22import org.onosproject.net.SparseAnnotations;
23
24/**
25 * Default implementation of immutable OMS port description.
HIGUCHI Yuta95d83e82016-04-26 12:13:48 -070026 *
27 * @deprecated in Goldeneye (1.6.0)
Marc De Leenheerbb382352015-04-23 18:20:34 -070028 */
HIGUCHI Yuta95d83e82016-04-26 12:13:48 -070029@Deprecated
Marc De Leenheerbb382352015-04-23 18:20:34 -070030public class OmsPortDescription extends DefaultPortDescription {
31
32 private final Frequency minFrequency;
33 private final Frequency maxFrequency;
34 private final Frequency grid;
35
36 /**
37 * Creates OMS port description based on the supplied information.
38 *
39 * @param number port number
40 * @param isEnabled port enabled state
41 * @param minFrequency minimum frequency
42 * @param maxFrequency maximum frequency
43 * @param grid grid spacing frequency
44 * @param annotations optional key/value annotations map
HIGUCHI Yuta95d83e82016-04-26 12:13:48 -070045 *
46 * @deprecated in Goldeneye (1.6.0)
Marc De Leenheerbb382352015-04-23 18:20:34 -070047 */
HIGUCHI Yuta95d83e82016-04-26 12:13:48 -070048 @Deprecated
Marc De Leenheerbb382352015-04-23 18:20:34 -070049 public OmsPortDescription(PortNumber number, boolean isEnabled, Frequency minFrequency, Frequency maxFrequency,
50 Frequency grid, SparseAnnotations... annotations) {
51 super(number, isEnabled, Port.Type.OMS, 0, annotations);
52 this.minFrequency = minFrequency;
53 this.maxFrequency = maxFrequency;
54 this.grid = grid;
55 }
56
57 /**
58 * Creates OMS port description based on the supplied information.
59 *
60 * @param base PortDescription to get basic information from
61 * @param minFrequency minimum frequency
62 * @param maxFrequency maximum frequency
63 * @param grid grid spacing frequency
64 * @param annotations optional key/value annotations map
HIGUCHI Yuta95d83e82016-04-26 12:13:48 -070065 *
66 * @deprecated in Goldeneye (1.6.0)
Marc De Leenheerbb382352015-04-23 18:20:34 -070067 */
HIGUCHI Yuta95d83e82016-04-26 12:13:48 -070068 @Deprecated
Marc De Leenheerbb382352015-04-23 18:20:34 -070069 public OmsPortDescription(PortDescription base, Frequency minFrequency, Frequency maxFrequency,
70 Frequency grid, SparseAnnotations annotations) {
71 super(base, annotations);
72 this.minFrequency = minFrequency;
73 this.maxFrequency = maxFrequency;
74 this.grid = grid;
75 }
76
77 /**
78 * Returns minimum frequency.
79 *
80 * @return minimum frequency
81 */
82 public Frequency minFrequency() {
83 return minFrequency;
84 }
85
86 /**
87 * Returns maximum frequency.
88 *
89 * @return maximum frequency
90 */
91 public Frequency maxFrequency() {
92 return maxFrequency;
93 }
94
95 /**
96 * Returns grid spacing frequency.
97 *
98 * @return grid spacing frequency
99 */
100 public Frequency grid() {
101 return grid;
102 }
103
104 @Override
105 public String toString() {
106 return MoreObjects.toStringHelper(getClass())
107 .add("number", portNumber())
108 .add("isEnabled", isEnabled())
109 .add("type", type())
110 .add("minFrequency", minFrequency)
111 .add("maxFrequency", maxFrequency)
112 .add("grid", grid)
113 .add("annotations", annotations())
114 .toString();
115 }
116
117}
118