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.TrafficSelector; |
| 19 | import org.onosproject.net.flow.TrafficTreatment; |
| 20 | |
| 21 | /** |
| 22 | * Represents a description of which types of traffic need to |
| 23 | * be forwarded through the device. A forwarding objective may |
| 24 | * in multiple rules at the device. |
| 25 | */ |
| 26 | public interface ForwardingObjective extends Objective { |
| 27 | |
| 28 | /** |
| 29 | * Represents whether this objective is monolithic or |
| 30 | * may be broken down into parts. |
| 31 | */ |
| 32 | enum Flag { |
| 33 | /** |
| 34 | * A decomposable objective. |
| 35 | */ |
| 36 | SPECIFIC, |
| 37 | |
| 38 | /** |
| 39 | * A monolithic objective. |
| 40 | */ |
| 41 | VERSATILE |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Obtain the selector for this objective. |
| 46 | * |
| 47 | * @return a traffic selector |
| 48 | */ |
| 49 | TrafficSelector selector(); |
| 50 | |
| 51 | /** |
| 52 | * Obtain the traffic treatment for this objective. Mutually exclusive with |
| 53 | * 'treatment'. |
| 54 | * |
| 55 | * @return an integer |
| 56 | */ |
| 57 | Integer nextId(); |
| 58 | |
| 59 | /** |
| 60 | * A traffic treatment for this forwarding objective. Mutually exclusive |
| 61 | * with a nextId. |
| 62 | * |
| 63 | * @return a traffic treatment |
| 64 | */ |
| 65 | TrafficTreatment treatment(); |
| 66 | |
| 67 | /** |
| 68 | * Obtain the type of this objective. |
| 69 | * |
| 70 | * @return a flag type |
| 71 | */ |
| 72 | Flag flag(); |
| 73 | |
| 74 | /** |
| 75 | * A forwarding objective builder. |
| 76 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 77 | interface Builder extends Objective.Builder { |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 78 | |
| 79 | /** |
| 80 | * Assigns a selector to the forwarding objective. |
| 81 | * |
| 82 | * @param selector a traffic selector |
| 83 | * @return a forwarding objective builder |
| 84 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 85 | Builder withSelector(TrafficSelector selector); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * Assigns a next step to the forwarding objective. |
| 89 | * |
| 90 | * @param nextId a next objective id. |
| 91 | * @return a forwarding objective builder |
| 92 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 93 | Builder nextStep(int nextId); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 94 | |
| 95 | /** |
| 96 | * Assigns the treatment for this forwarding objective. |
| 97 | * |
| 98 | * @param treatment a traffic treatment |
| 99 | * @return a forwarding objective |
| 100 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 101 | Builder withTreatment(TrafficTreatment treatment); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 102 | |
| 103 | /** |
| 104 | * Assigns the flag to the forwarding objective. |
| 105 | * |
| 106 | * @param flag a flag |
| 107 | * @return a forwarding objective builder |
| 108 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 109 | Builder withFlag(Flag flag); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 110 | |
| 111 | /** |
| 112 | * Builds the forwarding objective that will be added. |
| 113 | * |
| 114 | * @return a forwarding objective |
| 115 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 116 | ForwardingObjective add(); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 117 | |
| 118 | /** |
| 119 | * Builds the forwarding objective that will be removed. |
| 120 | * |
| 121 | * @return a forwarding objective. |
| 122 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 123 | ForwardingObjective remove(); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 124 | |
| 125 | /** |
| 126 | * Builds the forwarding objective that will be added. |
| 127 | * The context will be used to notify the calling application. |
| 128 | * |
| 129 | * @param context an objective context |
| 130 | * @return a forwarding objective |
| 131 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 132 | ForwardingObjective add(ObjectiveContext context); |
alshabib | 2a441c6 | 2015-04-13 18:39:38 -0700 | [diff] [blame] | 133 | |
| 134 | /** |
| 135 | * Builds the forwarding objective that will be removed. |
| 136 | * The context will be used to notify the calling application. |
| 137 | * |
| 138 | * @param context an objective context |
| 139 | * @return a forwarding objective |
| 140 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame^] | 141 | ForwardingObjective remove(ObjectiveContext context); |
alshabib | faa1e36 | 2015-04-02 15:01:54 -0700 | [diff] [blame] | 142 | } |
| 143 | } |