blob: 5c5ee38cdd7b66fb066d658cbb38ebb3df89f487 [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
19
Carmelo Cascone9e39e312016-06-16 14:47:09 -070020import com.google.common.annotations.Beta;
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070021import org.onosproject.bmv2.api.context.Bmv2FlowRuleTranslator;
22import org.onosproject.bmv2.api.runtime.Bmv2FlowRuleWrapper;
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070023import org.onosproject.bmv2.api.runtime.Bmv2TableEntryReference;
Carmelo Casconeee4cd7e2016-06-16 18:28:43 -070024import org.onosproject.net.DeviceId;
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070025
26/**
27 * A service for managing BMv2 table entries.
28 */
Carmelo Cascone9e39e312016-06-16 14:47:09 -070029@Beta
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070030public interface Bmv2TableEntryService {
31
32 /**
33 * Returns a flow rule translator.
34 *
35 * @return a flow rule translator
36 */
37 Bmv2FlowRuleTranslator getFlowRuleTranslator();
38
39 /**
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070040 * Binds the given ONOS flow rule with a BMv2 table entry reference.
41 *
42 * @param entryRef a table entry reference
43 * @param rule a BMv2 flow rule wrapper
44 */
Carmelo Casconeee4cd7e2016-06-16 18:28:43 -070045 void bind(Bmv2TableEntryReference entryRef, Bmv2FlowRuleWrapper rule);
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070046
47 /**
48 * Returns the ONOS flow rule associated with the given BMv2 table entry reference, or null if there's no such a
49 * mapping.
50 *
51 * @param entryRef a table entry reference
52 * @return a BMv2 flow rule wrapper
53 */
Carmelo Casconeee4cd7e2016-06-16 18:28:43 -070054 Bmv2FlowRuleWrapper lookup(Bmv2TableEntryReference entryRef);
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070055
56 /**
57 * Removes any flow rule previously bound with a given BMv2 table entry reference.
58 *
59 * @param entryRef a table entry reference
60 */
Carmelo Casconeee4cd7e2016-06-16 18:28:43 -070061 void unbind(Bmv2TableEntryReference entryRef);
62
63 /**
64 * Removes all bindings for a given device.
65 *
66 * @param deviceId a device ID
67 */
68 void unbindAll(DeviceId deviceId);
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070069}