blob: 718edfeda66f50777595ada1d3a9ba1708cc260a [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
tom8bb16062014-09-12 14:47:46 -070019package org.onlab.onos.net.flow;
20
21import org.onlab.onos.net.DeviceId;
22
tom8bb16062014-09-12 14:47:46 -070023/**
24 * Represents a generalized match & action pair to be applied to
25 * an infrastucture device.
26 */
alshabib902d41b2014-10-07 16:52:05 -070027public interface FlowRule extends BatchOperationTarget {
tom8bb16062014-09-12 14:47:46 -070028
alshabibba5ac482014-10-02 17:15:20 -070029 static final int MAX_TIMEOUT = 60;
alshabiba0e04982014-10-03 13:03:19 -070030 static final int MIN_PRIORITY = 0;
alshabiba7f7ca82014-09-22 11:41:23 -070031
alshabib369d2942014-09-12 17:59:35 -070032 //TODO: build cookie value
Ayaka Koshibed4e53e12014-09-18 14:24:55 -070033 /**
34 * Returns the ID of this flow.
35 *
36 * @return the flow ID
37 */
38 FlowId id();
alshabib369d2942014-09-12 17:59:35 -070039
tom8bb16062014-09-12 14:47:46 -070040 /**
alshabiba68eb962014-09-24 20:34:13 -070041 * Returns the application id of this flow.
42 *
43 * @return an applicationId
44 */
alshabib92c65ad2014-10-08 21:56:05 -070045 short appId();
alshabiba68eb962014-09-24 20:34:13 -070046
47 /**
tom8bb16062014-09-12 14:47:46 -070048 * Returns the flow rule priority given in natural order; higher numbers
49 * mean higher priorities.
50 *
51 * @return flow rule priority
52 */
53 int priority();
54
55 /**
56 * Returns the identity of the device where this rule applies.
57 *
58 * @return device identifier
59 */
60 DeviceId deviceId();
61
62 /**
63 * Returns the traffic selector that identifies what traffic this
64 * rule should apply to.
65 *
66 * @return traffic selector
67 */
68 TrafficSelector selector();
69
70 /**
71 * Returns the traffic treatment that applies to selected traffic.
72 *
73 * @return traffic treatment
74 */
alshabib369d2942014-09-12 17:59:35 -070075 TrafficTreatment treatment();
tom8bb16062014-09-12 14:47:46 -070076
Ayaka Koshibed4e53e12014-09-18 14:24:55 -070077 /**
alshabibba5ac482014-10-02 17:15:20 -070078 * Returns the timeout for this flow requested by an application.
Jonathan Hartbc4a7932014-10-21 11:46:00 -070079 *
alshabibba5ac482014-10-02 17:15:20 -070080 * @return integer value of the timeout
alshabib6eb438a2014-10-01 16:39:37 -070081 */
alshabibba5ac482014-10-02 17:15:20 -070082 int timeout();
alshabib6eb438a2014-10-01 16:39:37 -070083
Jonathan Hartbc4a7932014-10-21 11:46:00 -070084 /**
85 * Returns whether the flow is permanent i.e. does not time out.
86 *
87 * @return true if the flow is permanent, otherwise false
88 */
89 boolean isPermanent();
90
tom8bb16062014-09-12 14:47:46 -070091}