blob: 0eee0f46b843adc5efb8bcd9084772d25acb0f94 [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 *
29 * A next objective is made up of a collection of traffic treatements
30 * 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
alshabib2a441c62015-04-13 18:39:38 -0700115 @Override
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700116 Builder fromApp(ApplicationId appId);
alshabib2a441c62015-04-13 18:39:38 -0700117
alshabibfaa1e362015-04-02 15:01:54 -0700118 /**
alshabib2a441c62015-04-13 18:39:38 -0700119 * Builds the next objective that will be added.
alshabibfaa1e362015-04-02 15:01:54 -0700120 *
alshabib2a441c62015-04-13 18:39:38 -0700121 * @return a next objective
alshabibfaa1e362015-04-02 15:01:54 -0700122 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700123 NextObjective add();
alshabib2a441c62015-04-13 18:39:38 -0700124
125 /**
126 * Builds the next objective that will be removed.
127 *
128 * @return a next objective.
129 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700130 NextObjective remove();
alshabib2a441c62015-04-13 18:39:38 -0700131
132 /**
133 * Builds the next objective that will be added.
134 * The context will be used to notify the calling application.
135 *
136 * @param context an objective context
137 * @return a next objective
138 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700139 NextObjective add(ObjectiveContext context);
alshabib2a441c62015-04-13 18:39:38 -0700140
141 /**
142 * Builds the next objective that will be removed.
143 * The context will be used to notify the calling application.
144 *
145 * @param context an objective context
146 * @return a next objective
147 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700148 NextObjective remove(ObjectiveContext context);
alshabibfaa1e362015-04-02 15:01:54 -0700149
150 }
151
152}