blob: 5138d02c0948d08f34273ff51fdf637045f00c28 [file] [log] [blame]
Michele Santuari4b6019e2014-12-19 11:31:45 +01001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Michele Santuari4b6019e2014-12-19 11:31:45 +01003 *
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 */
16
Brian O'Connor6de2e202015-05-21 14:30:41 -070017package org.onosproject.net.resource.link;
Michele Santuari4b6019e2014-12-19 11:31:45 +010018
19import java.util.Objects;
20
21/**
22 * Representation of MPLS label resource.
Sho SHIMIZU364cbac2015-10-29 15:47:35 -070023 *
24 * @deprecated in Emu Release
Michele Santuari4b6019e2014-12-19 11:31:45 +010025 */
Sho SHIMIZU364cbac2015-10-29 15:47:35 -070026@Deprecated
Sho SHIMIZU1c221ad2015-07-02 10:08:08 -070027public final class MplsLabel implements LinkResource {
Michele Santuari4b6019e2014-12-19 11:31:45 +010028
29 private final org.onlab.packet.MplsLabel mplsLabel;
30
31
32 /**
33 * Creates a new instance with given MPLS label.
34 *
35 * @param mplsLabel MPLS Label value to be assigned
36 */
37 public MplsLabel(int mplsLabel) {
38 this.mplsLabel = org.onlab.packet.MplsLabel.mplsLabel(mplsLabel);
39 }
40
41 /**
42 * Creates a new instance with given MPLS label.
43 *
44 * @param mplsLabel mplsLabel value to be assigned
45 * @return {@link MplsLabel} instance with given bandwidth
46 */
47 public static MplsLabel valueOf(int mplsLabel) {
48 return new MplsLabel(mplsLabel);
49 }
50
51 /**
52 * Returns MPLS Label as an MPLS Label Object.
53 *
54 * @return MPLS label as an MPLS Label Object.
55 */
56 public org.onlab.packet.MplsLabel label() {
57 return mplsLabel;
58 }
59
60 @Override
61 public boolean equals(Object obj) {
62 if (obj instanceof MplsLabel) {
63 MplsLabel that = (MplsLabel) obj;
64 return Objects.equals(this.mplsLabel, that.mplsLabel);
65 }
66 return false;
67 }
68
69 @Override
70 public int hashCode() {
71 return Objects.hashCode(this.mplsLabel);
72 }
73
74 @Override
75 public String toString() {
76 return String.valueOf(this.mplsLabel);
77 }
78}