blob: eb74288243f035e18357f492aab770cec6f80be1 [file] [log] [blame]
Carmelo Cascone326ad2d2017-11-28 18:09:13 -08001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
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
17package org.onosproject.net.pi.runtime;
18
19import com.google.common.annotations.Beta;
20import org.onosproject.net.DeviceId;
21
22import static com.google.common.base.Preconditions.checkNotNull;
23
24/**
25 * Global identifier of a PI entity applied to a device, unique in the scope of
26 * the whole network.
27 */
28@Beta
29public abstract class PiHandle<E extends PiEntity> {
30
31 private final DeviceId deviceId;
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080032
Carmelo Casconee44592f2018-09-12 02:24:47 -070033 protected PiHandle(DeviceId deviceId) {
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080034 this.deviceId = checkNotNull(deviceId);
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080035 }
36
37 /**
38 * Returns the device ID of this handle.
39 *
40 * @return device ID
41 */
42 public final DeviceId deviceId() {
43 return deviceId;
44 }
45
46 /**
47 * Returns the type of entity identified by this handle.
48 *
49 * @return PI entity type
50 */
Carmelo Casconee44592f2018-09-12 02:24:47 -070051 public abstract PiEntityType entityType();
Carmelo Cascone326ad2d2017-11-28 18:09:13 -080052
53 @Override
54 public abstract int hashCode();
55
56 @Override
57 public abstract boolean equals(Object obj);
58
59 @Override
60 public abstract String toString();
61}