blob: 9a8a6b0fab6f929c15eb53365e9f9ac78581216c [file] [log] [blame]
FrankWang2674e452018-05-24 17:13:35 +08001/*
2 * Copyright 2018-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.behaviour;
18
19import com.google.common.annotations.Beta;
20import org.onosproject.net.driver.HandlerBehaviour;
21import org.onosproject.net.pi.model.PiRegisterId;
22import org.onosproject.net.pi.runtime.PiRegisterCell;
23import org.onosproject.net.pi.runtime.PiRegisterCellId;
24
25import java.util.Collection;
26import java.util.Set;
27import java.util.concurrent.CompletableFuture;
28
29/**
30 * Protocol-independent register programmable device behaviour.
31 */
32@Beta
33public interface PiRegisterProgrammable extends HandlerBehaviour {
34
35 /**
36 * Write a register cell of this device.
37 *
38 * @param entry register entry
39 * @return Completable future with result of the operation
40 */
41 CompletableFuture<Boolean> writeRegisterCell(PiRegisterCell entry);
42
43 /**
44 * Gets the register cell given the register cell ID from the device.
45 *
46 * @param cellId the register cell Id
47 * @return completable future with the register cell
48 */
49 CompletableFuture<PiRegisterCell> readRegisterCell(PiRegisterCellId cellId);
50
51 /**
52 * Gets the register cells given the collection of cellIds from the device.
53 *
54 * @param cellIds the collection of register cell Id
55 * @return completable future with the collection of register cells
56 */
57 CompletableFuture<Collection<PiRegisterCell>> readRegisterCells(Set<PiRegisterCellId> cellIds);
58
59 /**
60 * Gets all of the register cells given register ID from the device.
61 * @param registerId the identifier of register
62 * @return completable future with the collection of register cells
63 */
64 CompletableFuture<Collection<PiRegisterCell>> readRegisterCells(PiRegisterId registerId);
65
66 /**
67 * Gets all of the register cells from the device.
68 *
69 * @return completable future with the collection of register cells
70 */
71 CompletableFuture<Collection<PiRegisterCell>> readAllRegisterCells();
72}