blob: 1ce30bdec79bbdf94d25c746e6654c463c3b448b [file] [log] [blame]
Carmelo Casconee9121642016-04-27 17:02:38 -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.drivers.bmv2;
18
19import org.onosproject.driver.pipeline.DefaultSingleTablePipeline;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.behaviour.NextGroup;
22import org.onosproject.net.behaviour.Pipeliner;
23import org.onosproject.net.behaviour.PipelinerContext;
24import org.onosproject.net.driver.AbstractHandlerBehaviour;
25import org.onosproject.net.flowobjective.FilteringObjective;
26import org.onosproject.net.flowobjective.ForwardingObjective;
27import org.onosproject.net.flowobjective.NextObjective;
28
29import java.util.List;
30
31/**
32 * Pipeliner device behaviour implementation for BMv2.
33 */
34public class Bmv2Pipeliner extends AbstractHandlerBehaviour implements Pipeliner {
35
36 private Pipeliner pipeliner;
37
38 @Override
39 public void init(DeviceId deviceId, PipelinerContext context) {
Carmelo Cascone0831efb2016-05-31 14:50:19 -070040 // TODO: get multi-table pipeliner dynamically based on BMv2 device running model (hard).
41 // Right now we are able to map flow objectives only in the first table of the pipeline.
Carmelo Casconee9121642016-04-27 17:02:38 -070042 pipeliner = new DefaultSingleTablePipeline();
43 pipeliner.init(deviceId, context);
44 }
45
46 @Override
47 public void filter(FilteringObjective filterObjective) {
48 pipeliner.filter(filterObjective);
49 }
50
51 @Override
52 public void forward(ForwardingObjective forwardObjective) {
53 pipeliner.forward(forwardObjective);
54 }
55
56 @Override
57 public void next(NextObjective nextObjective) {
58 pipeliner.next(nextObjective);
59 }
60
61 @Override
62 public List<String> getNextMappings(NextGroup nextGroup) {
63 return pipeliner.getNextMappings(nextGroup);
64 }
65}