blob: b9d3910be9eba8538342631a418c7d0af834c241 [file] [log] [blame]
Esin Karaman971fb7f2017-12-28 13:44:52 +00001/*
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.drivers.bmv2.api;
18
19import org.onosproject.net.DeviceId;
20
21/**
22 * PRE Controller for BMv2 devices.
23 */
24public interface Bmv2PreController {
25
26 /**
27 * Creates a client to communicate with the PRE layer of a BMv2 device
28 * and associates it with the given device identifier.
29 * Returns true if the client was created and the channel to the device is open.
30 * If so, a {@link Bmv2DeviceAgent} can be later obtained by invoking {@link #getPreClient(DeviceId)}.
31 * Otherwise, returns false.
32 *
33 * @param deviceId device identifier
34 * @param thriftServerIp Thrift server address
35 * @param thriftServerPort Thrift server port
36 * @return true if the client was created and the channel to the device is open; false otherwise
37 * @throws IllegalStateException if a client already exists for the given device identifier
38 */
39 boolean createPreClient(DeviceId deviceId, String thriftServerIp, Integer thriftServerPort);
40
41 /**
42 * Returns the PRE client associated with the given device identifier, if any.
43 *
44 * @param deviceId device identifier
45 * @return client instance if a client has already been created; null otherwise
46 */
47 Bmv2DeviceAgent getPreClient(DeviceId deviceId);
48
49 /**
50 * Removes the PRE client associated with the given device identifier.
51 *
52 * @param deviceId device identifier
53 */
54 void removePreClient(DeviceId deviceId);
55
56}