blob: 32556db58ea8b4e35a916194ad5ec2a7b7b76045 [file] [log] [blame]
Brian O'Connor72cb19a2015-01-16 16:14:41 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Brian O'Connor72cb19a2015-01-16 16:14:41 -08003 *
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 */
16package org.onosproject.net.flow;
17
18import com.google.common.base.MoreObjects;
19
20/**
21 * Representation of an operation on a flow rule table.
22 */
23public 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}