Carmelo Cascone | e912164 | 2016-04-27 17:02:38 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.drivers.bmv2; |
| 18 | |
| 19 | import org.onosproject.driver.pipeline.DefaultSingleTablePipeline; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.behaviour.NextGroup; |
| 22 | import org.onosproject.net.behaviour.Pipeliner; |
| 23 | import org.onosproject.net.behaviour.PipelinerContext; |
| 24 | import org.onosproject.net.driver.AbstractHandlerBehaviour; |
| 25 | import org.onosproject.net.flowobjective.FilteringObjective; |
| 26 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 27 | import org.onosproject.net.flowobjective.NextObjective; |
| 28 | |
| 29 | import java.util.List; |
| 30 | |
| 31 | /** |
| 32 | * Pipeliner device behaviour implementation for BMv2. |
| 33 | */ |
| 34 | public class Bmv2Pipeliner extends AbstractHandlerBehaviour implements Pipeliner { |
| 35 | |
| 36 | private Pipeliner pipeliner; |
| 37 | |
| 38 | @Override |
| 39 | public void init(DeviceId deviceId, PipelinerContext context) { |
Carmelo Cascone | 0831efb | 2016-05-31 14:50:19 -0700 | [diff] [blame] | 40 | // 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 Cascone | e912164 | 2016-04-27 17:02:38 -0700 | [diff] [blame] | 42 | 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 | } |