blob: f082db4b75673627258e4390dad66083566a2aea [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska83e090e2014-10-22 14:25:35 -070015 */
tom8bb16062014-09-12 14:47:46 -070016package org.onlab.onos.net.flow;
17
18import org.onlab.onos.net.DeviceId;
19
tom8bb16062014-09-12 14:47:46 -070020/**
21 * Represents a generalized match & action pair to be applied to
22 * an infrastucture device.
23 */
alshabib902d41b2014-10-07 16:52:05 -070024public interface FlowRule extends BatchOperationTarget {
tom8bb16062014-09-12 14:47:46 -070025
alshabibba5ac482014-10-02 17:15:20 -070026 static final int MAX_TIMEOUT = 60;
alshabiba0e04982014-10-03 13:03:19 -070027 static final int MIN_PRIORITY = 0;
alshabiba7f7ca82014-09-22 11:41:23 -070028
alshabib369d2942014-09-12 17:59:35 -070029 //TODO: build cookie value
Ayaka Koshibed4e53e12014-09-18 14:24:55 -070030 /**
31 * Returns the ID of this flow.
32 *
33 * @return the flow ID
34 */
35 FlowId id();
alshabib369d2942014-09-12 17:59:35 -070036
tom8bb16062014-09-12 14:47:46 -070037 /**
alshabiba68eb962014-09-24 20:34:13 -070038 * Returns the application id of this flow.
39 *
40 * @return an applicationId
41 */
alshabib92c65ad2014-10-08 21:56:05 -070042 short appId();
alshabiba68eb962014-09-24 20:34:13 -070043
44 /**
tom8bb16062014-09-12 14:47:46 -070045 * Returns the flow rule priority given in natural order; higher numbers
46 * mean higher priorities.
47 *
48 * @return flow rule priority
49 */
50 int priority();
51
52 /**
53 * Returns the identity of the device where this rule applies.
54 *
55 * @return device identifier
56 */
57 DeviceId deviceId();
58
59 /**
60 * Returns the traffic selector that identifies what traffic this
61 * rule should apply to.
62 *
63 * @return traffic selector
64 */
65 TrafficSelector selector();
66
67 /**
68 * Returns the traffic treatment that applies to selected traffic.
69 *
70 * @return traffic treatment
71 */
alshabib369d2942014-09-12 17:59:35 -070072 TrafficTreatment treatment();
tom8bb16062014-09-12 14:47:46 -070073
Ayaka Koshibed4e53e12014-09-18 14:24:55 -070074 /**
alshabibba5ac482014-10-02 17:15:20 -070075 * Returns the timeout for this flow requested by an application.
Jonathan Hartbc4a7932014-10-21 11:46:00 -070076 *
alshabibba5ac482014-10-02 17:15:20 -070077 * @return integer value of the timeout
alshabib6eb438a2014-10-01 16:39:37 -070078 */
alshabibba5ac482014-10-02 17:15:20 -070079 int timeout();
alshabib6eb438a2014-10-01 16:39:37 -070080
Jonathan Hartbc4a7932014-10-21 11:46:00 -070081 /**
82 * Returns whether the flow is permanent i.e. does not time out.
83 *
84 * @return true if the flow is permanent, otherwise false
85 */
86 boolean isPermanent();
87
tom8bb16062014-09-12 14:47:46 -070088}