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;
14 import java.util.concurrent.TimeUnit;
16 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
17 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
18 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
19 import org.opendaylight.openflowplugin.openflow.md.core.session.IMessageDispatchService;
20 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
21 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
22 import org.opendaylight.openflowplugin.openflow.md.core.session.SwitchConnectionCookieOFImpl;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInput;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.MatchBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.ConnectionCookie;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInput;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutput;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInput;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
94 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
95 import org.opendaylight.yangtools.yang.common.RpcResult;
96 import org.slf4j.Logger;
98 import com.google.common.util.concurrent.Futures;
99 import com.google.common.util.concurrent.JdkFutureAdapters;
100 import com.google.common.util.concurrent.ListenableFuture;
103 * RPC implementation of MD-switch
105 public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
107 private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(ModelDrivenSwitchImpl.class);
108 private final NodeId nodeId;
109 private final IMessageDispatchService messageService;
110 private short version = 0;
111 private NotificationProviderService rpcNotificationProviderService;
112 private OFRpcTaskContext rpcTaskContext;
114 // TODO:read timeout from configSubsystem
115 protected long maxTimeout = 1000;
116 protected TimeUnit maxTimeoutUnit = TimeUnit.MILLISECONDS;
118 protected ModelDrivenSwitchImpl(final NodeId nodeId, final InstanceIdentifier<Node> identifier,
119 final SessionContext sessionContext) {
120 super(identifier, sessionContext);
121 this.nodeId = nodeId;
122 messageService = sessionContext.getMessageDispatchService();
123 version = sessionContext.getPrimaryConductor().getVersion();
124 rpcNotificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
126 rpcTaskContext = new OFRpcTaskContext();
127 rpcTaskContext.setSession(sessionContext);
128 rpcTaskContext.setMessageService(messageService);
129 rpcTaskContext.setRpcNotificationProviderService(rpcNotificationProviderService);
130 rpcTaskContext.setMaxTimeout(maxTimeout);
131 rpcTaskContext.setMaxTimeoutUnit(maxTimeoutUnit);
132 rpcTaskContext.setRpcPool(OFSessionUtil.getSessionManager().getRpcPool());
133 rpcTaskContext.setMessageSpy(OFSessionUtil.getSessionManager().getMessageSpy());
137 public Future<RpcResult<AddFlowOutput>> addFlow(final AddFlowInput input) {
138 LOG.debug("Calling the FlowMod RPC method on MessageDispatchService");
139 // use primary connection
140 SwitchConnectionDistinguisher cookie = null;
142 OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> task =
143 OFRpcTaskFactory.createAddFlowTask(rpcTaskContext, input, cookie);
144 ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
146 return Futures.transform(JdkFutureAdapters.listenInPoolThread(result),
147 OFRpcFutureResultTransformFactory.createForAddFlowOutput());
152 public Future<RpcResult<AddGroupOutput>> addGroup(final AddGroupInput input) {
153 LOG.debug("Calling the GroupMod RPC method on MessageDispatchService");
155 // use primary connection
156 SwitchConnectionDistinguisher cookie = null;
158 OFRpcTask<AddGroupInput, RpcResult<UpdateGroupOutput>> task =
159 OFRpcTaskFactory.createAddGroupTask(rpcTaskContext, input, cookie);
160 ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
162 return Futures.transform(JdkFutureAdapters.listenInPoolThread(result),
163 OFRpcFutureResultTransformFactory.createForAddGroupOutput());
167 public Future<RpcResult<AddMeterOutput>> addMeter(final AddMeterInput input) {
168 LOG.debug("Calling the MeterMod RPC method on MessageDispatchService");
170 // use primary connection
171 SwitchConnectionDistinguisher cookie = null;
173 OFRpcTask<AddMeterInput, RpcResult<UpdateMeterOutput>> task =
174 OFRpcTaskFactory.createAddMeterTask(rpcTaskContext, input, cookie);
175 ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
177 return Futures.transform(JdkFutureAdapters.listenInPoolThread(result),
178 OFRpcFutureResultTransformFactory.createForAddMeterOutput());
182 public Future<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
183 LOG.debug("Calling the removeFlow RPC method on MessageDispatchService");
185 // use primary connection
186 SwitchConnectionDistinguisher cookie = null;
187 OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> task =
188 OFRpcTaskFactory.createRemoveFlowTask(rpcTaskContext, input, cookie);
189 ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
191 return Futures.transform(JdkFutureAdapters.listenInPoolThread(result),
192 OFRpcFutureResultTransformFactory.createForRemoveFlowOutput());
196 public Future<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
197 LOG.debug("Calling the Remove Group RPC method on MessageDispatchService");
199 SwitchConnectionDistinguisher cookie = null;
200 OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> task =
201 OFRpcTaskFactory.createRemoveGroupTask(rpcTaskContext, input, cookie);
202 ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
204 return Futures.transform(JdkFutureAdapters.listenInPoolThread(result),
205 OFRpcFutureResultTransformFactory.createForRemoveGroupOutput());
209 public Future<RpcResult<RemoveMeterOutput>> removeMeter(final RemoveMeterInput input) {
210 LOG.debug("Calling the Remove MeterMod RPC method on MessageDispatchService");
212 SwitchConnectionDistinguisher cookie = null;
213 OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> task =
214 OFRpcTaskFactory.createRemoveMeterTask(rpcTaskContext, input, cookie);
215 ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
217 return Futures.transform(JdkFutureAdapters.listenInPoolThread(result),
218 OFRpcFutureResultTransformFactory.createForRemoveMeterOutput());
222 public Future<RpcResult<Void>> transmitPacket(final TransmitPacketInput input) {
223 LOG.debug("TransmitPacket - {}", input);
224 // Convert TransmitPacket to PacketOutInput
225 PacketOutInput message = PacketOutConvertor.toPacketOutInput(input, version, sessionContext.getNextXid(),
226 sessionContext.getFeatures().getDatapathId());
228 SwitchConnectionDistinguisher cookie = null;
229 ConnectionCookie connectionCookie = input.getConnectionCookie();
230 if (connectionCookie != null && connectionCookie.getValue() != null) {
231 cookie = new SwitchConnectionCookieOFImpl(connectionCookie.getValue());
234 LOG.debug("Calling the transmitPacket RPC method");
235 return messageService.packetOut(message, cookie);
238 private FlowModInputBuilder toFlowModInputBuilder(final Flow source) {
239 FlowModInputBuilder target = new FlowModInputBuilder();
240 target.setCookie(source.getCookie().getValue());
241 target.setIdleTimeout(source.getIdleTimeout());
242 target.setHardTimeout(source.getHardTimeout());
243 target.setMatch(toMatch(source.getMatch()));
248 private Match toMatch(final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match match) {
249 MatchBuilder target = new MatchBuilder();
251 target.setMatchEntries(toMatchEntries(match));
256 private List<MatchEntries> toMatchEntries(
257 final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match match) {
258 List<MatchEntries> entries = new ArrayList<>();
264 public Future<RpcResult<UpdateFlowOutput>> updateFlow(final UpdateFlowInput input) {
265 LOG.debug("Calling the updateFlow RPC method on MessageDispatchService");
267 // use primary connection
268 SwitchConnectionDistinguisher cookie = null;
270 OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task =
271 OFRpcTaskFactory.createUpdateFlowTask(rpcTaskContext, input, cookie);
272 ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
278 public Future<RpcResult<UpdateGroupOutput>> updateGroup(final UpdateGroupInput input) {
279 LOG.debug("Calling the update Group Mod RPC method on MessageDispatchService");
281 // use primary connection
282 SwitchConnectionDistinguisher cookie = null;
284 OFRpcTask<UpdateGroupInput, RpcResult<UpdateGroupOutput>> task =
285 OFRpcTaskFactory.createUpdateGroupTask(rpcTaskContext, input, cookie);
286 ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
292 public Future<RpcResult<UpdateMeterOutput>> updateMeter(final UpdateMeterInput input) {
293 LOG.debug("Calling the MeterMod RPC method on MessageDispatchService");
295 // use primary connection
296 SwitchConnectionDistinguisher cookie = null;
298 OFRpcTask<UpdateMeterInput, RpcResult<UpdateMeterOutput>> task =
299 OFRpcTaskFactory.createUpdateMeterTask(rpcTaskContext, input, cookie);
300 ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
306 public NodeId getNodeId() {
312 public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(final GetAllGroupStatisticsInput input) {
313 // use primary connection
314 LOG.debug("Calling the getAllGroupStatistics RPC method on MessageDispatchService");
315 SwitchConnectionDistinguisher cookie = null;
317 OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>> task =
318 OFRpcTaskFactory.createGetAllGroupStatisticsTask(rpcTaskContext, input, cookie);
319 ListenableFuture<RpcResult<GetAllGroupStatisticsOutput>> result = task.submit();
326 public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
327 LOG.debug("Calling the getGroupDescription RPC method on MessageDispatchService");
328 SwitchConnectionDistinguisher cookie = null;
330 OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>> task =
331 OFRpcTaskFactory.createGetGroupDescriptionTask(rpcTaskContext, input, cookie);
332 ListenableFuture<RpcResult<GetGroupDescriptionOutput>> result = task.submit();
337 public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
338 LOG.debug("Calling the getGroupFeatures RPC method on MessageDispatchService");
339 SwitchConnectionDistinguisher cookie = null;
341 OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>> task =
342 OFRpcTaskFactory.createGetGroupFeaturesTask(rpcTaskContext, input, cookie);
343 ListenableFuture<RpcResult<GetGroupFeaturesOutput>> result = task.submit();
348 public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
349 LOG.debug("Calling the getGroupStatistics RPC method on MessageDispatchService");
350 SwitchConnectionDistinguisher cookie = null;
352 OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>> task =
353 OFRpcTaskFactory.createGetGroupStatisticsTask(rpcTaskContext, input, cookie);
354 ListenableFuture<RpcResult<GetGroupStatisticsOutput>> result = task.submit();
359 public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
360 final GetAllMeterConfigStatisticsInput input) {
361 LOG.debug("Calling the getAllMeterConfigStatistics RPC method on MessageDispatchService");
362 SwitchConnectionDistinguisher cookie = null;
364 OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>> task =
365 OFRpcTaskFactory.createGetAllMeterConfigStatisticsTask(rpcTaskContext, input, cookie);
366 ListenableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> result = task.submit();
371 public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(
372 final GetAllMeterStatisticsInput input) {
373 LOG.debug("Calling the getAllMeterStatistics RPC method on MessageDispatchService");
374 SwitchConnectionDistinguisher cookie = null;
376 OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>> task =
377 OFRpcTaskFactory.createGetAllMeterStatisticsTask(rpcTaskContext, input, cookie);
378 ListenableFuture<RpcResult<GetAllMeterStatisticsOutput>> result = task.submit();
383 public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(
384 final GetMeterFeaturesInput input) {
385 LOG.debug("Calling the getMeterFeatures RPC method on MessageDispatchService");
386 SwitchConnectionDistinguisher cookie = null;
388 OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>> task =
389 OFRpcTaskFactory.createGetMeterFeaturesTask(rpcTaskContext, input, cookie);
390 ListenableFuture<RpcResult<GetMeterFeaturesOutput>> result = task.submit();
395 public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(
396 final GetMeterStatisticsInput input) {
397 LOG.debug("Calling the getMeterStatistics RPC method on MessageDispatchService");
398 SwitchConnectionDistinguisher cookie = null;
400 OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>> task =
401 OFRpcTaskFactory.createGetMeterStatisticsTask(rpcTaskContext, input, cookie);
402 ListenableFuture<RpcResult<GetMeterStatisticsOutput>> result = task.submit();
407 public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
408 final GetAllNodeConnectorsStatisticsInput input) {
409 LOG.debug("Calling the getAllNodeConnectorsStatistics RPC method on MessageDispatchService");
410 SwitchConnectionDistinguisher cookie = null;
412 OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>> task =
413 OFRpcTaskFactory.createGetAllNodeConnectorsStatisticsTask(rpcTaskContext, input, cookie);
414 ListenableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> result = task.submit();
419 public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
420 final GetNodeConnectorStatisticsInput input) {
421 LOG.debug("Calling the getNodeConnectorStatistics RPC method on MessageDispatchService");
422 SwitchConnectionDistinguisher cookie = null;
424 OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>> task =
425 OFRpcTaskFactory.createGetNodeConnectorStatisticsTask(rpcTaskContext, input, cookie);
426 ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> result = task.submit();
430 private static TransactionId generateTransactionId(final Long xid) {
431 BigInteger bigIntXid = BigInteger.valueOf(xid);
432 return new TransactionId(bigIntXid);
436 public Future<RpcResult<UpdatePortOutput>> updatePort(final UpdatePortInput input) {
437 LOG.debug("Calling the updatePort RPC method on MessageDispatchService");
439 // use primary connection
440 SwitchConnectionDistinguisher cookie = null;
442 OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task =
443 OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, cookie);
444 ListenableFuture<RpcResult<UpdatePortOutput>> result = task.submit();
450 public Future<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
451 LOG.debug("Calling the updateTable RPC method on MessageDispatchService");
453 SwitchConnectionDistinguisher cookie = null;
455 OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> task =
456 OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, cookie);
457 ListenableFuture<RpcResult<UpdateTableOutput>> result = task.submit();
463 public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
464 final GetAllFlowStatisticsFromFlowTableInput input) {
465 LOG.debug("Calling the getAllFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
466 SwitchConnectionDistinguisher cookie = null;
468 OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> task =
469 OFRpcTaskFactory.createGetAllFlowStatisticsFromFlowTableTask(rpcTaskContext, input, cookie);
470 ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> result = task.submit();
475 public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
476 final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
477 LOG.debug("Calling the getAllFlowsStatisticsFromAllFlowTables RPC method on MessageDispatchService");
478 SwitchConnectionDistinguisher cookie = null;
480 OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput, RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> task =
481 OFRpcTaskFactory.createGetAllFlowsStatisticsFromAllFlowTablesTask(rpcTaskContext, input, cookie);
482 ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> result = task.submit();
487 public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
488 final GetFlowStatisticsFromFlowTableInput input) {
489 LOG.debug("Calling the getFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
490 SwitchConnectionDistinguisher cookie = null;
492 OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> task =
493 OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, cookie);
494 ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> result = task.submit();
499 public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
500 final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
501 LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForAllFlows RPC method on MessageDispatchService");
502 SwitchConnectionDistinguisher cookie = null;
504 OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> task =
505 OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForAllFlowsTask(rpcTaskContext, input, cookie);
506 ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> result = task.submit();
511 public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
512 final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
513 LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForGivenMatch RPC method on MessageDispatchService");
514 SwitchConnectionDistinguisher cookie = null;
516 OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> task =
517 OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, cookie);
518 ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> result = task.submit();
523 public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
524 final GetFlowTablesStatisticsInput input) {
525 LOG.debug("Calling the getFlowTablesStatistics RPC method on MessageDispatchService");
526 SwitchConnectionDistinguisher cookie = null;
528 OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>> task =
529 OFRpcTaskFactory.createGetFlowTablesStatisticsTask(rpcTaskContext, input, cookie);
530 ListenableFuture<RpcResult<GetFlowTablesStatisticsOutput>> result = task.submit();
535 public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
536 final GetAllQueuesStatisticsFromAllPortsInput input) {
537 LOG.debug("Calling the getAllQueuesStatisticsFromAllPorts RPC method on MessageDispatchService");
538 SwitchConnectionDistinguisher cookie = null;
540 OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> task =
541 OFRpcTaskFactory.createGetAllQueuesStatisticsFromAllPortsTask(rpcTaskContext, input, cookie);
542 ListenableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> result = task.submit();
547 public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
548 final GetAllQueuesStatisticsFromGivenPortInput input) {
549 LOG.debug("Calling the getAllQueuesStatisticsFromGivenPort RPC method on MessageDispatchService");
550 SwitchConnectionDistinguisher cookie = null;
552 OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> task =
553 OFRpcTaskFactory.createGetAllQueuesStatisticsFromGivenPortTask(rpcTaskContext, input, cookie);
554 ListenableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> result = task.submit();
559 public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
560 final GetQueueStatisticsFromGivenPortInput input) {
561 LOG.debug("Calling the getQueueStatisticsFromGivenPort RPC method on MessageDispatchService");
562 SwitchConnectionDistinguisher cookie = null;
564 OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>> task =
565 OFRpcTaskFactory.createGetQueueStatisticsFromGivenPortTask(rpcTaskContext, input, cookie);
566 ListenableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> result = task.submit();