blob: 42eb81d8274e4e80819b84bedd6c90a4f80034a6 [file] [log] [blame]
Toshio Koide4ea84192014-07-31 12:10:12 -07001package net.onrc.onos.api.flowmanager;
2
3import net.onrc.onos.api.batchoperation.BatchOperation;
4import net.onrc.onos.api.batchoperation.BatchOperationEntry;
5
6/**
7 * A list of flow operations.
8 */
9public class FlowBatchOperation extends
10 BatchOperation<BatchOperationEntry<FlowBatchOperation.Operator, ?>> {
11 /**
12 * The flow operations' operators.
13 */
14 public enum Operator {
15 /**
16 * Adds new flow.
17 */
18 ADD,
19
20 /**
21 * Removes the existing flow.
22 */
23 REMOVE,
24 }
25
26 /**
27 * Adds an add-flow operation.
28 *
29 * @param flow the flow to be added
30 * @return the FlowBatchOperation object if succeeded, null otherwise
31 */
32 public FlowBatchOperation addAddFlowOperation(IFlow flow) {
33 return (null == super.addOperation(
34 new BatchOperationEntry<Operator, IFlow>(Operator.ADD, flow)))
35 ? null : this;
36 }
37
38 /**
39 * Adds a remove-flow operation.
40 *
41 * @param flowId the ID of flow to be removed
42 * @return the FlowBatchOperation object if succeeded, null otherwise
43 */
44 public FlowBatchOperation addRemoveFlowOperation(FlowId flowId) {
45 return (null == super.addOperation(
46 new BatchOperationEntry<Operator, FlowId>(Operator.REMOVE, flowId)))
47 ? null : this;
48 }
49}