blob: 7afce3de47f90b66ef52f87c8454357d4016237c [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
19import org.onosproject.bmv2.api.context.Bmv2DeviceContext;
20import org.onosproject.bmv2.api.context.Bmv2Interpreter;
21import org.onosproject.net.DeviceId;
22
23/**
24 * A service for managing BMv2 device contexts.
25 */
26public interface Bmv2DeviceContextService {
27
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070028 /**
Carmelo Casconec18e82c2016-06-16 14:22:36 -070029 * Returns the context of the given device, null if no context has been previously set.
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070030 *
31 * @param deviceId a device ID
32 * @return a BMv2 device context
33 */
34 Bmv2DeviceContext getContext(DeviceId deviceId);
35
36 /**
Carmelo Casconec18e82c2016-06-16 14:22:36 -070037 * Sets the context for the given device.
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070038 *
39 * @param deviceId a device ID
40 * @param context a BMv2 device context
41 */
Carmelo Casconec18e82c2016-06-16 14:22:36 -070042 void setContext(DeviceId deviceId, Bmv2DeviceContext context);
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070043
44 /**
45 * Binds the given interpreter with the given class loader so that other ONOS instances in the cluster can properly
46 * load the interpreter.
47 *
48 * @param interpreterClass an interpreter class
49 * @param loader a class loader
50 */
51 void registerInterpreterClassLoader(Class<? extends Bmv2Interpreter> interpreterClass, ClassLoader loader);
52
53 /**
Carmelo Casconec18e82c2016-06-16 14:22:36 -070054 * Returns a default context.
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070055 *
Carmelo Casconec18e82c2016-06-16 14:22:36 -070056 * @return a BMv2 device context
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070057 */
Carmelo Casconec18e82c2016-06-16 14:22:36 -070058 Bmv2DeviceContext defaultContext();
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070059}