blob: 2971883f775f82d32f8545255c63353132b71d5d [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
27 * the function.
28 */
Thomas Vachuskaa9d491e2015-05-20 11:17:21 -070029@Beta
alshabibfaa1e362015-04-02 15:01:54 -070030public interface NextObjective extends Objective {
31
32 /**
33 * Represents the type of next phase to build.
34 */
35 enum Type {
36 /**
37 * A hashed packet processing.
38 */
39 HASHED,
40
41 /**
42 * Broadcast packet process.
43 */
44 BROADCAST,
45
46 /**
47 * Failover handling.
48 */
49 FAILOVER,
50
51 /**
52 * Simple processing. Could be a group or a treatment.
53 */
54 SIMPLE
55 }
56
57 /**
58 * The collection of treatments that need to be applied to a set of traffic.
59 *
60 * @return a collection of traffic treatments
61 */
62 Collection<TrafficTreatment> next();
63
64 /**
65 * The type of operation that will be applied to the traffic using the collection
66 * of treatments.
67 *
68 * @return a type
69 */
70 Type type();
71
72 /**
73 * A next step builder.
74 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070075 interface Builder extends Objective.Builder {
alshabibfaa1e362015-04-02 15:01:54 -070076
77 /**
78 * Specifies the id for this next objective.
79 *
80 * @param nextId an integer
81 * @return a next objective builder
82 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070083 Builder withId(int nextId);
alshabibfaa1e362015-04-02 15:01:54 -070084
85 /**
86 * Sets the type of next step.
87 *
88 * @param type a type
89 * @return a next step builder
90 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070091 Builder withType(Type type);
alshabibfaa1e362015-04-02 15:01:54 -070092
93 /**
94 * Adds a treatment to this next step.
95 *
96 * @param treatment a traffic treatment
97 * @return a next step builder
98 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070099 Builder addTreatment(TrafficTreatment treatment);
alshabibfaa1e362015-04-02 15:01:54 -0700100
alshabib2a441c62015-04-13 18:39:38 -0700101 @Override
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700102 Builder fromApp(ApplicationId appId);
alshabib2a441c62015-04-13 18:39:38 -0700103
alshabibfaa1e362015-04-02 15:01:54 -0700104 /**
alshabib2a441c62015-04-13 18:39:38 -0700105 * Builds the next objective that will be added.
alshabibfaa1e362015-04-02 15:01:54 -0700106 *
alshabib2a441c62015-04-13 18:39:38 -0700107 * @return a next objective
alshabibfaa1e362015-04-02 15:01:54 -0700108 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700109 NextObjective add();
alshabib2a441c62015-04-13 18:39:38 -0700110
111 /**
112 * Builds the next objective that will be removed.
113 *
114 * @return a next objective.
115 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700116 NextObjective remove();
alshabib2a441c62015-04-13 18:39:38 -0700117
118 /**
119 * Builds the next objective that will be added.
120 * The context will be used to notify the calling application.
121 *
122 * @param context an objective context
123 * @return a next objective
124 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700125 NextObjective add(ObjectiveContext context);
alshabib2a441c62015-04-13 18:39:38 -0700126
127 /**
128 * Builds the next objective that will be removed.
129 * The context will be used to notify the calling application.
130 *
131 * @param context an objective context
132 * @return a next objective
133 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -0700134 NextObjective remove(ObjectiveContext context);
alshabibfaa1e362015-04-02 15:01:54 -0700135
136 }
137
138}