blob: 89b668de8d3c1e2dd9cd2e68d04027442d7aa509 [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
alshabib910aff12015-04-09 16:55:57 -070018import org.onosproject.core.ApplicationId;
alshabibfaa1e362015-04-02 15:01:54 -070019import org.onosproject.net.flow.criteria.Criterion;
20
21import 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 */
29public interface FilteringObjective extends Objective {
30
alshabib910aff12015-04-09 16:55:57 -070031 enum Type {
32 /**
33 * Enables the filtering condition.
34 */
35 PERMIT,
36
37 /**
38 * Disables the filtering condition.
39 */
40 DENY
41 }
42
alshabibfaa1e362015-04-02 15:01:54 -070043 /**
alshabiba3a476d2015-04-10 14:35:38 -070044 * Obtain the key for this filter.
45 *
46 * @return a criterion
47 */
48 public Criterion key();
49
50 /**
alshabib910aff12015-04-09 16:55:57 -070051 * Obtain this filtering type.
52 * @return the type
alshabibfaa1e362015-04-02 15:01:54 -070053 */
alshabib910aff12015-04-09 16:55:57 -070054 public Type type();
alshabibfaa1e362015-04-02 15:01:54 -070055
56 /**
57 * The set of conditions the filter must provision at the device.
58 *
59 * @return a collection of criteria
60 */
61 Collection<Criterion> conditions();
62
63 /**
64 * Builder of Filtering objective entities.
65 */
66 public interface Builder extends Objective.Builder {
67
68 /**
alshabiba3a476d2015-04-10 14:35:38 -070069 * Specify the key for the filter.
70 *
71 * @param key a criterion
72 * @return a filter objective builder
73 */
74 public Builder withKey(Criterion key);
75
76 /**
alshabibfaa1e362015-04-02 15:01:54 -070077 * Add a filtering condition.
78 *
79 * @param criterion new criterion
80 * @return a filtering builder
81 */
82 public Builder addCondition(Criterion criterion);
83
84 /**
alshabib910aff12015-04-09 16:55:57 -070085 * Permit this filtering condition set.
86 * @return a filtering builder
alshabibfaa1e362015-04-02 15:01:54 -070087 */
alshabib910aff12015-04-09 16:55:57 -070088 public Builder permit();
89
90 /**
91 * Deny this filtering condition set.
92 * @return a filtering builder
93 */
94 public Builder deny();
95
96 /**
97 * Assigns an application id.
98 * @param appId an application id
99 * @return a filtering builder
100 */
101 public Builder fromApp(ApplicationId appId);
alshabibfaa1e362015-04-02 15:01:54 -0700102
103 /**
104 * Builds the filtering objective that will be added.
105 *
106 * @return a filtering objective
107 */
108 public FilteringObjective add();
109
110 /**
111 * Builds the filtering objective that will be removed.
112 *
113 * @return a filtering objective.
114 */
115 public FilteringObjective remove();
116
alshabib2a441c62015-04-13 18:39:38 -0700117 /**
118 * Builds the filtering objective that will be added.
119 * The context will be used to notify the calling application.
120 *
121 * @param context an objective context
122 * @return a filtering objective
123 */
124 public FilteringObjective add(ObjectiveContext context);
125
126 /**
127 * Builds the filtering objective that will be removed.
128 * The context will be used to notify the calling application.
129 *
130 * @param context an objective context
131 * @return a filtering objective
132 */
133 public FilteringObjective remove(ObjectiveContext context);
134
alshabibfaa1e362015-04-02 15:01:54 -0700135
136 }
137
138}