alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | package org.onosproject.net.flowobjective; |
| 17 | |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame^] | 18 | import org.onosproject.core.ApplicationId; |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 19 | import org.onosproject.net.flow.criteria.Criterion; |
| 20 | |
| 21 | import java.util.Collection; |
| 22 | |
| 23 | /** |
| 24 | * Represents a filtering flow objective. Each filter is mapping |
| 25 | * from a criterion to a collection of criteria. The mapping will |
| 26 | * be used by a device driver to construct the actual flow rules to |
| 27 | * be installed on the device. |
| 28 | */ |
| 29 | public interface FilteringObjective extends Objective { |
| 30 | |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame^] | 31 | enum Type { |
| 32 | /** |
| 33 | * Enables the filtering condition. |
| 34 | */ |
| 35 | PERMIT, |
| 36 | |
| 37 | /** |
| 38 | * Disables the filtering condition. |
| 39 | */ |
| 40 | DENY |
| 41 | } |
| 42 | |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 43 | /** |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame^] | 44 | * Obtain this filtering type. |
| 45 | * @return the type |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 46 | */ |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame^] | 47 | public Type type(); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * The set of conditions the filter must provision at the device. |
| 51 | * |
| 52 | * @return a collection of criteria |
| 53 | */ |
| 54 | Collection<Criterion> conditions(); |
| 55 | |
| 56 | /** |
| 57 | * Builder of Filtering objective entities. |
| 58 | */ |
| 59 | public interface Builder extends Objective.Builder { |
| 60 | |
| 61 | /** |
| 62 | * Add a filtering condition. |
| 63 | * |
| 64 | * @param criterion new criterion |
| 65 | * @return a filtering builder |
| 66 | */ |
| 67 | public Builder addCondition(Criterion criterion); |
| 68 | |
| 69 | /** |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame^] | 70 | * Permit this filtering condition set. |
| 71 | * @return a filtering builder |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 72 | */ |
alshabib | 910aff1 | 2015-04-09 16:55:57 -0700 | [diff] [blame^] | 73 | public Builder permit(); |
| 74 | |
| 75 | /** |
| 76 | * Deny this filtering condition set. |
| 77 | * @return a filtering builder |
| 78 | */ |
| 79 | public Builder deny(); |
| 80 | |
| 81 | /** |
| 82 | * Assigns an application id. |
| 83 | * @param appId an application id |
| 84 | * @return a filtering builder |
| 85 | */ |
| 86 | public Builder fromApp(ApplicationId appId); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * Builds the filtering objective that will be added. |
| 90 | * |
| 91 | * @return a filtering objective |
| 92 | */ |
| 93 | public FilteringObjective add(); |
| 94 | |
| 95 | /** |
| 96 | * Builds the filtering objective that will be removed. |
| 97 | * |
| 98 | * @return a filtering objective. |
| 99 | */ |
| 100 | public FilteringObjective remove(); |
| 101 | |
| 102 | |
| 103 | } |
| 104 | |
| 105 | } |