blob: 1350d7a1c79afd5593ab1fd55e13e4c37dd1b1c3 [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;
alshabib2a441c62015-04-13 18:39:38 -070019import org.onosproject.core.ApplicationId;
alshabibfaa1e362015-04-02 15:01:54 -070020import org.onosproject.net.flow.TrafficTreatment;
21
22import java.util.Collection;
23
24/**
25 * Represents a nexthop which will be translated by a driver
26 * into the appropriate group or actions needed to implement
alshabib9d9e3a32015-06-25 18:33:50 -070027 * the egress function.
28 *
Sho SHIMIZUfee286d2015-07-01 10:19:10 -070029 * A next objective is made up of a collection of traffic treatments
alshabib9d9e3a32015-06-25 18:33:50 -070030 * associated with a type. These types are:
31 *
32 * - Hashed
33 * - Broadcast
34 * - Failover
35 * - Simple
36 *
37 * These types will indicate to the driver what the intended behaviour is.
38 * For example, a broadcast next objective with a collection of output
39 * treatments will indicate to a driver that all output actions are expected
40 * to be executed simultaneously. The driver is then free to implement this
41 * as a group or a simple action list.
alshabibfaa1e362015-04-02 15:01:54 -070042 */
Thomas Vachuskaa9d491e2015-05-20 11:17:21 -070043@Beta
alshabibfaa1e362015-04-02 15:01:54 -070044public interface NextObjective extends Objective {
45
46 /**
47 * Represents the type of next phase to build.
48 */
49 enum Type {
50 /**
51 * A hashed packet processing.
52 */
53 HASHED,
54
55 /**
56 * Broadcast packet process.
57 */
58 BROADCAST,
59
60 /**
61 * Failover handling.
62 */
63 FAILOVER,
64
65 /**
66 * Simple processing. Could be a group or a treatment.
67 */
68 SIMPLE
69 }
70
71 /**
72 * The collection of treatments that need to be applied to a set of traffic.
73 *
74 * @return a collection of traffic treatments
75 */
76 Collection<TrafficTreatment> next();
77
78 /**
79 * The type of operation that will be applied to the traffic using the collection
80 * of treatments.
81 *
82 * @return a type
83 */
84 Type type();
85
86 /**
87 * A next step builder.
88 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070089 interface Builder extends Objective.Builder {
alshabibfaa1e362015-04-02 15:01:54 -070090
91 /**
92 * Specifies the id for this next objective.
93 *
94 * @param nextId an integer
95 * @return a next objective builder
96 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070097 Builder withId(int nextId);
alshabibfaa1e362015-04-02 15:01:54 -070098
99 /**
100 * Sets the type of next step.
101 *
102 * @param type a type
103 * @return a next step builder
104 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700105 Builder withType(Type type);
alshabibfaa1e362015-04-02 15:01:54 -0700106
107 /**
108 * Adds a treatment to this next step.
109 *
110 * @param treatment a traffic treatment
111 * @return a next step builder
112 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700113 Builder addTreatment(TrafficTreatment treatment);
alshabibfaa1e362015-04-02 15:01:54 -0700114
Ray Milkey810d6e72015-08-14 10:35:06 -0700115 /**
116 * Specifies the application which applied the filter.
117 *
118 * @param appId an application id
119 * @return an objective builder
120 */
alshabib2a441c62015-04-13 18:39:38 -0700121 @Override
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700122 Builder fromApp(ApplicationId appId);
alshabib2a441c62015-04-13 18:39:38 -0700123
alshabibfaa1e362015-04-02 15:01:54 -0700124 /**
Ray Milkey810d6e72015-08-14 10:35:06 -0700125 * Sets the priority for this objective.
126 *
127 * @param priority an integer
128 * @return an objective builder
129 */
130 @Override
131 Builder withPriority(int priority);
132
133 /**
alshabib2a441c62015-04-13 18:39:38 -0700134 * Builds the next objective that will be added.
alshabibfaa1e362015-04-02 15:01:54 -0700135 *
alshabib2a441c62015-04-13 18:39:38 -0700136 * @return a next objective
alshabibfaa1e362015-04-02 15:01:54 -0700137 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700138 NextObjective add();
alshabib2a441c62015-04-13 18:39:38 -0700139
140 /**
141 * Builds the next objective that will be removed.
142 *
143 * @return a next objective.
144 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700145 NextObjective remove();
alshabib2a441c62015-04-13 18:39:38 -0700146
147 /**
148 * Builds the next objective that will be added.
149 * The context will be used to notify the calling application.
150 *
151 * @param context an objective context
152 * @return a next objective
153 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700154 NextObjective add(ObjectiveContext context);
alshabib2a441c62015-04-13 18:39:38 -0700155
156 /**
157 * Builds the next objective that will be removed.
158 * The context will be used to notify the calling application.
159 *
160 * @param context an objective context
161 * @return a next objective
162 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700163 NextObjective remove(ObjectiveContext context);
alshabibfaa1e362015-04-02 15:01:54 -0700164
165 }
166
167}