blob: dcc377fec7a42d340ed5deb73c6665df728bcbd2 [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
18import org.onosproject.net.flow.TrafficSelector;
19import 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 */
26public 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 */
77 public interface Builder extends Objective.Builder {
78
79 /**
80 * Assigns a selector to the forwarding objective.
81 *
82 * @param selector a traffic selector
83 * @return a forwarding objective builder
84 */
85 public Builder withSelector(TrafficSelector selector);
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 */
93 public Builder nextStep(int nextId);
94
95 /**
96 * Assigns the treatment for this forwarding objective.
97 *
98 * @param treatment a traffic treatment
99 * @return a forwarding objective
100 */
101 public Builder withTreatment(TrafficTreatment treatment);
102
103 /**
104 * Assigns the flag to the forwarding objective.
105 *
106 * @param flag a flag
107 * @return a forwarding objective builder
108 */
109 public Builder withFlag(Flag flag);
110
111 /**
112 * Builds the forwarding objective that will be added.
113 *
114 * @return a forwarding objective
115 */
116 public ForwardingObjective add();
117
118 /**
119 * Builds the forwarding objective that will be removed.
120 *
121 * @return a forwarding objective.
122 */
123 public ForwardingObjective remove();
alshabib2a441c62015-04-13 18:39:38 -0700124
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 */
132 public ForwardingObjective add(ObjectiveContext context);
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 */
141 public ForwardingObjective remove(ObjectiveContext context);
alshabibfaa1e362015-04-02 15:01:54 -0700142 }
143}