Bug 1254 - Added unit tests
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / ModelDrivenSwitchImpl.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.openflowplugin.openflow.md.core.sal;
9
10 import java.util.concurrent.Future;
11 import java.util.concurrent.TimeUnit;
12
13 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
14 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
15 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
16 import org.opendaylight.openflowplugin.openflow.md.core.session.IMessageDispatchService;
17 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
18 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
19 import org.opendaylight.openflowplugin.openflow.md.core.session.SwitchConnectionCookieOFImpl;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInput;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.ConnectionCookie;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInput;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutput;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInput;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
85 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
86 import org.opendaylight.yangtools.yang.common.RpcResult;
87 import org.slf4j.Logger;
88
89 import com.google.common.util.concurrent.Futures;
90 import com.google.common.util.concurrent.ListenableFuture;
91
92 /**
93  * RPC implementation of MD-switch
94  */
95 public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
96
97     private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(ModelDrivenSwitchImpl.class);
98     private final NodeId nodeId;
99     private final IMessageDispatchService messageService;
100     private short version = 0;
101     private NotificationProviderService rpcNotificationProviderService;
102     private OFRpcTaskContext rpcTaskContext;
103     
104     // TODO:read timeout from configSubsystem
105     protected long maxTimeout = 1000;
106     protected TimeUnit maxTimeoutUnit = TimeUnit.MILLISECONDS;
107     
108     protected ModelDrivenSwitchImpl(final NodeId nodeId, final InstanceIdentifier<Node> identifier, 
109             final SessionContext sessionContext) {
110         super(identifier, sessionContext);
111         this.nodeId = nodeId;
112         messageService = sessionContext.getMessageDispatchService();
113         version = sessionContext.getPrimaryConductor().getVersion();
114         rpcNotificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
115         
116         rpcTaskContext = new OFRpcTaskContext();
117         rpcTaskContext.setSession(sessionContext);
118         rpcTaskContext.setMessageService(messageService);
119         rpcTaskContext.setRpcNotificationProviderService(rpcNotificationProviderService);
120         rpcTaskContext.setMaxTimeout(maxTimeout);
121         rpcTaskContext.setMaxTimeoutUnit(maxTimeoutUnit);
122         rpcTaskContext.setRpcPool(OFSessionUtil.getSessionManager().getRpcPool());
123         rpcTaskContext.setMessageSpy(OFSessionUtil.getSessionManager().getMessageSpy());
124     }
125
126     @Override
127     public Future<RpcResult<AddFlowOutput>> addFlow(final AddFlowInput input) {
128         LOG.debug("Calling the FlowMod RPC method on MessageDispatchService");
129         // use primary connection
130         SwitchConnectionDistinguisher cookie = null;
131         
132         OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> task =
133                 OFRpcTaskFactory.createAddFlowTask(rpcTaskContext, input, cookie);
134         ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
135         
136         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddFlowOutput());
137     }
138
139
140     @Override
141     public Future<RpcResult<AddGroupOutput>> addGroup(final AddGroupInput input) {
142         LOG.debug("Calling the GroupMod RPC method on MessageDispatchService");
143         
144         // use primary connection
145         SwitchConnectionDistinguisher cookie = null;
146         
147         OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> task = 
148                 OFRpcTaskFactory.createAddGroupTask(rpcTaskContext, input, cookie);
149         ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
150         
151         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddGroupOutput());
152     }
153
154     @Override
155     public Future<RpcResult<AddMeterOutput>> addMeter(final AddMeterInput input) {
156         LOG.debug("Calling the MeterMod RPC method on MessageDispatchService");
157         
158         // use primary connection
159         SwitchConnectionDistinguisher cookie = null;
160         
161         OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> task = 
162                 OFRpcTaskFactory.createAddMeterTask(rpcTaskContext, input, cookie);
163         ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
164         
165         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForAddMeterOutput());
166     }
167
168     @Override
169     public Future<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
170         LOG.debug("Calling the removeFlow RPC method on MessageDispatchService");
171         
172         // use primary connection
173         SwitchConnectionDistinguisher cookie = null;
174         OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> task = 
175                 OFRpcTaskFactory.createRemoveFlowTask(rpcTaskContext, input, cookie);
176         ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
177
178         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveFlowOutput());
179     }
180
181     @Override
182     public Future<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
183         LOG.debug("Calling the Remove Group RPC method on MessageDispatchService");
184
185         SwitchConnectionDistinguisher cookie = null;
186         OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> task = 
187                 OFRpcTaskFactory.createRemoveGroupTask(rpcTaskContext, input, cookie);
188         ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
189         
190         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveGroupOutput());
191     }
192
193     @Override
194     public Future<RpcResult<RemoveMeterOutput>> removeMeter(final RemoveMeterInput input) {
195         LOG.debug("Calling the Remove MeterMod RPC method on MessageDispatchService");
196
197         SwitchConnectionDistinguisher cookie = null;
198         OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> task = 
199                 OFRpcTaskFactory.createRemoveMeterTask(rpcTaskContext, input, cookie);
200         ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
201         
202         return Futures.transform(result, OFRpcFutureResultTransformFactory.createForRemoveMeterOutput());
203     }
204
205     @Override
206     public Future<RpcResult<Void>> transmitPacket(final TransmitPacketInput input) {
207         LOG.debug("TransmitPacket - {}", input);
208         // Convert TransmitPacket to PacketOutInput
209         PacketOutInput message = PacketOutConvertor.toPacketOutInput(input, version, sessionContext.getNextXid(),
210                 sessionContext.getFeatures().getDatapathId());
211
212         SwitchConnectionDistinguisher cookie = null;
213         ConnectionCookie connectionCookie = input.getConnectionCookie();
214         if (connectionCookie != null && connectionCookie.getValue() != null) {
215             cookie = new SwitchConnectionCookieOFImpl(connectionCookie.getValue());
216         }
217
218         LOG.debug("Calling the transmitPacket RPC method");
219         return messageService.packetOut(message, cookie);
220     }
221
222     @Override
223     public Future<RpcResult<UpdateFlowOutput>> updateFlow(final UpdateFlowInput input) {
224         LOG.debug("Calling the updateFlow RPC method on MessageDispatchService");
225         
226         // use primary connection
227         SwitchConnectionDistinguisher cookie = null;
228         
229         OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task = 
230                 OFRpcTaskFactory.createUpdateFlowTask(rpcTaskContext, input, cookie);
231         ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
232         
233         return result;
234     }
235
236     @Override
237     public Future<RpcResult<UpdateGroupOutput>> updateGroup(final UpdateGroupInput input) {
238         LOG.debug("Calling the update Group Mod RPC method on MessageDispatchService");
239         
240         // use primary connection
241         SwitchConnectionDistinguisher cookie = null;
242         
243         OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> task = 
244                 OFRpcTaskFactory.createUpdateGroupTask(rpcTaskContext, input, cookie);
245         ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
246         
247         return result;
248     }
249
250     @Override
251     public Future<RpcResult<UpdateMeterOutput>> updateMeter(final UpdateMeterInput input) {
252         LOG.debug("Calling the MeterMod RPC method on MessageDispatchService");
253         
254         // use primary connection
255         SwitchConnectionDistinguisher cookie = null;
256         
257         OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> task = 
258                 OFRpcTaskFactory.createUpdateMeterTask(rpcTaskContext, input, cookie);
259         ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
260         
261         return result;
262     }
263
264     @Override
265     public NodeId getNodeId() {
266         return nodeId;
267     }
268
269     
270     @Override
271     public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(final GetAllGroupStatisticsInput input) {
272      // use primary connection
273         LOG.debug("Calling the getAllGroupStatistics RPC method on MessageDispatchService");
274         SwitchConnectionDistinguisher cookie = null;
275         
276         OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>> task = 
277                 OFRpcTaskFactory.createGetAllGroupStatisticsTask(rpcTaskContext, input, cookie);
278         ListenableFuture<RpcResult<GetAllGroupStatisticsOutput>> result = task.submit();
279         
280         return result;
281
282     }
283
284     @Override
285     public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
286         LOG.debug("Calling the getGroupDescription RPC method on MessageDispatchService");
287         SwitchConnectionDistinguisher cookie = null;
288         
289         OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>> task = 
290                 OFRpcTaskFactory.createGetGroupDescriptionTask(rpcTaskContext, input, cookie);
291         ListenableFuture<RpcResult<GetGroupDescriptionOutput>> result = task.submit();
292         return result;
293     }
294     
295     @Override
296     public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
297         LOG.debug("Calling the getGroupFeatures RPC method on MessageDispatchService");
298         SwitchConnectionDistinguisher cookie = null;
299         
300         OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>> task = 
301                 OFRpcTaskFactory.createGetGroupFeaturesTask(rpcTaskContext, input, cookie);
302         ListenableFuture<RpcResult<GetGroupFeaturesOutput>> result = task.submit();
303         return result;
304     }
305     
306     @Override
307     public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
308         LOG.debug("Calling the getGroupStatistics RPC method on MessageDispatchService");
309         SwitchConnectionDistinguisher cookie = null;
310         
311         OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>> task = 
312                 OFRpcTaskFactory.createGetGroupStatisticsTask(rpcTaskContext, input, cookie);
313         ListenableFuture<RpcResult<GetGroupStatisticsOutput>> result = task.submit();
314         return result;
315     }
316
317     @Override
318     public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
319             final GetAllMeterConfigStatisticsInput input) {
320         LOG.debug("Calling the getAllMeterConfigStatistics RPC method on MessageDispatchService");
321         SwitchConnectionDistinguisher cookie = null;
322         
323         OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>> task = 
324                 OFRpcTaskFactory.createGetAllMeterConfigStatisticsTask(rpcTaskContext, input, cookie);
325         ListenableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> result = task.submit();
326         return result;
327     }
328     
329     @Override
330     public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(
331             final GetAllMeterStatisticsInput input) {
332         LOG.debug("Calling the getAllMeterStatistics RPC method on MessageDispatchService");
333         SwitchConnectionDistinguisher cookie = null;
334         
335         OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>> task = 
336                 OFRpcTaskFactory.createGetAllMeterStatisticsTask(rpcTaskContext, input, cookie);
337         ListenableFuture<RpcResult<GetAllMeterStatisticsOutput>> result = task.submit();
338         return result;
339     }
340     
341     @Override
342     public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(
343             final GetMeterFeaturesInput input) {
344         LOG.debug("Calling the getMeterFeatures RPC method on MessageDispatchService");
345         SwitchConnectionDistinguisher cookie = null;
346         
347         OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>> task = 
348                 OFRpcTaskFactory.createGetMeterFeaturesTask(rpcTaskContext, input, cookie);
349         ListenableFuture<RpcResult<GetMeterFeaturesOutput>> result = task.submit();
350         return result;
351     }
352     
353     @Override
354     public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(
355             final GetMeterStatisticsInput input) {
356         LOG.debug("Calling the getMeterStatistics RPC method on MessageDispatchService");
357         SwitchConnectionDistinguisher cookie = null;
358         
359         OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>> task = 
360                 OFRpcTaskFactory.createGetMeterStatisticsTask(rpcTaskContext, input, cookie);
361         ListenableFuture<RpcResult<GetMeterStatisticsOutput>> result = task.submit();
362         return result;
363     }
364     
365     @Override
366     public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
367             final GetAllNodeConnectorsStatisticsInput input) {
368         LOG.debug("Calling the getAllNodeConnectorsStatistics RPC method on MessageDispatchService");
369         SwitchConnectionDistinguisher cookie = null;
370         
371         OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>> task = 
372                 OFRpcTaskFactory.createGetAllNodeConnectorsStatisticsTask(rpcTaskContext, input, cookie);
373         ListenableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> result = task.submit();
374         return result;
375     }
376     
377     @Override
378     public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
379             final GetNodeConnectorStatisticsInput input) {
380         LOG.debug("Calling the getNodeConnectorStatistics RPC method on MessageDispatchService");
381         SwitchConnectionDistinguisher cookie = null;
382         
383         OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>> task = 
384                 OFRpcTaskFactory.createGetNodeConnectorStatisticsTask(rpcTaskContext, input, cookie);
385         ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> result = task.submit();
386         return result;
387     }
388     
389     @Override
390     public Future<RpcResult<UpdatePortOutput>> updatePort(final UpdatePortInput input) {
391         LOG.debug("Calling the updatePort RPC method on MessageDispatchService");
392         
393         // use primary connection
394         SwitchConnectionDistinguisher cookie = null;
395         
396         OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task = 
397                 OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, cookie);
398         ListenableFuture<RpcResult<UpdatePortOutput>> result = task.submit();
399         
400         return result;
401     }
402
403     @Override
404     public Future<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
405         LOG.debug("Calling the updateTable RPC method on MessageDispatchService");
406         
407         SwitchConnectionDistinguisher cookie = null;
408         
409         OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> task = 
410                 OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, cookie);
411         ListenableFuture<RpcResult<UpdateTableOutput>> result = task.submit();
412         
413         return result;
414     }
415
416     @Override
417     public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
418             final GetAllFlowStatisticsFromFlowTableInput input) {
419         LOG.debug("Calling the getAllFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
420         SwitchConnectionDistinguisher cookie = null;
421         
422         OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> task = 
423                 OFRpcTaskFactory.createGetAllFlowStatisticsFromFlowTableTask(rpcTaskContext, input, cookie);
424         ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> result = task.submit();
425         return result;
426     }
427     
428     @Override
429     public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
430             final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
431         LOG.debug("Calling the getAllFlowsStatisticsFromAllFlowTables RPC method on MessageDispatchService");
432         SwitchConnectionDistinguisher cookie = null;
433         
434         OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput, RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> task = 
435                 OFRpcTaskFactory.createGetAllFlowsStatisticsFromAllFlowTablesTask(rpcTaskContext, input, cookie);
436         ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> result = task.submit();
437         return result;
438     }
439     
440     @Override
441     public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
442             final GetFlowStatisticsFromFlowTableInput input) {
443         LOG.debug("Calling the getFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
444         SwitchConnectionDistinguisher cookie = null;
445         
446         OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> task = 
447                 OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, cookie);
448         ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> result = task.submit();
449         return result;
450     }
451     
452     @Override
453     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
454             final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
455         LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForAllFlows RPC method on MessageDispatchService");
456         SwitchConnectionDistinguisher cookie = null;
457         
458         OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> task = 
459                 OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForAllFlowsTask(rpcTaskContext, input, cookie);
460         ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> result = task.submit();
461         return result;
462     }
463     
464     @Override
465     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
466             final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
467         LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForGivenMatch RPC method on MessageDispatchService");
468         SwitchConnectionDistinguisher cookie = null;
469         
470         OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> task = 
471                 OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, cookie);
472         ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> result = task.submit();
473         return result;
474     }
475     
476     @Override
477     public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
478             final GetFlowTablesStatisticsInput input) {
479         LOG.debug("Calling the getFlowTablesStatistics RPC method on MessageDispatchService");
480         SwitchConnectionDistinguisher cookie = null;
481         
482         OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>> task = 
483                 OFRpcTaskFactory.createGetFlowTablesStatisticsTask(rpcTaskContext, input, cookie);
484         ListenableFuture<RpcResult<GetFlowTablesStatisticsOutput>> result = task.submit();
485         return result;
486     }
487     
488     @Override
489     public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
490             final GetAllQueuesStatisticsFromAllPortsInput input) {
491         LOG.debug("Calling the getAllQueuesStatisticsFromAllPorts RPC method on MessageDispatchService");
492         SwitchConnectionDistinguisher cookie = null;
493         
494         OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> task = 
495                 OFRpcTaskFactory.createGetAllQueuesStatisticsFromAllPortsTask(rpcTaskContext, input, cookie);
496         ListenableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> result = task.submit();
497         return result;
498     }
499     
500     @Override
501     public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
502             final GetAllQueuesStatisticsFromGivenPortInput input) {
503         LOG.debug("Calling the getAllQueuesStatisticsFromGivenPort RPC method on MessageDispatchService");
504         SwitchConnectionDistinguisher cookie = null;
505         
506         OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> task = 
507                 OFRpcTaskFactory.createGetAllQueuesStatisticsFromGivenPortTask(rpcTaskContext, input, cookie);
508         ListenableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> result = task.submit();
509         return result;
510     }
511     
512     @Override
513     public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
514             final GetQueueStatisticsFromGivenPortInput input) {
515         LOG.debug("Calling the getQueueStatisticsFromGivenPort RPC method on MessageDispatchService");
516         SwitchConnectionDistinguisher cookie = null;
517         
518         OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>> task = 
519                 OFRpcTaskFactory.createGetQueueStatisticsFromGivenPortTask(rpcTaskContext, input, cookie);
520         ListenableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> result = task.submit();
521         return result;
522     }
523 }