blob: 53aff494dfa1c4663dc461a36d08b2578b6a9eeb [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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.flow;
tom8bb16062014-09-12 14:47:46 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.core.GroupId;
19import org.onosproject.net.DeviceId;
tom8bb16062014-09-12 14:47:46 -070020
tom8bb16062014-09-12 14:47:46 -070021/**
22 * Represents a generalized match & action pair to be applied to
Sho SHIMIZUa19a2e52014-11-17 11:08:19 -080023 * an infrastructure device.
tom8bb16062014-09-12 14:47:46 -070024 */
Sho SHIMIZU5e5d4aa2015-01-26 16:12:11 -080025public interface FlowRule {
tom8bb16062014-09-12 14:47:46 -070026
alshabibba5ac482014-10-02 17:15:20 -070027 static final int MAX_TIMEOUT = 60;
alshabiba0e04982014-10-03 13:03:19 -070028 static final int MIN_PRIORITY = 0;
alshabiba7f7ca82014-09-22 11:41:23 -070029
sangho11c30ac2015-01-22 14:30:55 -080030 /**
31 * The FlowRule type is used to determine in which table the flow rule
32 * needs to be put for multi-table support switch.
33 * For single table switch, Default is used.
34 */
35 public static enum Type {
Saurav Dascbe6de32015-03-01 18:30:46 -080036 /* Default type - used in flow rule for single table switch
37 * NOTE: this setting should not be used as Table 0 in a multi-table pipeline*/
sangho11c30ac2015-01-22 14:30:55 -080038 DEFAULT,
39 /* Used in flow entry for IP table */
40 IP,
41 /* Used in flow entry for MPLS table */
42 MPLS,
43 /* Used in flow entry for ACL table */
alshabib9af70072015-02-09 14:34:16 -080044 ACL,
45
46 /* VLAN-to-MPLS table */
47 VLAN_MPLS,
48
49 /* VLAN table */
50 VLAN,
51
Saurav Dascbe6de32015-03-01 18:30:46 -080052 /* Ethtype table */
alshabib9af70072015-02-09 14:34:16 -080053 ETHER,
54
55 /* Class of Service table */
56 COS,
Saurav Dascbe6de32015-03-01 18:30:46 -080057
58 /* Table 0 in a multi-table pipeline */
59 FIRST,
sangho11c30ac2015-01-22 14:30:55 -080060 }
61
alshabib369d2942014-09-12 17:59:35 -070062 //TODO: build cookie value
Ayaka Koshibed4e53e12014-09-18 14:24:55 -070063 /**
64 * Returns the ID of this flow.
65 *
66 * @return the flow ID
67 */
68 FlowId id();
alshabib369d2942014-09-12 17:59:35 -070069
tom8bb16062014-09-12 14:47:46 -070070 /**
alshabiba68eb962014-09-24 20:34:13 -070071 * Returns the application id of this flow.
72 *
73 * @return an applicationId
74 */
alshabib92c65ad2014-10-08 21:56:05 -070075 short appId();
alshabiba68eb962014-09-24 20:34:13 -070076
77 /**
alshabib28204e52014-11-12 18:29:45 -080078 * Returns the group id of this flow.
79 *
80 * @return an groupId
81 */
Sho SHIMIZU75a5bd92014-11-25 11:22:56 -080082 GroupId groupId();
alshabib28204e52014-11-12 18:29:45 -080083
84 /**
tom8bb16062014-09-12 14:47:46 -070085 * Returns the flow rule priority given in natural order; higher numbers
86 * mean higher priorities.
87 *
88 * @return flow rule priority
89 */
90 int priority();
91
92 /**
93 * Returns the identity of the device where this rule applies.
94 *
95 * @return device identifier
96 */
97 DeviceId deviceId();
98
99 /**
100 * Returns the traffic selector that identifies what traffic this
101 * rule should apply to.
102 *
103 * @return traffic selector
104 */
105 TrafficSelector selector();
106
107 /**
108 * Returns the traffic treatment that applies to selected traffic.
109 *
110 * @return traffic treatment
111 */
alshabib369d2942014-09-12 17:59:35 -0700112 TrafficTreatment treatment();
tom8bb16062014-09-12 14:47:46 -0700113
Ayaka Koshibed4e53e12014-09-18 14:24:55 -0700114 /**
alshabibba5ac482014-10-02 17:15:20 -0700115 * Returns the timeout for this flow requested by an application.
Jonathan Hartbc4a7932014-10-21 11:46:00 -0700116 *
alshabibba5ac482014-10-02 17:15:20 -0700117 * @return integer value of the timeout
alshabib6eb438a2014-10-01 16:39:37 -0700118 */
alshabibba5ac482014-10-02 17:15:20 -0700119 int timeout();
alshabib6eb438a2014-10-01 16:39:37 -0700120
Jonathan Hartbc4a7932014-10-21 11:46:00 -0700121 /**
122 * Returns whether the flow is permanent i.e. does not time out.
123 *
124 * @return true if the flow is permanent, otherwise false
125 */
126 boolean isPermanent();
127
sangho11c30ac2015-01-22 14:30:55 -0800128 /**
129 * Returns the flow rule type.
130 *
131 * @return flow rule type
132 */
133 Type type();
134
tom8bb16062014-09-12 14:47:46 -0700135}