blob: 0b44761ecf6b190df1c11dad144230fcdc1dff8b [file] [log] [blame]
Phaneendra Manda635f6212015-10-26 18:27:41 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Phaneendra Manda635f6212015-10-26 18:27:41 +05303 *
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.vtnrsc;
17
Jian Lid79fb942016-02-29 13:42:23 -080018import org.onlab.util.Identifier;
Phaneendra Manda635f6212015-10-26 18:27:41 +053019
20import java.util.UUID;
Jian Lid79fb942016-02-29 13:42:23 -080021
22import static com.google.common.base.Preconditions.checkNotNull;
Phaneendra Manda635f6212015-10-26 18:27:41 +053023
24/**
25 * Representation of a Port Pair ID.
26 */
Jian Lid79fb942016-02-29 13:42:23 -080027public final class PortPairId extends Identifier<UUID> {
Phaneendra Manda635f6212015-10-26 18:27:41 +053028 /**
29 * Private constructor for port pair id.
30 *
31 * @param id UUID id of port pair
32 */
Mahesh Poojary Huaweid0b1d132015-11-05 11:00:18 +053033 private PortPairId(UUID id) {
Jian Lid79fb942016-02-29 13:42:23 -080034 super(checkNotNull(id, "Port chain id can not be null"));
Phaneendra Manda635f6212015-10-26 18:27:41 +053035 }
36
37 /**
Mahesh Poojary Huaweid0b1d132015-11-05 11:00:18 +053038 * Returns newly created port pair id object.
Phaneendra Manda635f6212015-10-26 18:27:41 +053039 *
40 * @param id UUID of port pair id
41 * @return object of port pair id
42 */
Mahesh Poojary Huaweid0b1d132015-11-05 11:00:18 +053043 public static PortPairId of(UUID id) {
Phaneendra Manda635f6212015-10-26 18:27:41 +053044 return new PortPairId(id);
45 }
46
47 /**
Mahesh Poojary Huaweid0b1d132015-11-05 11:00:18 +053048 * Returns newly created port pair id object.
Phaneendra Manda635f6212015-10-26 18:27:41 +053049 *
50 * @param id port pair id in string
51 * @return object of port pair id
52 */
Mahesh Poojary Huaweid0b1d132015-11-05 11:00:18 +053053 public static PortPairId of(String id) {
Phaneendra Manda635f6212015-10-26 18:27:41 +053054 return new PortPairId(UUID.fromString(id));
55 }
56
57 /**
Ray Milkeyc108a6b2017-08-23 15:23:50 -070058 * Returns the value of port pair id.
Phaneendra Manda635f6212015-10-26 18:27:41 +053059 *
60 * @return port pair id
61 */
62 public UUID value() {
Jian Lid79fb942016-02-29 13:42:23 -080063 return identifier;
Phaneendra Manda635f6212015-10-26 18:27:41 +053064 }
65}