blob: 24ca2dc43390d183b78afc326f9f3b6b06a4e641 [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 /**
alshabib910aff12015-04-09 16:55:57 -070044 * Obtain this filtering type.
45 * @return the type
alshabibfaa1e362015-04-02 15:01:54 -070046 */
alshabib910aff12015-04-09 16:55:57 -070047 public Type type();
alshabibfaa1e362015-04-02 15:01:54 -070048
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 /**
alshabib910aff12015-04-09 16:55:57 -070070 * Permit this filtering condition set.
71 * @return a filtering builder
alshabibfaa1e362015-04-02 15:01:54 -070072 */
alshabib910aff12015-04-09 16:55:57 -070073 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);
alshabibfaa1e362015-04-02 15:01:54 -070087
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}