blob: 22ba01605bf7c647227fbea336192aa1b8d1f25c [file] [log] [blame]
Carmelo Cascone17fc9e42016-05-31 11:29:21 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
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.bmv2.api.service;
18
Carmelo Cascone9e39e312016-06-16 14:47:09 -070019import com.google.common.annotations.Beta;
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070020import org.onosproject.bmv2.api.runtime.Bmv2DeviceAgent;
21import org.onosproject.bmv2.api.runtime.Bmv2RuntimeException;
22import org.onosproject.net.DeviceId;
23
24/**
25 * A controller of BMv2 devices.
26 */
Carmelo Cascone9e39e312016-06-16 14:47:09 -070027@Beta
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070028public interface Bmv2Controller {
29
30 /**
31 * Default port.
32 */
33 int DEFAULT_PORT = 40123;
34
35 /**
36 * Return an agent to operate on the given device.
37 *
38 * @param deviceId a device ID
39 * @return a BMv2 agent
40 * @throws Bmv2RuntimeException if the agent is not available
41 */
42 Bmv2DeviceAgent getAgent(DeviceId deviceId) throws Bmv2RuntimeException;
43
44 /**
45 * Returns true if the given device is reachable from this controller, false otherwise.
46 *
47 * @param deviceId a device ID
48 * @return a boolean value
49 */
50 boolean isReacheable(DeviceId deviceId);
51
52 /**
53 * Register the given device listener.
54 *
55 * @param listener a device listener
56 */
57 void addDeviceListener(Bmv2DeviceListener listener);
58
59 /**
60 * Unregister the given device listener.
61 *
62 * @param listener a device listener
63 */
64 void removeDeviceListener(Bmv2DeviceListener listener);
65
66 /**
67 * Register the given packet listener.
68 *
69 * @param listener a packet listener
70 */
71 void addPacketListener(Bmv2PacketListener listener);
72
73 /**
74 * Unregister the given packet listener.
75 *
76 * @param listener a packet listener
77 */
78 void removePacketListener(Bmv2PacketListener listener);
79}