blob: 173ddfde8ba30501570085283cbc099a5a79b862 [file] [log] [blame]
alshabibfaa1e362015-04-02 15:01:54 -07001/*
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 */
16package org.onosproject.net.flowobjective;
17
Thomas Vachuskaa9d491e2015-05-20 11:17:21 -070018import com.google.common.annotations.Beta;
alshabib910aff12015-04-09 16:55:57 -070019import org.onosproject.core.ApplicationId;
alshabibfaa1e362015-04-02 15:01:54 -070020import org.onosproject.net.flow.criteria.Criterion;
21
22import java.util.Collection;
23
24/**
25 * Represents a filtering flow objective. Each filter is mapping
26 * from a criterion to a collection of criteria. The mapping will
27 * be used by a device driver to construct the actual flow rules to
28 * be installed on the device.
29 */
Thomas Vachuskaa9d491e2015-05-20 11:17:21 -070030@Beta
alshabibfaa1e362015-04-02 15:01:54 -070031public interface FilteringObjective extends Objective {
32
alshabib910aff12015-04-09 16:55:57 -070033 enum Type {
34 /**
35 * Enables the filtering condition.
36 */
37 PERMIT,
38
39 /**
40 * Disables the filtering condition.
41 */
42 DENY
43 }
44
alshabibfaa1e362015-04-02 15:01:54 -070045 /**
alshabiba3a476d2015-04-10 14:35:38 -070046 * Obtain the key for this filter.
47 *
48 * @return a criterion
49 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070050 Criterion key();
alshabiba3a476d2015-04-10 14:35:38 -070051
52 /**
alshabib910aff12015-04-09 16:55:57 -070053 * Obtain this filtering type.
54 * @return the type
alshabibfaa1e362015-04-02 15:01:54 -070055 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070056 Type type();
alshabibfaa1e362015-04-02 15:01:54 -070057
58 /**
59 * The set of conditions the filter must provision at the device.
60 *
61 * @return a collection of criteria
62 */
63 Collection<Criterion> conditions();
64
65 /**
66 * Builder of Filtering objective entities.
67 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070068 interface Builder extends Objective.Builder {
alshabibfaa1e362015-04-02 15:01:54 -070069
70 /**
alshabiba3a476d2015-04-10 14:35:38 -070071 * Specify the key for the filter.
72 *
73 * @param key a criterion
74 * @return a filter objective builder
75 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070076 Builder withKey(Criterion key);
alshabiba3a476d2015-04-10 14:35:38 -070077
78 /**
alshabibfaa1e362015-04-02 15:01:54 -070079 * Add a filtering condition.
80 *
81 * @param criterion new criterion
82 * @return a filtering builder
83 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070084 Builder addCondition(Criterion criterion);
alshabibfaa1e362015-04-02 15:01:54 -070085
86 /**
alshabib910aff12015-04-09 16:55:57 -070087 * Permit this filtering condition set.
88 * @return a filtering builder
alshabibfaa1e362015-04-02 15:01:54 -070089 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070090 Builder permit();
alshabib910aff12015-04-09 16:55:57 -070091
92 /**
93 * Deny this filtering condition set.
94 * @return a filtering builder
95 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070096 Builder deny();
alshabib910aff12015-04-09 16:55:57 -070097
98 /**
99 * Assigns an application id.
100 * @param appId an application id
101 * @return a filtering builder
102 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700103 Builder fromApp(ApplicationId appId);
alshabibfaa1e362015-04-02 15:01:54 -0700104
105 /**
106 * Builds the filtering objective that will be added.
107 *
108 * @return a filtering objective
109 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700110 FilteringObjective add();
alshabibfaa1e362015-04-02 15:01:54 -0700111
112 /**
113 * Builds the filtering objective that will be removed.
114 *
115 * @return a filtering objective.
116 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700117 FilteringObjective remove();
alshabibfaa1e362015-04-02 15:01:54 -0700118
alshabib2a441c62015-04-13 18:39:38 -0700119 /**
120 * Builds the filtering objective that will be added.
121 * The context will be used to notify the calling application.
122 *
123 * @param context an objective context
124 * @return a filtering objective
125 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700126 FilteringObjective add(ObjectiveContext context);
alshabib2a441c62015-04-13 18:39:38 -0700127
128 /**
129 * Builds the filtering objective that will be removed.
130 * The context will be used to notify the calling application.
131 *
132 * @param context an objective context
133 * @return a filtering objective
134 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700135 FilteringObjective remove(ObjectiveContext context);
alshabib2a441c62015-04-13 18:39:38 -0700136
alshabibfaa1e362015-04-02 15:01:54 -0700137
138 }
139
140}