blob: 3971b03c0a2eea60457e259b6296ed35419bbc1a [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.core.ApplicationId;
19
20/**
21 * Base representation of an flow description.
22 */
23public interface Objective {
24
25 static final boolean DEFAULT_PERMANENT = true;
26 static final int DEFAULT_TIMEOUT = 0;
27 static final int DEFAULT_PRIORITY = 32768;
28
29 /**
30 * Type of operation.
31 */
32 enum Operation {
33 /**
34 * Adds the objective.
35 */
36 ADD,
37
38 /**
39 * Removes the objective.
40 */
41 REMOVE
42 }
43
44 /**
45 * An identifier for this objective.
46 *
47 * @return an integer
48 */
49 int id();
50
51 /**
52 * The priority for this objective.
53 *
54 * @return an integer
55 */
56 int priority();
57
58 /**
59 * The application which applied this objective.
60 *
61 * @return an application id
62 */
63 ApplicationId appId();
64
65 /**
66 * The timeout for this objective.
67 *
68 * @return an integer
69 */
70 int timeout();
71
72 /**
73 * Whether this objective is permanent.
74 *
75 * @return a boolean
76 */
77 boolean permanent();
78
79 /**
80 * The type of operation for this objective.
81 *
82 * @return an operation
83 */
84 Operation op();
85
86 /**
87 * An objective builder.
88 */
89 public interface Builder {
90 /**
91 * Makes the filtering objective temporary.
92 *
93 * @param timeout a timeout
94 * @return an objective builder
95 */
96 public Builder makeTemporary(int timeout);
97
98 /**
99 * Makes the filtering objective permanent.
100 *
101 * @return an objective builder
102 */
103 public Builder makePermanent();
104
105 /**
106 * Specifies the application which applied the filter.
107 *
108 * @param appId an application id
109 * @return an objective builder
110 */
111 public Builder fromApp(ApplicationId appId);
112
113 /**
114 * Sets the priority for this objective.
115 *
116 * @param priority an integer
117 * @return an objective builder
118 */
119 public Builder withPriority(int priority);
120 }
121
122}