2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.openflow.md.core.sal;
10 import java.math.BigInteger;
11 import java.util.ArrayList;
12 import java.util.List;
13 import java.util.concurrent.Future;
15 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
16 import org.opendaylight.openflowplugin.api.OFConstants;
17 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
18 import org.opendaylight.openflowplugin.api.openflow.md.core.sal.NotificationComposer;
19 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
20 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowConvertor;
21 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
22 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
23 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
24 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.TableFeaturesConvertor;
25 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
26 import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
27 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdatedBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutputBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAdded;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAddedBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemoved;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemovedBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdated;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdatedBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutputBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutputBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutputBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutputBuilder;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAddedBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemovedBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdated;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdatedBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutputBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutputBuilder;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInput;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutputBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutputBuilder;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCaseBuilder;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterConfigCaseBuilder;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutputBuilder;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutputBuilder;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInput;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutput;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutputBuilder;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInput;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutputBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
159 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
160 import org.opendaylight.yangtools.yang.common.RpcResult;
161 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
162 import org.slf4j.Logger;
163 import org.slf4j.LoggerFactory;
165 import com.google.common.util.concurrent.AsyncFunction;
166 import com.google.common.util.concurrent.FutureCallback;
167 import com.google.common.util.concurrent.Futures;
168 import com.google.common.util.concurrent.JdkFutureAdapters;
169 import com.google.common.util.concurrent.ListenableFuture;
170 import com.google.common.util.concurrent.SettableFuture;
175 public abstract class OFRpcTaskFactory {
176 protected static final Logger logger = LoggerFactory.getLogger(OFRpcTaskFactory.class);
182 * @return UpdateFlow task
184 public static OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> createAddFlowTask(
185 OFRpcTaskContext taskContext, AddFlowInput input,
186 SwitchConnectionDistinguisher cookie) {
187 OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> task =
188 new OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>>(taskContext, cookie, input) {
191 public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
192 ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
194 // Convert the AddFlowInput to FlowModInput
195 List<FlowModInputBuilder> ofFlowModInputs = FlowConvertor.toFlowModInputs(getInput(),
196 getVersion(), getSession().getFeatures().getDatapathId());
198 logger.debug("Number of flows to push to switch: {}", ofFlowModInputs.size());
200 result = chainFlowMods(ofFlowModInputs, 0, getTaskContext(), getCookie());
203 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
204 OFRpcTaskUtil.hookFutureNotification(this, result,
205 getRpcNotificationProviderService(),
206 createFlowAddedNotification(getInput()));
211 public Boolean isBarrier() {
212 return getInput().isBarrier();
219 * Recursive helper method for {@link OFRpcTaskFactory#createAddFlowTask()}
220 * and {@link OFRpcTaskFactory#createUpdateFlowTask()} to chain results
221 * of multiple flowmods.
222 * The next flowmod gets executed if the earlier one is successful.
223 * All the flowmods should have the same xid, in-order to cross-reference
226 protected static ListenableFuture<RpcResult<UpdateFlowOutput>> chainFlowMods(
227 final List<FlowModInputBuilder> ofFlowModInputs, final int index,
228 final OFRpcTaskContext taskContext, final SwitchConnectionDistinguisher cookie) {
230 Future<RpcResult<UpdateFlowOutput>> resultFromOFLib =
231 createResultForFlowMod(taskContext, ofFlowModInputs.get(index), cookie);
233 ListenableFuture<RpcResult<UpdateFlowOutput>> result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
235 if(ofFlowModInputs.size() > index + 1) {
236 // there are more flowmods to chain
237 return Futures.transform(result,
238 new AsyncFunction<RpcResult<UpdateFlowOutput>, RpcResult<UpdateFlowOutput>>() {
240 public ListenableFuture<RpcResult<UpdateFlowOutput>> apply(RpcResult<UpdateFlowOutput> input) throws Exception {
241 if (input.isSuccessful()) {
242 return chainFlowMods(ofFlowModInputs, index + 1, taskContext, cookie);
244 logger.warn("Flowmod failed. Any chained flowmods are ignored. xid:{}",
245 ofFlowModInputs.get(index).getXid());
246 return Futures.immediateFuture(input);
256 private static Future<RpcResult<UpdateFlowOutput>> createResultForFlowMod(
257 OFRpcTaskContext taskContext, FlowModInputBuilder flowModInput,
258 SwitchConnectionDistinguisher cookie) {
259 flowModInput.setXid(taskContext.getSession().getNextXid());
260 return taskContext.getMessageService().flowMod(flowModInput.build(), cookie);
268 protected static NotificationComposer<FlowAdded> createFlowAddedNotification(
269 final AddFlowInput input) {
270 return new NotificationComposer<FlowAdded>() {
272 public FlowAdded compose(TransactionId tXid) {
273 FlowAddedBuilder newFlow = new FlowAddedBuilder((Flow) input);
274 newFlow.setTransactionId(tXid);
275 newFlow.setFlowRef(input.getFlowRef());
276 return newFlow.build();
285 * @return UpdateFlow task
287 public static OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> createUpdateFlowTask(
288 final OFRpcTaskContext taskContext, UpdateFlowInput input,
289 SwitchConnectionDistinguisher cookie) {
291 OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task =
292 new OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>>(taskContext, cookie, input) {
295 public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
296 ListenableFuture<RpcResult<UpdateFlowOutput>> result = null;
298 boolean updatedFlow = (getInput().getUpdatedFlow().getMatch().equals(getInput().getOriginalFlow().getMatch())) &&
299 (getInput().getUpdatedFlow().getPriority().equals(getInput().getOriginalFlow().getPriority()));
301 List<FlowModInputBuilder> allFlowMods = new ArrayList<>();
302 List<FlowModInputBuilder> ofFlowModInputs;
304 if (updatedFlow == false) {
305 // if neither match nor priority matches, then we would need to remove the flow and add it
307 RemoveFlowInputBuilder removeflow = new RemoveFlowInputBuilder(getInput().getOriginalFlow());
308 List<FlowModInputBuilder> ofFlowRemoveInput = FlowConvertor.toFlowModInputs(removeflow.build(),
309 getVersion(),getSession().getFeatures().getDatapathId());
310 // remove flow should be the first
311 allFlowMods.addAll(ofFlowRemoveInput);
312 AddFlowInputBuilder addFlowInputBuilder = new AddFlowInputBuilder(getInput().getUpdatedFlow());
313 ofFlowModInputs = FlowConvertor.toFlowModInputs(addFlowInputBuilder.build(),
314 getVersion(), getSession().getFeatures().getDatapathId());
316 ofFlowModInputs = FlowConvertor.toFlowModInputs(getInput().getUpdatedFlow(),
317 getVersion(), getSession().getFeatures().getDatapathId());
320 allFlowMods.addAll(ofFlowModInputs);
321 logger.debug("Number of flows to push to switch: {}", allFlowMods.size());
322 result = chainFlowMods(allFlowMods, 0, getTaskContext(), getCookie());
324 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
325 OFRpcTaskUtil.hookFutureNotification(this, result,
326 getRpcNotificationProviderService(),
327 createFlowUpdatedNotification(getInput()));
332 public Boolean isBarrier() {
333 return getInput().getUpdatedFlow().isBarrier();
345 protected static NotificationComposer<FlowUpdated> createFlowUpdatedNotification(final UpdateFlowInput input) {
346 return new NotificationComposer<FlowUpdated>() {
348 public FlowUpdated compose(TransactionId tXid) {
349 FlowUpdatedBuilder updFlow = new FlowUpdatedBuilder(input.getUpdatedFlow());
350 updFlow.setTransactionId(tXid);
351 updFlow.setFlowRef(input.getFlowRef());
352 return updFlow.build();
361 * @return update group task
363 public static OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> createAddGroupTask(
364 final OFRpcTaskContext taskContext, AddGroupInput input,
365 final SwitchConnectionDistinguisher cookie) {
366 OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> task =
367 new OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>>(taskContext, cookie, input) {
370 public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
371 ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
373 // Convert the AddGroupInput to GroupModInput
374 GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(getInput(),
375 getVersion(), getSession().getFeatures().getDatapathId());
376 final Long xId = getSession().getNextXid();
377 ofGroupModInput.setXid(xId);
379 Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = getMessageService()
380 .groupMod(ofGroupModInput.build(), getCookie());
381 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
383 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
384 OFRpcTaskUtil.hookFutureNotification(this, result,
385 getRpcNotificationProviderService(), createGroupAddedNotification(getInput()));
391 public Boolean isBarrier() {
392 return getInput().isBarrier();
404 protected static NotificationComposer<GroupAdded> createGroupAddedNotification(
405 final AddGroupInput input) {
406 return new NotificationComposer<GroupAdded>() {
408 public GroupAdded compose(TransactionId tXid) {
409 GroupAddedBuilder groupMod = new GroupAddedBuilder((Group) input);
410 groupMod.setTransactionId(tXid);
411 groupMod.setGroupRef(input.getGroupRef());
412 return groupMod.build();
421 * @return update meter task
423 public static OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> createAddMeterTask(
424 OFRpcTaskContext taskContext, AddMeterInput input,
425 SwitchConnectionDistinguisher cookie) {
426 OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> task =
427 new OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>>(taskContext, cookie, input) {
430 public ListenableFuture<RpcResult<UpdateMeterOutput>> call() {
431 ListenableFuture<RpcResult<UpdateMeterOutput>> result = SettableFuture.create();
433 // Convert the AddGroupInput to GroupModInput
434 MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(getInput(), getVersion());
435 final Long xId = getSession().getNextXid();
436 ofMeterModInput.setXid(xId);
438 Future<RpcResult<UpdateMeterOutput>> resultFromOFLib = getMessageService()
439 .meterMod(ofMeterModInput.build(), getCookie());
440 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
442 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
443 OFRpcTaskUtil.hookFutureNotification(this, result,
444 getRpcNotificationProviderService(), createMeterAddedNotification(getInput()));
450 public Boolean isBarrier() {
451 return getInput().isBarrier();
463 protected static NotificationComposer<MeterAdded> createMeterAddedNotification(
464 final AddMeterInput input) {
465 return new NotificationComposer<MeterAdded>() {
467 public MeterAdded compose(TransactionId tXid) {
468 MeterAddedBuilder meterMod = new MeterAddedBuilder((Meter) input);
469 meterMod.setTransactionId(tXid);
470 meterMod.setMeterRef(input.getMeterRef());
471 return meterMod.build();
480 * @return UpdateFlow task
482 public static OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> createUpdateGroupTask(
483 OFRpcTaskContext taskContext, UpdateGroupInput input,
484 SwitchConnectionDistinguisher cookie) {
485 OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> task =
486 new OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>>(taskContext, cookie, input) {
489 public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
490 ListenableFuture<RpcResult<UpdateGroupOutput>> result = null;
492 // Convert the UpdateGroupInput to GroupModInput
493 GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(
494 getInput().getUpdatedGroup(), getVersion(),
495 getSession().getFeatures().getDatapathId());
496 final Long xId = getSession().getNextXid();
497 ofGroupModInput.setXid(xId);
499 Future<RpcResult<UpdateGroupOutput>> resultFromOFLib =
500 getMessageService().groupMod(ofGroupModInput.build(), getCookie());
501 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
503 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
504 OFRpcTaskUtil.hookFutureNotification(this, result,
505 getRpcNotificationProviderService(), createGroupUpdatedNotification(getInput()));
517 protected static NotificationComposer<GroupUpdated> createGroupUpdatedNotification(
518 final UpdateGroupInput input) {
519 return new NotificationComposer<GroupUpdated>() {
521 public GroupUpdated compose(TransactionId tXid) {
522 GroupUpdatedBuilder groupMod = new GroupUpdatedBuilder(input.getUpdatedGroup());
523 groupMod.setTransactionId(tXid);
524 groupMod.setGroupRef(input.getGroupRef());
525 return groupMod.build();
534 * @return update meter task
536 public static OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> createUpdateMeterTask(
537 OFRpcTaskContext taskContext, UpdateMeterInput input,
538 SwitchConnectionDistinguisher cookie) {
539 OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> task =
540 new OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>>(taskContext, cookie, input) {
543 public ListenableFuture<RpcResult<UpdateMeterOutput>> call() {
544 ListenableFuture<RpcResult<UpdateMeterOutput>> result = null;
546 // Convert the UpdateMeterInput to MeterModInput
547 MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(
548 getInput().getUpdatedMeter(), getVersion());
549 final Long xId = getSession().getNextXid();
550 ofMeterModInput.setXid(xId);
552 Future<RpcResult<UpdateMeterOutput>> resultFromOFLib =
553 getMessageService().meterMod(ofMeterModInput.build(), getCookie());
554 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
556 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
557 OFRpcTaskUtil.hookFutureNotification(this, result,
558 getRpcNotificationProviderService(), createMeterUpdatedNotification(getInput()));
569 protected static NotificationComposer<MeterUpdated> createMeterUpdatedNotification(
570 final UpdateMeterInput input) {
571 return new NotificationComposer<MeterUpdated>() {
573 public MeterUpdated compose(TransactionId tXid) {
574 MeterUpdatedBuilder meterMod = new MeterUpdatedBuilder(input.getUpdatedMeter());
575 meterMod.setTransactionId(tXid);
576 meterMod.setMeterRef(input.getMeterRef());
577 return meterMod.build();
589 public static OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> createRemoveFlowTask(
590 OFRpcTaskContext taskContext, RemoveFlowInput input,
591 SwitchConnectionDistinguisher cookie) {
592 OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> task =
593 new OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>>(taskContext, cookie, input) {
596 public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
597 ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
599 // Convert the AddFlowInput to FlowModInput
600 FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(getInput(),
601 getVersion(), getSession().getFeatures().getDatapathId());
602 final Long xId = getSession().getNextXid();
603 ofFlowModInput.setXid(xId);
605 Future<RpcResult<UpdateFlowOutput>> resultFromOFLib =
606 getMessageService().flowMod(ofFlowModInput.build(), getCookie());
607 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
609 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
610 OFRpcTaskUtil.hookFutureNotification(this, result,
611 getRpcNotificationProviderService(), createFlowRemovedNotification(getInput()));
624 protected static NotificationComposer<FlowRemoved> createFlowRemovedNotification(
625 final RemoveFlowInput input) {
626 return new NotificationComposer<FlowRemoved>() {
628 public FlowRemoved compose(TransactionId tXid) {
629 FlowRemovedBuilder removedFlow = new FlowRemovedBuilder((Flow) input);
630 removedFlow.setTransactionId(tXid);
631 removedFlow.setFlowRef(input.getFlowRef());
632 return removedFlow.build();
644 public static OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> createRemoveGroupTask(
645 final OFRpcTaskContext taskContext, RemoveGroupInput input,
646 final SwitchConnectionDistinguisher cookie) {
647 OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> task =
648 new OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>>(taskContext, cookie, input) {
651 public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
652 ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
654 // Convert the AddGroupInput to GroupModInput
655 GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(getInput(),
656 getVersion(), getSession().getFeatures().getDatapathId());
657 final Long xId = getSession().getNextXid();
658 ofGroupModInput.setXid(xId);
660 Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = getMessageService()
661 .groupMod(ofGroupModInput.build(), getCookie());
662 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
664 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
665 OFRpcTaskUtil.hookFutureNotification(this, result,
666 getRpcNotificationProviderService(), createGroupRemovedNotification(getInput()));
679 protected static NotificationComposer<GroupRemoved> createGroupRemovedNotification(
680 final RemoveGroupInput input) {
681 return new NotificationComposer<GroupRemoved>() {
683 public GroupRemoved compose(TransactionId tXid) {
684 GroupRemovedBuilder removedGroup = new GroupRemovedBuilder((Group) input);
685 removedGroup.setTransactionId(tXid);
686 removedGroup.setGroupRef(input.getGroupRef());
687 return removedGroup.build();
698 public static OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> createRemoveMeterTask(
699 OFRpcTaskContext taskContext, RemoveMeterInput input,
700 SwitchConnectionDistinguisher cookie) {
701 OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> task =
702 new OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>>(taskContext, cookie, input) {
705 public ListenableFuture<RpcResult<UpdateMeterOutput>> call() {
706 ListenableFuture<RpcResult<UpdateMeterOutput>> result = SettableFuture.create();
708 // Convert the AddGroupInput to GroupModInput
709 MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(getInput(), getVersion());
710 final Long xId = getSession().getNextXid();
711 ofMeterModInput.setXid(xId);
713 Future<RpcResult<UpdateMeterOutput>> resultFromOFLib = getMessageService()
714 .meterMod(ofMeterModInput.build(), getCookie());
715 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
717 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
718 OFRpcTaskUtil.hookFutureNotification(this, result,
719 getRpcNotificationProviderService(), createMeterRemovedNotification(getInput()));
733 protected static NotificationComposer<MeterRemoved> createMeterRemovedNotification(
734 final RemoveMeterInput input) {
735 return new NotificationComposer<MeterRemoved>() {
737 public MeterRemoved compose(TransactionId tXid) {
738 MeterRemovedBuilder meterRemoved = new MeterRemovedBuilder((Meter) input);
739 meterRemoved.setTransactionId(tXid);
740 meterRemoved.setMeterRef(input.getMeterRef());
741 return meterRemoved.build();
752 public static OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>> createGetAllGroupStatisticsTask(
753 final OFRpcTaskContext taskContext, GetAllGroupStatisticsInput input,
754 SwitchConnectionDistinguisher cookie) {
755 OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>> task =
756 new OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>>(taskContext, cookie, input) {
759 public ListenableFuture<RpcResult<GetAllGroupStatisticsOutput>> call() {
760 final SettableFuture<RpcResult<GetAllGroupStatisticsOutput>> result = SettableFuture.create();
762 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
763 RpcResult<GetAllGroupStatisticsOutput> rpcResult = RpcResultBuilder.success(
764 new GetAllGroupStatisticsOutputBuilder().build()).build();
766 return Futures.immediateFuture(rpcResult);
769 // Generate xid to associate it with the request
770 final Long xid = taskContext.getSession().getNextXid();
772 // Create multipart request body for fetch all the group stats
773 MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
774 MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
775 mprGroupBuild.setGroupId(new GroupId(BinContent.intToUnsignedLong(
776 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731
777 .Group.OFPGALL.getIntValue())));
778 caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
780 // Create multipart request header
781 MultipartRequestInputBuilder mprInput = createMultipartHeader(MultipartType.OFPMPGROUP,
784 // Set request body to main multipart request
785 mprInput.setMultipartRequestBody(caseBuilder.build());
787 // Send the request, no cookies associated, use any connection
789 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
790 .multipartRequest(mprInput.build(), getCookie());
791 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
793 Futures.addCallback(resultLib, new ResultCallback<GetAllGroupStatisticsOutput>(result) {
795 public GetAllGroupStatisticsOutput createResult() {
796 GetAllGroupStatisticsOutputBuilder groupStatBuilder = new GetAllGroupStatisticsOutputBuilder()
797 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
798 return groupStatBuilder.build();
815 public static OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>> createGetGroupDescriptionTask(
816 final OFRpcTaskContext taskContext, GetGroupDescriptionInput input,
817 SwitchConnectionDistinguisher cookie) {
818 OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>> task =
819 new OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>>(taskContext, cookie, input) {
822 public ListenableFuture<RpcResult<GetGroupDescriptionOutput>> call()
824 final SettableFuture<RpcResult<GetGroupDescriptionOutput>> result = SettableFuture.create();
826 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
827 RpcResult<GetGroupDescriptionOutput> rpcResult = RpcResultBuilder.success(
828 new GetGroupDescriptionOutputBuilder().build()).build();
829 return Futures.immediateFuture(rpcResult);
831 final Long xid = taskContext.getSession().getNextXid();
833 MultipartRequestGroupDescCaseBuilder mprGroupDescCaseBuild =
834 new MultipartRequestGroupDescCaseBuilder();
835 MultipartRequestInputBuilder mprInput =
836 createMultipartHeader(MultipartType.OFPMPGROUPDESC, taskContext, xid);
837 mprInput.setMultipartRequestBody(mprGroupDescCaseBuild.build());
838 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
839 .multipartRequest(mprInput.build(), getCookie());
840 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
842 Futures.addCallback(resultLib, new ResultCallback<GetGroupDescriptionOutput>(result) {
844 public GetGroupDescriptionOutput createResult() {
845 GetGroupDescriptionOutputBuilder groupStatBuilder = new GetGroupDescriptionOutputBuilder()
846 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
847 return groupStatBuilder.build();
863 public static OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>> createGetGroupFeaturesTask(
864 final OFRpcTaskContext taskContext, GetGroupFeaturesInput input,
865 SwitchConnectionDistinguisher cookie) {
866 OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>> task =
867 new OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>>(taskContext, cookie, input) {
870 public ListenableFuture<RpcResult<GetGroupFeaturesOutput>> call()
872 final SettableFuture<RpcResult<GetGroupFeaturesOutput>> result = SettableFuture.create();
874 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
875 RpcResult<GetGroupFeaturesOutput> rpcResult = RpcResultBuilder.success(
876 new GetGroupFeaturesOutputBuilder().build()).build();
877 return Futures.immediateFuture(rpcResult);
879 final Long xid = taskContext.getSession().getNextXid();
881 MultipartRequestGroupFeaturesCaseBuilder mprGroupFeaturesBuild =
882 new MultipartRequestGroupFeaturesCaseBuilder();
883 MultipartRequestInputBuilder mprInput =
884 createMultipartHeader(MultipartType.OFPMPGROUPFEATURES, taskContext, xid);
885 mprInput.setMultipartRequestBody(mprGroupFeaturesBuild.build());
886 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
887 .multipartRequest(mprInput.build(), getCookie());
888 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
890 Futures.addCallback(resultLib, new ResultCallback<GetGroupFeaturesOutput>(result) {
892 public GetGroupFeaturesOutput createResult() {
893 GetGroupFeaturesOutputBuilder groupFeatureBuilder = new GetGroupFeaturesOutputBuilder()
894 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
895 return groupFeatureBuilder.build();
911 public static OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>> createGetGroupStatisticsTask(
912 final OFRpcTaskContext taskContext, final GetGroupStatisticsInput input,
913 SwitchConnectionDistinguisher cookie) {
914 OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>> task =
915 new OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>>(taskContext, cookie, input) {
918 public ListenableFuture<RpcResult<GetGroupStatisticsOutput>> call()
920 final SettableFuture<RpcResult<GetGroupStatisticsOutput>> result = SettableFuture.create();
922 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
923 RpcResult<GetGroupStatisticsOutput> rpcResult = RpcResultBuilder.success(
924 new GetGroupStatisticsOutputBuilder().build()).build();
925 return Futures.immediateFuture(rpcResult);
927 final Long xid = taskContext.getSession().getNextXid();
929 MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
930 MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
931 mprGroupBuild.setGroupId(new GroupId(input.getGroupId().getValue()));
932 caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
934 MultipartRequestInputBuilder mprInput =
935 createMultipartHeader(MultipartType.OFPMPGROUP, taskContext, xid);
936 mprInput.setMultipartRequestBody(caseBuilder.build());
937 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
938 .multipartRequest(mprInput.build(), getCookie());
939 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
941 Futures.addCallback(resultLib, new ResultCallback<GetGroupStatisticsOutput>(result) {
943 public GetGroupStatisticsOutput createResult() {
944 GetGroupStatisticsOutputBuilder groupStatisticsBuilder =
945 new GetGroupStatisticsOutputBuilder()
946 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
947 return groupStatisticsBuilder.build();
963 public static OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>> createGetAllMeterConfigStatisticsTask(
964 final OFRpcTaskContext taskContext, final GetAllMeterConfigStatisticsInput input,
965 SwitchConnectionDistinguisher cookie) {
966 OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>> task =
967 new OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>>(taskContext, cookie, input) {
970 public ListenableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> call()
972 final SettableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> result = SettableFuture.create();
974 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
975 RpcResult<GetAllMeterConfigStatisticsOutput> rpcResult = RpcResultBuilder.success(
976 new GetAllMeterConfigStatisticsOutputBuilder().build()).build();
977 return Futures.immediateFuture(rpcResult);
979 final Long xid = taskContext.getSession().getNextXid();
981 MultipartRequestMeterConfigCaseBuilder caseBuilder =
982 new MultipartRequestMeterConfigCaseBuilder();
983 MultipartRequestMeterConfigBuilder mprMeterConfigBuild =
984 new MultipartRequestMeterConfigBuilder();
985 mprMeterConfigBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(
986 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
987 .types.rev130731.Meter.OFPMALL.getIntValue())));
988 caseBuilder.setMultipartRequestMeterConfig(mprMeterConfigBuild.build());
990 MultipartRequestInputBuilder mprInput =
991 createMultipartHeader(MultipartType.OFPMPMETERCONFIG, taskContext, xid);
992 mprInput.setMultipartRequestBody(caseBuilder.build());
993 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
994 .multipartRequest(mprInput.build(), getCookie());
995 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
997 Futures.addCallback(resultLib, new ResultCallback<GetAllMeterConfigStatisticsOutput>(result) {
999 public GetAllMeterConfigStatisticsOutput createResult() {
1000 GetAllMeterConfigStatisticsOutputBuilder allMeterConfStatBuilder =
1001 new GetAllMeterConfigStatisticsOutputBuilder()
1002 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1003 return allMeterConfStatBuilder.build();
1014 * @param taskContext
1019 public static OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>> createGetAllMeterStatisticsTask(
1020 final OFRpcTaskContext taskContext, final GetAllMeterStatisticsInput input,
1021 SwitchConnectionDistinguisher cookie) {
1022 OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>> task =
1023 new OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>>(taskContext, cookie, input) {
1026 public ListenableFuture<RpcResult<GetAllMeterStatisticsOutput>> call()
1028 final SettableFuture<RpcResult<GetAllMeterStatisticsOutput>> result = SettableFuture.create();
1030 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
1031 RpcResult<GetAllMeterStatisticsOutput> rpcResult = RpcResultBuilder.success(
1032 new GetAllMeterStatisticsOutputBuilder().build()).build();
1033 return Futures.immediateFuture(rpcResult);
1035 final Long xid = taskContext.getSession().getNextXid();
1037 MultipartRequestMeterCaseBuilder caseBuilder =
1038 new MultipartRequestMeterCaseBuilder();
1039 MultipartRequestMeterBuilder mprMeterBuild =
1040 new MultipartRequestMeterBuilder();
1041 mprMeterBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(
1042 org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
1043 .types.rev130731.Meter.OFPMALL.getIntValue())));
1044 caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
1046 MultipartRequestInputBuilder mprInput =
1047 createMultipartHeader(MultipartType.OFPMPMETER, taskContext, xid);
1048 mprInput.setMultipartRequestBody(caseBuilder.build());
1049 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1050 .multipartRequest(mprInput.build(), getCookie());
1051 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1053 Futures.addCallback(resultLib, new ResultCallback<GetAllMeterStatisticsOutput>(result) {
1055 public GetAllMeterStatisticsOutput createResult() {
1056 GetAllMeterStatisticsOutputBuilder allMeterStatBuilder =
1057 new GetAllMeterStatisticsOutputBuilder()
1058 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1059 return allMeterStatBuilder.build();
1070 * @param taskContext
1075 public static OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>> createGetMeterFeaturesTask(
1076 final OFRpcTaskContext taskContext, final GetMeterFeaturesInput input,
1077 SwitchConnectionDistinguisher cookie) {
1078 OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>> task =
1079 new OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>>(taskContext, cookie, input) {
1082 public ListenableFuture<RpcResult<GetMeterFeaturesOutput>> call()
1084 final SettableFuture<RpcResult<GetMeterFeaturesOutput>> result = SettableFuture.create();
1086 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
1087 RpcResult<GetMeterFeaturesOutput> rpcResult = RpcResultBuilder.success(
1088 new GetMeterFeaturesOutputBuilder().build()).build();
1089 return Futures.immediateFuture(rpcResult);
1091 final Long xid = taskContext.getSession().getNextXid();
1093 MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild =
1094 new MultipartRequestMeterFeaturesCaseBuilder();
1096 MultipartRequestInputBuilder mprInput =
1097 createMultipartHeader(MultipartType.OFPMPMETERFEATURES, taskContext, xid);
1098 mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
1099 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1100 .multipartRequest(mprInput.build(), getCookie());
1101 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1103 Futures.addCallback(resultLib, new ResultCallback<GetMeterFeaturesOutput>(result) {
1105 public GetMeterFeaturesOutput createResult() {
1106 GetMeterFeaturesOutputBuilder meterFeaturesBuilder =
1107 new GetMeterFeaturesOutputBuilder()
1108 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1109 return meterFeaturesBuilder.build();
1120 * @param taskContext
1125 public static OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>> createGetMeterStatisticsTask(
1126 final OFRpcTaskContext taskContext, final GetMeterStatisticsInput input,
1127 SwitchConnectionDistinguisher cookie) {
1128 OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>> task =
1129 new OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>>(taskContext, cookie, input) {
1132 public ListenableFuture<RpcResult<GetMeterStatisticsOutput>> call()
1134 final SettableFuture<RpcResult<GetMeterStatisticsOutput>> result = SettableFuture.create();
1136 if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
1137 RpcResult<GetMeterStatisticsOutput> rpcResult = RpcResultBuilder.success(
1138 new GetMeterStatisticsOutputBuilder().build()).build();
1139 return Futures.immediateFuture(rpcResult);
1141 final Long xid = taskContext.getSession().getNextXid();
1143 MultipartRequestMeterCaseBuilder caseBuilder =
1144 new MultipartRequestMeterCaseBuilder();
1145 MultipartRequestMeterBuilder mprMeterBuild =
1146 new MultipartRequestMeterBuilder();
1147 mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
1148 caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
1150 MultipartRequestInputBuilder mprInput =
1151 createMultipartHeader(MultipartType.OFPMPMETER, taskContext, xid);
1152 mprInput.setMultipartRequestBody(caseBuilder.build());
1153 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1154 .multipartRequest(mprInput.build(), getCookie());
1155 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1157 Futures.addCallback(resultLib, new ResultCallback<GetMeterStatisticsOutput>(result) {
1159 public GetMeterStatisticsOutput createResult() {
1160 GetMeterStatisticsOutputBuilder meterStatBuilder =
1161 new GetMeterStatisticsOutputBuilder()
1162 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1163 return meterStatBuilder.build();
1174 * @param taskContext
1179 public static OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>>
1180 createGetAllNodeConnectorsStatisticsTask(
1181 final OFRpcTaskContext taskContext, final GetAllNodeConnectorsStatisticsInput input,
1182 SwitchConnectionDistinguisher cookie) {
1183 OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>> task =
1184 new OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>>(taskContext, cookie, input) {
1187 public ListenableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> call()
1189 final SettableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> result = SettableFuture.create();
1191 final Long xid = taskContext.getSession().getNextXid();
1193 MultipartRequestPortStatsCaseBuilder caseBuilder =
1194 new MultipartRequestPortStatsCaseBuilder();
1195 MultipartRequestPortStatsBuilder mprPortStatsBuilder =
1196 new MultipartRequestPortStatsBuilder();
1198 mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
1199 caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
1201 MultipartRequestInputBuilder mprInput =
1202 createMultipartHeader(MultipartType.OFPMPPORTSTATS, taskContext, xid);
1203 mprInput.setMultipartRequestBody(caseBuilder.build());
1204 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1205 .multipartRequest(mprInput.build(), getCookie());
1206 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1208 Futures.addCallback(resultLib, new ResultCallback<GetAllNodeConnectorsStatisticsOutput>(result) {
1210 public GetAllNodeConnectorsStatisticsOutput createResult() {
1211 GetAllNodeConnectorsStatisticsOutputBuilder allNodeConnectorStatBuilder =
1212 new GetAllNodeConnectorsStatisticsOutputBuilder()
1213 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1214 return allNodeConnectorStatBuilder.build();
1224 * @param taskContext
1229 public static OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>>
1230 createGetNodeConnectorStatisticsTask(
1231 final OFRpcTaskContext taskContext, final GetNodeConnectorStatisticsInput input,
1232 SwitchConnectionDistinguisher cookie) {
1233 OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>> task =
1234 new OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>>(taskContext, cookie, input) {
1237 public ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> call()
1239 final SettableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> result = SettableFuture.create();
1241 final Long xid = taskContext.getSession().getNextXid();
1243 MultipartRequestPortStatsCaseBuilder caseBuilder =
1244 new MultipartRequestPortStatsCaseBuilder();
1245 MultipartRequestPortStatsBuilder mprPortStatsBuilder =
1246 new MultipartRequestPortStatsBuilder();
1247 // Set specific port
1249 .setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
1250 OpenflowVersion.get(taskContext.getSession().getFeatures().getVersion()),
1251 input.getNodeConnectorId()));
1252 caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
1254 MultipartRequestInputBuilder mprInput =
1255 createMultipartHeader(MultipartType.OFPMPPORTSTATS, taskContext, xid);
1256 mprInput.setMultipartRequestBody(caseBuilder.build());
1257 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1258 .multipartRequest(mprInput.build(), getCookie());
1259 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1261 Futures.addCallback(resultLib, new ResultCallback<GetNodeConnectorStatisticsOutput>(result) {
1263 public GetNodeConnectorStatisticsOutput createResult() {
1264 GetNodeConnectorStatisticsOutputBuilder allNodeConnectorStatBuilder =
1265 new GetNodeConnectorStatisticsOutputBuilder()
1266 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1267 return allNodeConnectorStatBuilder.build();
1277 * @param taskContext
1282 public static OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>>
1283 createGetAllFlowStatisticsFromFlowTableTask(
1284 final OFRpcTaskContext taskContext,
1285 final GetAllFlowStatisticsFromFlowTableInput input,
1286 SwitchConnectionDistinguisher cookie) {
1287 OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> task =
1288 new OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>>(taskContext, cookie, input) {
1291 public ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> call() throws Exception {
1292 final SettableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> result = SettableFuture.create();
1294 final Long xid = taskContext.getSession().getNextXid();
1296 MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
1297 MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
1298 mprFlowRequestBuilder.setTableId(input.getTableId().getValue());
1299 mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
1300 mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1301 mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1302 mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1303 FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
1304 .getPrimaryConductor().getVersion(), mprFlowRequestBuilder);
1306 MultipartRequestInputBuilder mprInput =
1307 createMultipartHeader(MultipartType.OFPMPFLOW, taskContext, xid);
1308 mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
1309 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1310 .multipartRequest(mprInput.build(), getCookie());
1311 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1313 Futures.addCallback(resultLib, new ResultCallback<GetAllFlowStatisticsFromFlowTableOutput>(result) {
1315 public GetAllFlowStatisticsFromFlowTableOutput createResult() {
1316 GetAllFlowStatisticsFromFlowTableOutputBuilder allFlowStatsFromFlowTableBuilder =
1317 new GetAllFlowStatisticsFromFlowTableOutputBuilder()
1318 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1319 return allFlowStatsFromFlowTableBuilder.build();
1329 * @param taskContext
1334 public static OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput, RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>>
1335 createGetAllFlowsStatisticsFromAllFlowTablesTask(
1336 final OFRpcTaskContext taskContext,
1337 final GetAllFlowsStatisticsFromAllFlowTablesInput input,
1338 SwitchConnectionDistinguisher cookie) {
1339 OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput,
1340 RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> task =
1341 new OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput,
1342 RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>>(taskContext, cookie, input) {
1345 public ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> call() throws Exception {
1346 final SettableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> result = SettableFuture.create();
1348 final Long xid = taskContext.getSession().getNextXid();
1350 // Create multipart request body for fetch all the group stats
1351 MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder =
1352 new MultipartRequestFlowCaseBuilder();
1353 MultipartRequestFlowBuilder mprFlowRequestBuilder =
1354 new MultipartRequestFlowBuilder();
1355 mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
1356 mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
1357 mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1358 mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1359 mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1360 FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
1361 .getPrimaryConductor().getVersion(), mprFlowRequestBuilder);
1363 MultipartRequestInputBuilder mprInput =
1364 createMultipartHeader(MultipartType.OFPMPFLOW, taskContext, xid);
1365 multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
1366 mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
1367 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1368 .multipartRequest(mprInput.build(), getCookie());
1369 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1371 Futures.addCallback(resultLib, new ResultCallback<GetAllFlowsStatisticsFromAllFlowTablesOutput>(result) {
1373 public GetAllFlowsStatisticsFromAllFlowTablesOutput createResult() {
1374 GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder allFlowStatsFromAllFlowTableBuilder =
1375 new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder()
1376 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1377 return allFlowStatsFromAllFlowTableBuilder.build();
1387 * @param taskContext
1392 public static OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>>
1393 createGetFlowStatisticsFromFlowTableTask(
1394 final OFRpcTaskContext taskContext,
1395 final GetFlowStatisticsFromFlowTableInput input,SwitchConnectionDistinguisher cookie) {
1396 OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> task =
1397 new OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>>(taskContext, cookie, input) {
1400 public ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> call() throws Exception {
1401 final SettableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> result = SettableFuture.create();
1403 final Long xid = taskContext.getSession().getNextXid();
1405 // Create multipart request body for fetch all the group stats
1406 MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
1407 MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
1408 mprFlowRequestBuilder.setTableId(input.getTableId());
1410 if (input.getOutPort() != null)
1411 mprFlowRequestBuilder.setOutPort(input.getOutPort().longValue());
1413 mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
1415 if (input.getOutGroup() != null)
1416 mprFlowRequestBuilder.setOutGroup(input.getOutGroup());
1418 mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1420 if (input.getCookie() != null)
1421 mprFlowRequestBuilder.setCookie(input.getCookie().getValue());
1423 mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1425 if (input.getCookieMask() != null)
1426 mprFlowRequestBuilder.setCookieMask(input.getCookieMask().getValue());
1428 mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1430 // convert and inject match
1431 MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
1432 .getPrimaryConductor().getVersion(), mprFlowRequestBuilder,
1433 taskContext.getSession().getFeatures().getDatapathId());
1435 // Set request body to main multipart request
1436 multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
1437 MultipartRequestInputBuilder mprInput =
1438 createMultipartHeader(MultipartType.OFPMPFLOW, taskContext, xid);
1439 mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
1440 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1441 .multipartRequest(mprInput.build(), getCookie());
1442 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1444 Futures.addCallback(resultLib, new ResultCallback<GetFlowStatisticsFromFlowTableOutput>(result) {
1446 public GetFlowStatisticsFromFlowTableOutput createResult() {
1447 GetFlowStatisticsFromFlowTableOutputBuilder flowStatsFromFlowTableBuilder =
1448 new GetFlowStatisticsFromFlowTableOutputBuilder()
1449 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1450 return flowStatsFromFlowTableBuilder.build();
1460 * @param taskContext
1465 public static OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
1466 createGetAggregateFlowStatisticsFromFlowTableForAllFlowsTask(
1467 final OFRpcTaskContext taskContext,
1468 final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input,SwitchConnectionDistinguisher cookie) {
1469 OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> task =
1470 new OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>(taskContext, cookie, input) {
1473 public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> call() throws Exception {
1474 final SettableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> result = SettableFuture.create();
1476 final Long xid = taskContext.getSession().getNextXid();
1478 // Create multipart request body for fetch all the group stats
1479 MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
1480 MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
1481 mprAggregateRequestBuilder.setTableId(input.getTableId().getValue());
1482 mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
1483 mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1484 mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1485 mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1487 FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
1488 .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
1490 // Set request body to main multipart request
1491 multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
1492 MultipartRequestInputBuilder mprInput =
1493 createMultipartHeader(MultipartType.OFPMPAGGREGATE, taskContext, xid);
1494 mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
1495 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1496 .multipartRequest(mprInput.build(), getCookie());
1497 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1499 Futures.addCallback(resultLib, new ResultCallback<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>(result) {
1501 public GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput createResult() {
1502 GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder flowStatsFromFlowTableBuilder =
1503 new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder()
1504 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1505 return flowStatsFromFlowTableBuilder.build();
1515 * @param taskContext
1520 public static OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
1521 createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(
1522 final OFRpcTaskContext taskContext,
1523 final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input,SwitchConnectionDistinguisher cookie) {
1524 OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> task =
1525 new OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>(taskContext, cookie, input) {
1528 public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> call() throws Exception {
1529 final SettableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> result = SettableFuture.create();
1531 final Long xid = taskContext.getSession().getNextXid();
1533 MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
1534 MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
1535 mprAggregateRequestBuilder.setTableId(input.getTableId());
1536 mprAggregateRequestBuilder.setOutPort(input.getOutPort().longValue());
1537 // TODO: repeating code
1538 if (taskContext.getSession().getPrimaryConductor().getVersion() ==
1539 OFConstants.OFP_VERSION_1_3) {
1540 mprAggregateRequestBuilder.setCookie(input.getCookie().getValue());
1541 mprAggregateRequestBuilder.setCookieMask(input.getCookieMask().getValue());
1542 mprAggregateRequestBuilder.setOutGroup(input.getOutGroup());
1544 mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1545 mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1546 mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1549 MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
1550 .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder,
1551 taskContext.getSession().getFeatures().getDatapathId());
1553 FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
1554 .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
1556 // Set request body to main multipart request
1557 multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
1558 MultipartRequestInputBuilder mprInput =
1559 createMultipartHeader(MultipartType.OFPMPAGGREGATE, taskContext, xid);
1560 mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
1561 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1562 .multipartRequest(mprInput.build(), getCookie());
1563 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1565 Futures.addCallback(resultLib, new ResultCallback<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>(result) {
1567 public GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput createResult() {
1568 GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder aggregFlowStatsFromFlowTableBuilder =
1569 new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder()
1570 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1571 return aggregFlowStatsFromFlowTableBuilder.build();
1581 * @param taskContext
1586 public static OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>> createGetFlowTablesStatisticsTask(
1587 final OFRpcTaskContext taskContext, final GetFlowTablesStatisticsInput input,SwitchConnectionDistinguisher cookie) {
1588 OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>> task =
1589 new OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>>(taskContext, cookie, input) {
1592 public ListenableFuture<RpcResult<GetFlowTablesStatisticsOutput>> call() throws Exception {
1593 final SettableFuture<RpcResult<GetFlowTablesStatisticsOutput>> result = SettableFuture.create();
1595 final Long xid = taskContext.getSession().getNextXid();
1597 // Create multipart request body for fetch all the group stats
1598 MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
1599 MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
1600 multipartRequestTableBuilder.setEmpty(true);
1601 multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
1603 // Set request body to main multipart request
1604 MultipartRequestInputBuilder mprInput =
1605 createMultipartHeader(MultipartType.OFPMPTABLE, taskContext, xid);
1606 mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
1607 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1608 .multipartRequest(mprInput.build(), getCookie());
1609 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1611 Futures.addCallback(resultLib, new ResultCallback<GetFlowTablesStatisticsOutput>(result) {
1613 public GetFlowTablesStatisticsOutput createResult() {
1614 GetFlowTablesStatisticsOutputBuilder flowTableStatsBuilder =
1615 new GetFlowTablesStatisticsOutputBuilder()
1616 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1617 return flowTableStatsBuilder.build();
1627 * @param taskContext
1632 public static OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> createGetAllQueuesStatisticsFromAllPortsTask(
1633 final OFRpcTaskContext taskContext, final GetAllQueuesStatisticsFromAllPortsInput input,SwitchConnectionDistinguisher cookie) {
1634 OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> task =
1635 new OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>>(taskContext, cookie, input) {
1638 public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> call() throws Exception {
1639 final SettableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> result = SettableFuture.create();
1641 final Long xid = taskContext.getSession().getNextXid();
1643 MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
1644 MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
1646 mprQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
1647 // Select all the ports
1648 mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
1649 caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
1651 // Set request body to main multipart request
1652 MultipartRequestInputBuilder mprInput =
1653 createMultipartHeader(MultipartType.OFPMPQUEUE, taskContext, xid);
1654 mprInput.setMultipartRequestBody(caseBuilder.build());
1655 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1656 .multipartRequest(mprInput.build(), getCookie());
1657 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1659 Futures.addCallback(resultLib, new ResultCallback<GetAllQueuesStatisticsFromAllPortsOutput>(result) {
1661 public GetAllQueuesStatisticsFromAllPortsOutput createResult() {
1662 GetAllQueuesStatisticsFromAllPortsOutputBuilder allQueueStatsBuilder =
1663 new GetAllQueuesStatisticsFromAllPortsOutputBuilder()
1664 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1665 return allQueueStatsBuilder.build();
1675 * @param taskContext
1680 public static OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> createGetAllQueuesStatisticsFromGivenPortTask(
1681 final OFRpcTaskContext taskContext, final GetAllQueuesStatisticsFromGivenPortInput input,SwitchConnectionDistinguisher cookie) {
1682 OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> task =
1683 new OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>>(taskContext, cookie, input) {
1686 public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> call() throws Exception {
1687 final SettableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> result = SettableFuture.create();
1689 final Long xid = taskContext.getSession().getNextXid();
1691 MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
1692 MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
1693 // Select all queues
1694 mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
1695 // Select specific port
1696 mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
1697 OpenflowVersion.get(taskContext.getSession().getFeatures().getVersion()),
1698 input.getNodeConnectorId()));
1699 caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
1701 // Set request body to main multipart request
1702 MultipartRequestInputBuilder mprInput =
1703 createMultipartHeader(MultipartType.OFPMPQUEUE, taskContext, xid);
1704 mprInput.setMultipartRequestBody(caseBuilder.build());
1705 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1706 .multipartRequest(mprInput.build(), getCookie());
1707 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1709 Futures.addCallback(resultLib, new ResultCallback<GetAllQueuesStatisticsFromGivenPortOutput>(result) {
1711 public GetAllQueuesStatisticsFromGivenPortOutput createResult() {
1712 GetAllQueuesStatisticsFromGivenPortOutputBuilder allQueueStatsBuilder =
1713 new GetAllQueuesStatisticsFromGivenPortOutputBuilder()
1714 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1715 return allQueueStatsBuilder.build();
1725 * @param taskContext
1730 public static OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>> createGetQueueStatisticsFromGivenPortTask(
1731 final OFRpcTaskContext taskContext, final GetQueueStatisticsFromGivenPortInput input,SwitchConnectionDistinguisher cookie) {
1732 OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>> task =
1733 new OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>>(taskContext, cookie, input) {
1736 public ListenableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> call() throws Exception {
1737 final SettableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> result = SettableFuture.create();
1739 final Long xid = taskContext.getSession().getNextXid();
1741 MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
1742 MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
1743 // Select specific queue
1744 mprQueueBuilder.setQueueId(input.getQueueId().getValue());
1745 // Select specific port
1746 mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
1747 OpenflowVersion.get(taskContext.getSession().getFeatures().getVersion()),
1748 input.getNodeConnectorId()));
1749 caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
1751 // Set request body to main multipart request
1752 MultipartRequestInputBuilder mprInput =
1753 createMultipartHeader(MultipartType.OFPMPQUEUE, taskContext, xid);
1754 mprInput.setMultipartRequestBody(caseBuilder.build());
1755 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1756 .multipartRequest(mprInput.build(), getCookie());
1757 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1759 Futures.addCallback(resultLib, new ResultCallback<GetQueueStatisticsFromGivenPortOutput>(result) {
1761 public GetQueueStatisticsFromGivenPortOutput createResult() {
1762 GetQueueStatisticsFromGivenPortOutputBuilder queueStatsFromPortBuilder =
1763 new GetQueueStatisticsFromGivenPortOutputBuilder()
1764 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1765 return queueStatsFromPortBuilder.build();
1774 static MultipartRequestInputBuilder createMultipartHeader(MultipartType multipart,
1775 OFRpcTaskContext taskContext, Long xid) {
1776 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1777 mprInput.setType(multipart);
1778 mprInput.setVersion(taskContext.getSession().getPrimaryConductor().getVersion());
1779 mprInput.setXid(xid);
1780 mprInput.setFlags(new MultipartRequestFlags(false));
1784 private static abstract class ResultCallback<T> implements FutureCallback<RpcResult<Void>> {
1786 private SettableFuture<RpcResult<T>> result;
1791 public ResultCallback(SettableFuture<RpcResult<T>> result) {
1792 this.result = result;
1795 public abstract T createResult();
1798 public void onSuccess(RpcResult<Void> resultArg) {
1799 result.set(RpcResultBuilder.success(createResult()).build());
1803 public void onFailure(Throwable t) {
1804 result.set(RpcResultBuilder.<T>failed().withWarning(
1806 OFConstants.ERROR_TAG_TIMEOUT,
1807 "something wrong happened",
1808 OFConstants.APPLICATION_TAG,
1814 * @param taskContext
1819 public static OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> createUpdatePortTask(
1820 final OFRpcTaskContext taskContext, final UpdatePortInput input,
1821 final SwitchConnectionDistinguisher cookie) {
1822 OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task =
1823 new OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>>(taskContext, cookie, input) {
1826 public ListenableFuture<RpcResult<UpdatePortOutput>> call() {
1827 ListenableFuture<RpcResult<UpdatePortOutput>> result = SettableFuture.create();
1828 final Long xid = taskContext.getSession().getNextXid();
1829 Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
1831 PortModInput ofPortModInput = PortConvertor.toPortModInput(inputPort,
1832 taskContext.getSession().getPrimaryConductor().getVersion());
1834 PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput);
1835 mdInput.setXid(xid);
1837 Future<RpcResult<UpdatePortOutput>> resultFromOFLib = getMessageService()
1838 .portMod(mdInput.build(), cookie);
1839 result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1850 * @param taskContext
1855 public static OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> createUpdateTableTask(
1856 final OFRpcTaskContext taskContext, final UpdateTableInput input,
1857 final SwitchConnectionDistinguisher cookie) {
1858 OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> task =
1859 new OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>>(taskContext, cookie, input) {
1862 public ListenableFuture<RpcResult<UpdateTableOutput>> call() {
1863 final SettableFuture<RpcResult<UpdateTableOutput>> result = SettableFuture.create();
1865 final Long xid = taskContext.getSession().getNextXid();
1867 MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
1868 MultipartRequestTableFeaturesBuilder requestBuilder = new MultipartRequestTableFeaturesBuilder();
1869 List<TableFeatures> ofTableFeatureList = TableFeaturesConvertor
1870 .toTableFeaturesRequest(input.getUpdatedTable());
1871 requestBuilder.setTableFeatures(ofTableFeatureList);
1872 caseBuilder.setMultipartRequestTableFeatures(requestBuilder.build());
1874 // Set request body to main multipart request
1875 MultipartRequestInputBuilder mprInput =
1876 createMultipartHeader(MultipartType.OFPMPTABLEFEATURES, taskContext, xid);
1877 mprInput.setMultipartRequestBody(caseBuilder.build());
1879 Future<RpcResult<Void>> resultFromOFLib = getMessageService()
1880 .multipartRequest(mprInput.build(), getCookie());
1881 ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
1883 Futures.addCallback(resultLib, new ResultCallback<UpdateTableOutput>(result) {
1885 public UpdateTableOutput createResult() {
1886 UpdateTableOutputBuilder queueStatsFromPortBuilder =
1887 new UpdateTableOutputBuilder()
1888 .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
1889 return queueStatsFromPortBuilder.build();