Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Ray Milkey | 34c9590 | 2015-04-15 09:47:53 -0700 | [diff] [blame] | 2 | * Copyright 2014-2015 Open Networking Laboratory |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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 |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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. |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.flow; |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.core.GroupId; |
| 19 | import org.onosproject.net.DeviceId; |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 20 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 21 | /** |
| 22 | * Represents a generalized match & action pair to be applied to |
Sho SHIMIZU | a19a2e5 | 2014-11-17 11:08:19 -0800 | [diff] [blame] | 23 | * an infrastructure device. |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 24 | */ |
Sho SHIMIZU | 5e5d4aa | 2015-01-26 16:12:11 -0800 | [diff] [blame] | 25 | public interface FlowRule { |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 26 | |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 27 | static final int MAX_TIMEOUT = 60; |
alshabib | a0e0498 | 2014-10-03 13:03:19 -0700 | [diff] [blame] | 28 | static final int MIN_PRIORITY = 0; |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 29 | |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 30 | /** |
| 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 Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 36 | /* 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*/ |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 38 | 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 */ |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 44 | ACL, |
| 45 | |
| 46 | /* VLAN-to-MPLS table */ |
| 47 | VLAN_MPLS, |
| 48 | |
| 49 | /* VLAN table */ |
| 50 | VLAN, |
| 51 | |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 52 | /* Ethtype table */ |
alshabib | 9af7007 | 2015-02-09 14:34:16 -0800 | [diff] [blame] | 53 | ETHER, |
| 54 | |
| 55 | /* Class of Service table */ |
| 56 | COS, |
Saurav Das | cbe6de3 | 2015-03-01 18:30:46 -0800 | [diff] [blame] | 57 | |
| 58 | /* Table 0 in a multi-table pipeline */ |
| 59 | FIRST, |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 60 | } |
| 61 | |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 62 | //TODO: build cookie value |
Ayaka Koshibe | d4e53e1 | 2014-09-18 14:24:55 -0700 | [diff] [blame] | 63 | /** |
| 64 | * Returns the ID of this flow. |
| 65 | * |
| 66 | * @return the flow ID |
| 67 | */ |
| 68 | FlowId id(); |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 69 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 70 | /** |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 71 | * Returns the application id of this flow. |
| 72 | * |
| 73 | * @return an applicationId |
| 74 | */ |
alshabib | 92c65ad | 2014-10-08 21:56:05 -0700 | [diff] [blame] | 75 | short appId(); |
alshabib | a68eb96 | 2014-09-24 20:34:13 -0700 | [diff] [blame] | 76 | |
| 77 | /** |
alshabib | 28204e5 | 2014-11-12 18:29:45 -0800 | [diff] [blame] | 78 | * Returns the group id of this flow. |
| 79 | * |
| 80 | * @return an groupId |
| 81 | */ |
Sho SHIMIZU | 75a5bd9 | 2014-11-25 11:22:56 -0800 | [diff] [blame] | 82 | GroupId groupId(); |
alshabib | 28204e5 | 2014-11-12 18:29:45 -0800 | [diff] [blame] | 83 | |
| 84 | /** |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 85 | * 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 | */ |
alshabib | 369d294 | 2014-09-12 17:59:35 -0700 | [diff] [blame] | 112 | TrafficTreatment treatment(); |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 113 | |
Ayaka Koshibe | d4e53e1 | 2014-09-18 14:24:55 -0700 | [diff] [blame] | 114 | /** |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 115 | * Returns the timeout for this flow requested by an application. |
Jonathan Hart | bc4a793 | 2014-10-21 11:46:00 -0700 | [diff] [blame] | 116 | * |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 117 | * @return integer value of the timeout |
alshabib | 6eb438a | 2014-10-01 16:39:37 -0700 | [diff] [blame] | 118 | */ |
alshabib | ba5ac48 | 2014-10-02 17:15:20 -0700 | [diff] [blame] | 119 | int timeout(); |
alshabib | 6eb438a | 2014-10-01 16:39:37 -0700 | [diff] [blame] | 120 | |
Jonathan Hart | bc4a793 | 2014-10-21 11:46:00 -0700 | [diff] [blame] | 121 | /** |
| 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 | |
sangho | 11c30ac | 2015-01-22 14:30:55 -0800 | [diff] [blame] | 128 | /** |
| 129 | * Returns the flow rule type. |
| 130 | * |
| 131 | * @return flow rule type |
| 132 | */ |
| 133 | Type type(); |
| 134 | |
tom | 8bb1606 | 2014-09-12 14:47:46 -0700 | [diff] [blame] | 135 | } |