blob: a28b53cea9d49fbfe6f85a3cdd3c1edd975064a8 [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;
Jian Lib6d998e2016-02-29 11:41:18 -080020import org.onlab.util.Identifier;
wei wei89ddc322015-03-22 16:29:04 -050021
22/**
23 * Representation of a Tunnel Id.
24 */
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040025@Beta
Brian Stanke9a108972016-04-11 15:25:17 -040026public final class TunnelId extends Identifier<String> {
wei wei89ddc322015-03-22 16:29:04 -050027 /**
28 * Creates an tunnel identifier from the specified tunnel.
29 *
Brian Stanke9a108972016-04-11 15:25:17 -040030 * @param value string value
wei wei89ddc322015-03-22 16:29:04 -050031 * @return tunnel identifier
32 */
wei wei89ddc322015-03-22 16:29:04 -050033 public static TunnelId valueOf(String value) {
Brian Stanke9a108972016-04-11 15:25:17 -040034 return new TunnelId(value);
wei wei89ddc322015-03-22 16:29:04 -050035 }
36
37 /**
38 * Constructor for serializer.
39 */
40 TunnelId() {
Brian Stanke9a108972016-04-11 15:25:17 -040041 super("0");
wei wei89ddc322015-03-22 16:29:04 -050042 }
43
44 /**
Brian Stanke9a108972016-04-11 15:25:17 -040045 * Constructs the ID corresponding to a given string value.
wei wei89ddc322015-03-22 16:29:04 -050046 *
47 * @param value the underlying value of this ID
48 */
Brian Stanke9a108972016-04-11 15:25:17 -040049 TunnelId(String value) {
Jian Lib6d998e2016-02-29 11:41:18 -080050 super(value);
wei wei89ddc322015-03-22 16:29:04 -050051 }
52
53 @Override
54 public String toString() {
Brian Stanke9a108972016-04-11 15:25:17 -040055 return id();
wei wei89ddc322015-03-22 16:29:04 -050056 }
wei wei89ddc322015-03-22 16:29:04 -050057}