Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Brian O'Connor | 72cb19a | 2015-01-16 16:14:41 -0800 | [diff] [blame] | 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 | */ |
| 16 | package org.onosproject.net.flow; |
| 17 | |
| 18 | import com.google.common.base.MoreObjects; |
| 19 | |
| 20 | /** |
| 21 | * Representation of an operation on a flow rule table. |
| 22 | */ |
| 23 | public class FlowRuleOperation { |
| 24 | |
| 25 | /** |
| 26 | * Type of flow table operations. |
| 27 | */ |
| 28 | public enum Type { |
| 29 | ADD, |
| 30 | MODIFY, |
| 31 | REMOVE |
| 32 | } |
| 33 | |
| 34 | private final FlowRule rule; |
| 35 | private final Type type; |
| 36 | |
| 37 | public FlowRuleOperation(FlowRule rule, Type type) { |
| 38 | this.rule = rule; |
| 39 | this.type = type; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Returns the type of operation. |
| 44 | * |
| 45 | * @return type |
| 46 | */ |
| 47 | public Type type() { |
| 48 | return type; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Returns the flow rule. |
| 53 | * |
| 54 | * @return flow rule |
| 55 | */ |
| 56 | public FlowRule rule() { |
| 57 | return rule; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public String toString() { |
| 62 | return MoreObjects.toStringHelper(this) |
| 63 | .add("rule", rule) |
| 64 | .add("type", type) |
| 65 | .toString(); |
| 66 | } |
| 67 | } |