blob: c941aa0b1e34d24927f649b3339bfb144d720644 [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;
alshabibfaa1e362015-04-02 15:01:54 -070019import org.onosproject.net.flow.TrafficSelector;
20import org.onosproject.net.flow.TrafficTreatment;
21
22/**
23 * Represents a description of which types of traffic need to
24 * be forwarded through the device. A forwarding objective may
25 * in multiple rules at the device.
26 */
Thomas Vachuskaa9d491e2015-05-20 11:17:21 -070027@Beta
alshabibfaa1e362015-04-02 15:01:54 -070028public interface ForwardingObjective extends Objective {
29
30 /**
31 * Represents whether this objective is monolithic or
32 * may be broken down into parts.
33 */
34 enum Flag {
35 /**
36 * A decomposable objective.
37 */
38 SPECIFIC,
39
40 /**
41 * A monolithic objective.
42 */
43 VERSATILE
44 }
45
46 /**
47 * Obtain the selector for this objective.
48 *
49 * @return a traffic selector
50 */
51 TrafficSelector selector();
52
53 /**
54 * Obtain the traffic treatment for this objective. Mutually exclusive with
55 * 'treatment'.
56 *
57 * @return an integer
58 */
59 Integer nextId();
60
61 /**
62 * A traffic treatment for this forwarding objective. Mutually exclusive
63 * with a nextId.
64 *
65 * @return a traffic treatment
66 */
67 TrafficTreatment treatment();
68
69 /**
70 * Obtain the type of this objective.
71 *
72 * @return a flag type
73 */
74 Flag flag();
75
76 /**
77 * A forwarding objective builder.
78 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070079 interface Builder extends Objective.Builder {
alshabibfaa1e362015-04-02 15:01:54 -070080
81 /**
82 * Assigns a selector to the forwarding objective.
83 *
84 * @param selector a traffic selector
85 * @return a forwarding objective builder
86 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070087 Builder withSelector(TrafficSelector selector);
alshabibfaa1e362015-04-02 15:01:54 -070088
89 /**
90 * Assigns a next step to the forwarding objective.
91 *
92 * @param nextId a next objective id.
93 * @return a forwarding objective builder
94 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070095 Builder nextStep(int nextId);
alshabibfaa1e362015-04-02 15:01:54 -070096
97 /**
98 * Assigns the treatment for this forwarding objective.
99 *
100 * @param treatment a traffic treatment
101 * @return a forwarding objective
102 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700103 Builder withTreatment(TrafficTreatment treatment);
alshabibfaa1e362015-04-02 15:01:54 -0700104
105 /**
106 * Assigns the flag to the forwarding objective.
107 *
108 * @param flag a flag
109 * @return a forwarding objective builder
110 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700111 Builder withFlag(Flag flag);
alshabibfaa1e362015-04-02 15:01:54 -0700112
113 /**
114 * Builds the forwarding objective that will be added.
115 *
116 * @return a forwarding objective
117 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700118 ForwardingObjective add();
alshabibfaa1e362015-04-02 15:01:54 -0700119
120 /**
121 * Builds the forwarding objective that will be removed.
122 *
123 * @return a forwarding objective.
124 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700125 ForwardingObjective remove();
alshabib2a441c62015-04-13 18:39:38 -0700126
127 /**
128 * Builds the forwarding objective that will be added.
129 * The context will be used to notify the calling application.
130 *
131 * @param context an objective context
132 * @return a forwarding objective
133 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700134 ForwardingObjective add(ObjectiveContext context);
alshabib2a441c62015-04-13 18:39:38 -0700135
136 /**
137 * Builds the forwarding objective that will be removed.
138 * The context will be used to notify the calling application.
139 *
140 * @param context an objective context
141 * @return a forwarding objective
142 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700143 ForwardingObjective remove(ObjectiveContext context);
alshabibfaa1e362015-04-02 15:01:54 -0700144 }
145}