blob: 86e9321da5751248d583444d51f1618e0c76f3e6 [file] [log] [blame]
wei wei89ddc322015-03-22 16:29:04 -05001/*
Thomas Vachuska52f2cd12018-11-08 21:20:04 -08002 * Copyright 2018-present Open Networking Foundation
wei wei89ddc322015-03-22 16:29:04 -05003 *
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 */
Thomas Vachuskabf916ea2015-05-20 18:24:34 -070016
17package org.onosproject.incubator.net.tunnel;
wei wei89ddc322015-03-22 16:29:04 -050018
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040019import com.google.common.annotations.Beta;
wei wei89ddc322015-03-22 16:29:04 -050020import com.google.common.primitives.UnsignedLongs;
Jian Lib6d998e2016-02-29 11:41:18 -080021import org.onlab.util.Identifier;
wei wei89ddc322015-03-22 16:29:04 -050022
23/**
24 * Representation of a label Id, a logical port identifier.
25 */
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040026@Beta
Jian Lib6d998e2016-02-29 11:41:18 -080027public final class OpticalLogicId extends Identifier<Long> {
wei wei89ddc322015-03-22 16:29:04 -050028
Jian Lib6d998e2016-02-29 11:41:18 -080029 /**
30 * Constructor, public creation is prohibited.
31 */
32 private OpticalLogicId(long id) {
33 super(id);
34 }
wei wei89ddc322015-03-22 16:29:04 -050035
Jian Lib6d998e2016-02-29 11:41:18 -080036 /**
37 * Returns the LabelId representing the specified long value.
38 *
39 * @param id identifier as long value
40 * @return LabelId
41 */
42 public static OpticalLogicId logicId(long id) {
43 return new OpticalLogicId(id);
44 }
wei wei89ddc322015-03-22 16:29:04 -050045
Jian Lib6d998e2016-02-29 11:41:18 -080046 /**
47 * Returns the LabelId representing the specified string value.
48 *
49 * @param string identifier as string value
50 * @return LabelId
51 */
52 public static OpticalLogicId logicId(String string) {
53 return new OpticalLogicId(UnsignedLongs.decode(string));
54 }
wei wei89ddc322015-03-22 16:29:04 -050055
Jian Lib6d998e2016-02-29 11:41:18 -080056 public long toLong() {
57 return identifier;
58 }
wei wei89ddc322015-03-22 16:29:04 -050059}