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 | |
| 18 | import org.onosproject.net.flow.TrafficTreatment; |
| 19 | |
| 20 | import java.util.Collection; |
| 21 | |
| 22 | /** |
| 23 | * Represents a nexthop which will be translated by a driver |
| 24 | * into the appropriate group or actions needed to implement |
| 25 | * the function. |
| 26 | */ |
| 27 | public interface NextObjective extends Objective { |
| 28 | |
| 29 | /** |
| 30 | * Represents the type of next phase to build. |
| 31 | */ |
| 32 | enum Type { |
| 33 | /** |
| 34 | * A hashed packet processing. |
| 35 | */ |
| 36 | HASHED, |
| 37 | |
| 38 | /** |
| 39 | * Broadcast packet process. |
| 40 | */ |
| 41 | BROADCAST, |
| 42 | |
| 43 | /** |
| 44 | * Failover handling. |
| 45 | */ |
| 46 | FAILOVER, |
| 47 | |
| 48 | /** |
| 49 | * Simple processing. Could be a group or a treatment. |
| 50 | */ |
| 51 | SIMPLE |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * The collection of treatments that need to be applied to a set of traffic. |
| 56 | * |
| 57 | * @return a collection of traffic treatments |
| 58 | */ |
| 59 | Collection<TrafficTreatment> next(); |
| 60 | |
| 61 | /** |
| 62 | * The type of operation that will be applied to the traffic using the collection |
| 63 | * of treatments. |
| 64 | * |
| 65 | * @return a type |
| 66 | */ |
| 67 | Type type(); |
| 68 | |
| 69 | /** |
| 70 | * A next step builder. |
| 71 | */ |
| 72 | public interface Builder extends Objective.Builder { |
| 73 | |
| 74 | /** |
| 75 | * Specifies the id for this next objective. |
| 76 | * |
| 77 | * @param nextId an integer |
| 78 | * @return a next objective builder |
| 79 | */ |
| 80 | public Builder withId(int nextId); |
| 81 | |
| 82 | /** |
| 83 | * Sets the type of next step. |
| 84 | * |
| 85 | * @param type a type |
| 86 | * @return a next step builder |
| 87 | */ |
| 88 | public Builder withType(Type type); |
| 89 | |
| 90 | /** |
| 91 | * Adds a treatment to this next step. |
| 92 | * |
| 93 | * @param treatment a traffic treatment |
| 94 | * @return a next step builder |
| 95 | */ |
| 96 | public Builder addTreatment(TrafficTreatment treatment); |
| 97 | |
| 98 | /** |
| 99 | * Builds a next step. |
| 100 | * |
| 101 | * @return a next step |
| 102 | */ |
| 103 | public NextObjective build(); |
| 104 | |
| 105 | } |
| 106 | |
| 107 | } |