blob: e5fd4861f34e34d7571b3c1934a3ce4ba8b386fa [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.flow;
Madan Jampani117aaae2014-10-23 10:04:05 -070017
Brian O'Connor72cb19a2015-01-16 16:14:41 -080018import com.google.common.collect.Lists;
19import org.onosproject.net.DeviceId;
20
Madan Jampani117aaae2014-10-23 10:04:05 -070021import java.util.Collections;
22import java.util.List;
Brian O'Connor72cb19a2015-01-16 16:14:41 -080023import java.util.Set;
Madan Jampani117aaae2014-10-23 10:04:05 -070024
Ray Milkeyc4dd7262015-08-21 09:33:42 -070025@Deprecated
26/**
27 * @deprecated in Drake release - no longer a public API
28 */
Madan Jampani117aaae2014-10-23 10:04:05 -070029public class FlowRuleBatchRequest {
30
Brian O'Connor72cb19a2015-01-16 16:14:41 -080031 /**
Hongtao Yin142b7582015-01-21 14:41:30 -080032 * This id is used to carry to id of the original
Brian O'Connor72cb19a2015-01-16 16:14:41 -080033 * FlowOperations and track where this batch operation
34 * came from. The id is unique cluster wide.
35 */
36 private final long batchId;
Madan Jampani117aaae2014-10-23 10:04:05 -070037
Brian O'Connor72cb19a2015-01-16 16:14:41 -080038 private final Set<FlowRuleBatchEntry> ops;
39
40
41 public FlowRuleBatchRequest(long batchId, Set<FlowRuleBatchEntry> ops) {
Yuta HIGUCHI9def0472014-10-23 15:51:10 -070042 this.batchId = batchId;
Brian O'Connor72cb19a2015-01-16 16:14:41 -080043 this.ops = Collections.unmodifiableSet(ops);
Madan Jampani117aaae2014-10-23 10:04:05 -070044 }
45
Brian O'Connor72cb19a2015-01-16 16:14:41 -080046 public Set<FlowRuleBatchEntry> ops() {
47 return ops;
Madan Jampani117aaae2014-10-23 10:04:05 -070048 }
49
Brian O'Connor72cb19a2015-01-16 16:14:41 -080050 public FlowRuleBatchOperation asBatchOperation(DeviceId deviceId) {
Madan Jampani117aaae2014-10-23 10:04:05 -070051 List<FlowRuleBatchEntry> entries = Lists.newArrayList();
Brian O'Connor72cb19a2015-01-16 16:14:41 -080052 entries.addAll(ops);
53 return new FlowRuleBatchOperation(entries, deviceId, batchId);
Madan Jampani117aaae2014-10-23 10:04:05 -070054 }
Yuta HIGUCHI9def0472014-10-23 15:51:10 -070055
Brian O'Connor72cb19a2015-01-16 16:14:41 -080056 public long batchId() {
Yuta HIGUCHI9def0472014-10-23 15:51:10 -070057 return batchId;
58 }
Madan Jampani117aaae2014-10-23 10:04:05 -070059}