alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.net.flowobjective; |
| 17 | |
Thomas Vachuska | a9d491e | 2015-05-20 11:17:21 -0700 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 19 | import org.onosproject.core.ApplicationId; |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 20 | import org.onosproject.net.flow.TrafficTreatment; |
| 21 | |
| 22 | import 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 Vachuska | a9d491e | 2015-05-20 11:17:21 -0700 | [diff] [blame] | 29 | @Beta |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 30 | public 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 SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 75 | interface Builder extends Objective.Builder { |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * Specifies the id for this next objective. |
| 79 | * |
| 80 | * @param nextId an integer |
| 81 | * @return a next objective builder |
| 82 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 83 | Builder withId(int nextId); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 84 | |
| 85 | /** |
| 86 | * Sets the type of next step. |
| 87 | * |
| 88 | * @param type a type |
| 89 | * @return a next step builder |
| 90 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 91 | Builder withType(Type type); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
| 94 | * Adds a treatment to this next step. |
| 95 | * |
| 96 | * @param treatment a traffic treatment |
| 97 | * @return a next step builder |
| 98 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 99 | Builder addTreatment(TrafficTreatment treatment); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 100 | |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 101 | @Override |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 102 | Builder fromApp(ApplicationId appId); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 103 | |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 104 | /** |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 105 | * Builds the next objective that will be added. |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 106 | * |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 107 | * @return a next objective |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 108 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 109 | NextObjective add(); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 110 | |
| 111 | /** |
| 112 | * Builds the next objective that will be removed. |
| 113 | * |
| 114 | * @return a next objective. |
| 115 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 116 | NextObjective remove(); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 117 | |
| 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 SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 125 | NextObjective add(ObjectiveContext context); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 126 | |
| 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 SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 134 | NextObjective remove(ObjectiveContext context); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 135 | |
| 136 | } |
| 137 | |
| 138 | } |