blob: 02c4d9e747f39255d99713fdcd4ebfb7f5aec181 [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
alshabib2a441c62015-04-13 18:39:38 -070018import org.onosproject.core.ApplicationId;
alshabibfaa1e362015-04-02 15:01:54 -070019import org.onosproject.net.flow.TrafficTreatment;
20
21import java.util.Collection;
22
23/**
24 * Represents a nexthop which will be translated by a driver
25 * into the appropriate group or actions needed to implement
26 * the function.
27 */
28public interface NextObjective extends Objective {
29
30 /**
31 * Represents the type of next phase to build.
32 */
33 enum Type {
34 /**
35 * A hashed packet processing.
36 */
37 HASHED,
38
39 /**
40 * Broadcast packet process.
41 */
42 BROADCAST,
43
44 /**
45 * Failover handling.
46 */
47 FAILOVER,
48
49 /**
50 * Simple processing. Could be a group or a treatment.
51 */
52 SIMPLE
53 }
54
55 /**
56 * The collection of treatments that need to be applied to a set of traffic.
57 *
58 * @return a collection of traffic treatments
59 */
60 Collection<TrafficTreatment> next();
61
62 /**
63 * The type of operation that will be applied to the traffic using the collection
64 * of treatments.
65 *
66 * @return a type
67 */
68 Type type();
69
70 /**
71 * A next step builder.
72 */
73 public interface Builder extends Objective.Builder {
74
75 /**
76 * Specifies the id for this next objective.
77 *
78 * @param nextId an integer
79 * @return a next objective builder
80 */
81 public Builder withId(int nextId);
82
83 /**
84 * Sets the type of next step.
85 *
86 * @param type a type
87 * @return a next step builder
88 */
89 public Builder withType(Type type);
90
91 /**
92 * Adds a treatment to this next step.
93 *
94 * @param treatment a traffic treatment
95 * @return a next step builder
96 */
97 public Builder addTreatment(TrafficTreatment treatment);
98
alshabib2a441c62015-04-13 18:39:38 -070099 @Override
100 public Builder fromApp(ApplicationId appId);
101
alshabibfaa1e362015-04-02 15:01:54 -0700102 /**
alshabib2a441c62015-04-13 18:39:38 -0700103 * Builds the next objective that will be added.
alshabibfaa1e362015-04-02 15:01:54 -0700104 *
alshabib2a441c62015-04-13 18:39:38 -0700105 * @return a next objective
alshabibfaa1e362015-04-02 15:01:54 -0700106 */
alshabib2a441c62015-04-13 18:39:38 -0700107 public NextObjective add();
108
109 /**
110 * Builds the next objective that will be removed.
111 *
112 * @return a next objective.
113 */
114 public NextObjective remove();
115
116 /**
117 * Builds the next objective that will be added.
118 * The context will be used to notify the calling application.
119 *
120 * @param context an objective context
121 * @return a next objective
122 */
123 public NextObjective add(ObjectiveContext context);
124
125 /**
126 * Builds the next objective that will be removed.
127 * The context will be used to notify the calling application.
128 *
129 * @param context an objective context
130 * @return a next objective
131 */
132 public NextObjective remove(ObjectiveContext context);
alshabibfaa1e362015-04-02 15:01:54 -0700133
134 }
135
136}