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.Collection;
13 import java.util.Collections;
14 import java.util.List;
15 import java.util.concurrent.Future;
17 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
18 import org.opendaylight.controller.sal.common.util.Rpcs;
19 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
20 import org.opendaylight.openflowplugin.openflow.md.OFConstants;
21 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
22 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowConvertor;
23 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
24 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
25 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
26 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
27 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.TableFeaturesConvertor;
28 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
29 import org.opendaylight.openflowplugin.openflow.md.core.session.IMessageDispatchService;
30 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
31 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
32 import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
33 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutputBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdatedBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutputBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutputBuilder;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutputBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAddedBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemovedBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdatedBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutputBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutputBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutputBuilder;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutputBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutputBuilder;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutputBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutputBuilder;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAddedBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemovedBuilder;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdatedBuilder;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutputBuilder;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutputBuilder;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutputBuilder;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutputBuilder;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInput;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutputBuilder;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutputBuilder;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Group;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Meter;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.v10.grouping.MatchV10Builder;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder;
136 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
137 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
138 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
139 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
140 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.Match;
141 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.MatchBuilder;
142 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
143 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
144 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCaseBuilder;
145 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
146 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;
147 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder;
148 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterConfigCaseBuilder;
149 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;
150 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;
151 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
152 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
153 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder;
154 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
155 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
156 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
157 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
158 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder;
159 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
160 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
161 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
162 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;
163 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;
164 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
165 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.GetPortOutput;
166 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
167 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
168 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutputBuilder;
169 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
170 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
171 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutputBuilder;
172 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
173 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
174 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutputBuilder;
175 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
176 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
177 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
178 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInput;
179 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutput;
180 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutputBuilder;
181 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInput;
182 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
183 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutputBuilder;
184 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
185 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
186 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
187 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
188 import org.opendaylight.yangtools.yang.common.RpcError;
189 import org.opendaylight.yangtools.yang.common.RpcResult;
190 import org.slf4j.Logger;
192 import com.google.common.base.Objects;
193 import com.google.common.util.concurrent.Futures;
196 * RPC implementation of MD-switch
198 public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
200 private static final Logger LOG = org.slf4j.LoggerFactory
201 .getLogger(ModelDrivenSwitchImpl.class);
202 private final NodeId nodeId;
203 private final IMessageDispatchService messageService ;
204 private short version = 0;
205 private SessionContext session;
206 NotificationProviderService rpcNotificationProviderService;
208 protected ModelDrivenSwitchImpl(NodeId nodeId,
209 InstanceIdentifier<Node> identifier, SessionContext context) {
210 super(identifier, context);
211 this.nodeId = nodeId;
212 messageService = sessionContext.getMessageDispatchService() ;
213 version = context.getPrimaryConductor().getVersion();
214 this.session = context;
215 rpcNotificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
220 public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
221 LOG.debug("Calling the FlowMod RPC method on MessageDispatchService");
223 // For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
224 // the request can be routed through any connection to the switch
226 SwitchConnectionDistinguisher cookie = null ;
227 if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
228 xId = session.getNextXid();
229 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
230 barrierInput.setVersion(version);
231 barrierInput.setXid(xId);
232 @SuppressWarnings("unused")
233 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
236 // Convert the AddFlowInput to FlowModInput
237 FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(input, version);
238 xId = session.getNextXid();
239 ofFlowModInput.setXid(xId);
241 if (null != rpcNotificationProviderService) {
242 FlowAddedBuilder newFlow = new FlowAddedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow)input);
243 newFlow.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
244 newFlow.setFlowRef(input.getFlowRef());
245 rpcNotificationProviderService.publish(newFlow.build());
248 Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = messageService.flowMod(ofFlowModInput.build(), cookie) ;
249 RpcResult<UpdateFlowOutput> rpcResultFromOFLib = null ;
252 rpcResultFromOFLib = resultFromOFLib.get();
253 } catch( Exception ex ) {
254 LOG.error( " Error while getting result for AddFlow RPC" + ex.getMessage());
257 UpdateFlowOutput updateFlowOutput = rpcResultFromOFLib.getResult() ;
259 AddFlowOutputBuilder addFlowOutput = new AddFlowOutputBuilder() ;
260 addFlowOutput.setTransactionId(updateFlowOutput.getTransactionId()) ;
261 AddFlowOutput result = addFlowOutput.build();
263 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
264 RpcResult<AddFlowOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
266 LOG.debug("Returning the Add Flow RPC result to MD-SAL");
267 return Futures.immediateFuture(rpcResult);
271 public Future<RpcResult<AddGroupOutput>> addGroup(AddGroupInput input) {
272 LOG.debug("Calling the GroupMod RPC method on MessageDispatchService");
275 // For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
276 // the request can be routed through any connection to the switch
278 SwitchConnectionDistinguisher cookie = null ;
279 if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
280 xId = session.getNextXid();
281 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
282 barrierInput.setVersion(version);
283 barrierInput.setXid(xId);
284 @SuppressWarnings("unused")
285 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
288 // Convert the AddGroupInput to GroupModInput
289 GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(input, version);
290 xId = session.getNextXid();
291 ofGroupModInput.setXid(xId);
293 if (null != rpcNotificationProviderService) {
294 GroupAddedBuilder groupMod = new GroupAddedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group)input);
295 groupMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
296 groupMod.setGroupRef(input.getGroupRef());
297 rpcNotificationProviderService.publish(groupMod.build());
300 Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = messageService.groupMod(ofGroupModInput.build(), cookie) ;
301 RpcResult<UpdateGroupOutput> rpcResultFromOFLib = null ;
304 rpcResultFromOFLib = resultFromOFLib.get();
305 } catch( Exception ex ) {
306 LOG.error( " Error while getting result for AddGroup RPC" + ex.getMessage());
309 UpdateGroupOutput updateGroupOutput = rpcResultFromOFLib.getResult() ;
311 AddGroupOutputBuilder addGroupOutput = new AddGroupOutputBuilder() ;
312 addGroupOutput.setTransactionId(updateGroupOutput.getTransactionId()) ;
313 AddGroupOutput result = addGroupOutput.build();
315 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
316 RpcResult<AddGroupOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
318 LOG.debug("Returning the Add Group RPC result to MD-SAL");
319 return Futures.immediateFuture(rpcResult);
323 public Future<RpcResult<AddMeterOutput>> addMeter(AddMeterInput input) {
324 LOG.debug("Calling the MeterMod RPC method on MessageDispatchService");
326 // For Meter provisioning, the SwitchConnectionDistinguisher is set to null so
327 // the request can be routed through any connection to the switch
329 SwitchConnectionDistinguisher cookie = null ;
330 if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
331 xId = session.getNextXid();
332 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
333 barrierInput.setVersion(version);
334 barrierInput.setXid(xId);
335 @SuppressWarnings("unused")
336 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
339 // Convert the AddMeterInput to MeterModInput
340 MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(input, version);
341 xId = session.getNextXid();
342 ofMeterModInput.setXid(xId);
344 if (null != rpcNotificationProviderService) {
345 MeterAddedBuilder meterMod = new MeterAddedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter)input);
346 meterMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
347 meterMod.setMeterRef(input.getMeterRef());
348 rpcNotificationProviderService.publish(meterMod.build());
351 Future<RpcResult<UpdateMeterOutput>> resultFromOFLib = messageService.meterMod(ofMeterModInput.build(), cookie) ;
353 RpcResult<UpdateMeterOutput> rpcResultFromOFLib = null ;
356 rpcResultFromOFLib = resultFromOFLib.get();
357 } catch( Exception ex ) {
358 LOG.error( " Error while getting result for AddMeter RPC" + ex.getMessage());
361 UpdateMeterOutput updateMeterOutput = rpcResultFromOFLib.getResult() ;
363 AddMeterOutputBuilder addMeterOutput = new AddMeterOutputBuilder() ;
364 addMeterOutput.setTransactionId(updateMeterOutput.getTransactionId()) ;
365 AddMeterOutput result = addMeterOutput.build();
367 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
368 RpcResult<AddMeterOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
370 LOG.debug("Returning the Add Meter RPC result to MD-SAL");
371 return Futures.immediateFuture(rpcResult);
375 public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
376 LOG.debug("Calling the removeFlow RPC method on MessageDispatchService");
378 // For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
379 // the request can be routed through any connection to the switch
381 SwitchConnectionDistinguisher cookie = null ;
382 if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
383 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
384 xId = session.getNextXid();
385 barrierInput.setXid(xId);
386 barrierInput.setVersion(version);
387 @SuppressWarnings("unused")
388 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
391 // Convert the RemoveFlowInput to FlowModInput
392 FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(input, version);
393 xId = session.getNextXid();
394 ofFlowModInput.setXid(xId);
396 if (null != rpcNotificationProviderService) {
397 FlowRemovedBuilder removeFlow = new FlowRemovedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow)input);
398 removeFlow.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
399 removeFlow.setFlowRef(input.getFlowRef());
400 rpcNotificationProviderService.publish(removeFlow.build());
403 Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = messageService.flowMod(ofFlowModInput.build(), cookie) ;
405 RpcResult<UpdateFlowOutput> rpcResultFromOFLib = null ;
408 rpcResultFromOFLib = resultFromOFLib.get();
409 } catch( Exception ex ) {
410 LOG.error( " Error while getting result for remove Flow RPC" + ex.getMessage());
413 UpdateFlowOutput updateFlowOutput = rpcResultFromOFLib.getResult() ;
415 RemoveFlowOutputBuilder removeFlowOutput = new RemoveFlowOutputBuilder() ;
416 removeFlowOutput.setTransactionId(updateFlowOutput.getTransactionId()) ;
417 RemoveFlowOutput result = removeFlowOutput.build();
419 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
420 RpcResult<RemoveFlowOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
422 LOG.debug("Returning the Remove Flow RPC result to MD-SAL");
423 return Futures.immediateFuture(rpcResult);
427 public Future<RpcResult<RemoveGroupOutput>> removeGroup(
428 RemoveGroupInput input) {
429 LOG.debug("Calling the Remove Group RPC method on MessageDispatchService");
432 // For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
433 // the request can be routed through any connection to the switch
435 SwitchConnectionDistinguisher cookie = null ;
436 if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
437 xId = session.getNextXid();
438 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
439 barrierInput.setVersion(version);
440 barrierInput.setXid(xId);
441 @SuppressWarnings("unused")
442 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
445 // Convert the RemoveGroupInput to GroupModInput
446 GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(input, version);
447 xId = session.getNextXid();
448 ofGroupModInput.setXid(xId);
450 if (null != rpcNotificationProviderService) {
451 GroupRemovedBuilder groupMod = new GroupRemovedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group)input);
452 groupMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
453 groupMod.setGroupRef(input.getGroupRef());
454 rpcNotificationProviderService.publish(groupMod.build());
457 Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = messageService.groupMod(ofGroupModInput.build(), cookie) ;
459 RpcResult<UpdateGroupOutput> rpcResultFromOFLib = null ;
462 rpcResultFromOFLib = resultFromOFLib.get();
463 } catch( Exception ex ) {
464 LOG.error( " Error while getting result for RemoveGroup RPC" + ex.getMessage());
467 UpdateGroupOutput updateGroupOutput = rpcResultFromOFLib.getResult() ;
469 RemoveGroupOutputBuilder removeGroupOutput = new RemoveGroupOutputBuilder() ;
470 removeGroupOutput.setTransactionId(updateGroupOutput.getTransactionId()) ;
471 RemoveGroupOutput result = removeGroupOutput.build();
473 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
474 RpcResult<RemoveGroupOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
476 LOG.debug("Returning the Remove Group RPC result to MD-SAL");
477 return Futures.immediateFuture(rpcResult);
481 public Future<RpcResult<RemoveMeterOutput>> removeMeter(
482 RemoveMeterInput input) {
483 LOG.debug("Calling the Remove MeterMod RPC method on MessageDispatchService");
486 // For Meter provisioning, the SwitchConnectionDistinguisher is set to null so
487 // the request can be routed through any connection to the switch
488 SwitchConnectionDistinguisher cookie = null ;
489 if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
490 xId = session.getNextXid();
491 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
492 barrierInput.setVersion(version);
493 barrierInput.setXid(xId);
494 @SuppressWarnings("unused")
495 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
498 // Convert the RemoveMeterInput to MeterModInput
499 MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(input, version);
500 xId = session.getNextXid();
501 ofMeterModInput.setXid(xId);
503 if (null != rpcNotificationProviderService) {
504 MeterRemovedBuilder meterMod = new MeterRemovedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter)input);
505 meterMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
506 meterMod.setMeterRef(input.getMeterRef());
507 rpcNotificationProviderService.publish(meterMod.build());
510 Future<RpcResult<UpdateMeterOutput>> resultFromOFLib = messageService.meterMod(ofMeterModInput.build(), cookie) ;
512 RpcResult<UpdateMeterOutput> rpcResultFromOFLib = null ;
515 rpcResultFromOFLib = resultFromOFLib.get();
516 } catch( Exception ex ) {
517 LOG.error( " Error while getting result for RemoveMeter RPC" + ex.getMessage());
520 UpdateMeterOutput updatemeterOutput = rpcResultFromOFLib.getResult() ;
522 RemoveMeterOutputBuilder removeMeterOutput = new RemoveMeterOutputBuilder() ;
523 removeMeterOutput.setTransactionId(updatemeterOutput.getTransactionId()) ;
524 RemoveMeterOutput result = removeMeterOutput.build();
526 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
527 RpcResult<RemoveMeterOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
529 LOG.debug("Returning the Remove Meter RPC result to MD-SAL");
530 return Futures.immediateFuture(rpcResult);
534 public Future<RpcResult<Void>> transmitPacket(TransmitPacketInput input) {
535 LOG.info("TransmitPacket - {}",input);
536 // Convert TransmitPacket to PacketOutInput
537 PacketOutInput message = PacketOutConvertor.toPacketOutInput(input, version, sessionContext.getNextXid());
539 // TODO VD NULL for yet - find how to translate cookie from TransmitPacketInput
540 // SwitchConnectionDistinguisher cookie = ( "what is need to do" ) input.getCookie();
541 SwitchConnectionDistinguisher cookie = null ;
543 LOG.debug("Calling the transmitPacket RPC method");
544 return messageService.packetOut(message, cookie);
547 private FlowModInputBuilder toFlowModInputBuilder(Flow source) {
548 FlowModInputBuilder target = new FlowModInputBuilder();
549 target.setCookie(source.getCookie());
550 target.setIdleTimeout(source.getIdleTimeout());
551 target.setHardTimeout(source.getHardTimeout());
552 target.setMatch(toMatch(source.getMatch()));
557 private Match toMatch(
558 org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match match) {
559 MatchBuilder target = new MatchBuilder();
561 target.setMatchEntries(toMatchEntries(match));
566 private List<MatchEntries> toMatchEntries(
567 org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match match) {
568 List<MatchEntries> entries = new ArrayList<>();
574 public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
575 LOG.debug("Calling the updateFlow RPC method on MessageDispatchService");
577 // Call the RPC method on MessageDispatchService
579 // For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
580 // the request can be routed through any connection to the switch
582 SwitchConnectionDistinguisher cookie = null ;
583 if (Objects.firstNonNull(input.getUpdatedFlow().isBarrier(), Boolean.FALSE)) {
584 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
585 xId = session.getNextXid();
586 barrierInput.setVersion(version);
587 barrierInput.setXid(xId);
588 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
591 // Convert the UpdateFlowInput to FlowModInput
592 FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(input.getUpdatedFlow(), version);
593 xId = session.getNextXid();
594 ofFlowModInput.setXid(xId);
596 if (null != rpcNotificationProviderService) {
597 FlowUpdatedBuilder updateFlow =
598 new FlowUpdatedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow)input.getUpdatedFlow());
599 updateFlow.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
600 updateFlow.setFlowRef(input.getFlowRef());
601 rpcNotificationProviderService.publish(updateFlow.build());
604 Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = messageService.flowMod(ofFlowModInput.build(), cookie) ;
606 RpcResult<UpdateFlowOutput> rpcResultFromOFLib = null ;
609 rpcResultFromOFLib = resultFromOFLib.get();
610 } catch( Exception ex ) {
611 LOG.error( " Error while getting result for UpdateFlow RPC" + ex.getMessage());
614 UpdateFlowOutput updateFlowOutputOFLib = rpcResultFromOFLib.getResult() ;
616 UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder() ;
617 updateFlowOutput.setTransactionId(updateFlowOutputOFLib.getTransactionId()) ;
618 UpdateFlowOutput result = updateFlowOutput.build();
620 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
621 RpcResult<UpdateFlowOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
623 LOG.debug("Returning the Update Flow RPC result to MD-SAL");
624 return Futures.immediateFuture(rpcResult);
628 public Future<RpcResult<UpdateGroupOutput>> updateGroup(
629 UpdateGroupInput input) {
630 LOG.debug("Calling the update Group Mod RPC method on MessageDispatchService");
633 // For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
634 // the request can be routed through any connection to the switch
636 SwitchConnectionDistinguisher cookie = null ;
637 if (Objects.firstNonNull(input.getUpdatedGroup().isBarrier(), Boolean.FALSE)) {
638 xId = session.getNextXid();
639 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
640 barrierInput.setVersion(version);
641 barrierInput.setXid(xId);
642 @SuppressWarnings("unused")
643 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
646 // Convert the UpdateGroupInput to GroupModInput
647 GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(input.getUpdatedGroup(), version);
648 xId = session.getNextXid();
649 ofGroupModInput.setXid(xId);
651 if (null != rpcNotificationProviderService) {
652 GroupUpdatedBuilder groupMod =
653 new GroupUpdatedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group)input.getUpdatedGroup());
654 groupMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
655 groupMod.setGroupRef(input.getGroupRef());
656 rpcNotificationProviderService.publish(groupMod.build());
659 Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = messageService.groupMod(ofGroupModInput.build(), cookie) ;
661 RpcResult<UpdateGroupOutput> rpcResultFromOFLib = null ;
664 rpcResultFromOFLib = resultFromOFLib.get();
665 } catch( Exception ex ) {
666 LOG.error( " Error while getting result for updateGroup RPC" + ex.getMessage());
669 UpdateGroupOutput updateGroupOutputOFLib = rpcResultFromOFLib.getResult() ;
671 UpdateGroupOutputBuilder updateGroupOutput = new UpdateGroupOutputBuilder() ;
672 updateGroupOutput.setTransactionId(updateGroupOutputOFLib.getTransactionId()) ;
673 UpdateGroupOutput result = updateGroupOutput.build();
675 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
676 RpcResult<UpdateGroupOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
678 LOG.debug("Returning the Update Group RPC result to MD-SAL");
679 return Futures.immediateFuture(rpcResult);
683 public Future<RpcResult<UpdateMeterOutput>> updateMeter(
684 UpdateMeterInput input) {
685 LOG.debug("Calling the MeterMod RPC method on MessageDispatchService");
688 // For Meter provisioning, the SwitchConnectionDistinguisher is set to null so
689 // the request can be routed through any connection to the switch
690 SwitchConnectionDistinguisher cookie = null ;
691 if (Objects.firstNonNull(input.getUpdatedMeter().isBarrier(), Boolean.FALSE)) {
692 xId = session.getNextXid();
693 BarrierInputBuilder barrierInput = new BarrierInputBuilder();
694 barrierInput.setVersion(version);
695 barrierInput.setXid(xId);
696 @SuppressWarnings("unused")
697 Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
700 // Convert the UpdateMeterInput to MeterModInput
701 MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(input.getUpdatedMeter(), version);
702 xId = session.getNextXid();
703 ofMeterModInput.setXid(xId);
705 if (null != rpcNotificationProviderService) {
706 MeterUpdatedBuilder meterMod = new MeterUpdatedBuilder((org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter)input.getUpdatedMeter());
707 meterMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
708 meterMod.setMeterRef(input.getMeterRef());
709 rpcNotificationProviderService.publish(meterMod.build());
712 Future<RpcResult<UpdateMeterOutput>> resultFromOFLib = messageService.meterMod(ofMeterModInput.build(), cookie) ;
714 RpcResult<UpdateMeterOutput> rpcResultFromOFLib = null ;
717 rpcResultFromOFLib = resultFromOFLib.get();
718 } catch( Exception ex ) {
719 LOG.error( " Error while getting result for UpdateMeter RPC" + ex.getMessage());
722 UpdateMeterOutput updateMeterOutputFromOFLib = rpcResultFromOFLib.getResult() ;
724 UpdateMeterOutputBuilder updateMeterOutput = new UpdateMeterOutputBuilder() ;
725 updateMeterOutput.setTransactionId(updateMeterOutputFromOFLib.getTransactionId()) ;
726 UpdateMeterOutput result = updateMeterOutput.build();
728 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
729 RpcResult<UpdateMeterOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
731 LOG.debug("Returning the Update Meter RPC result to MD-SAL");
732 return Futures.immediateFuture(rpcResult);
736 public NodeId getNodeId() {
741 * Methods for requesting statistics from switch
744 public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(GetAllGroupStatisticsInput input) {
746 //Generate xid to associate it with the request
747 Long xid = this.getSessionContext().getNextXid();
749 LOG.debug("Prepare statistics request for all the groups - Transaction id - {}",xid);
751 // Create multipart request header
752 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
753 mprInput.setType(MultipartType.OFPMPGROUP);
754 mprInput.setVersion(version);
755 mprInput.setXid(xid);
756 mprInput.setFlags(new MultipartRequestFlags(false));
758 // Create multipart request body for fetch all the group stats
759 MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
760 MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
761 mprGroupBuild.setGroupId(new GroupId(BinContent.intToUnsignedLong(Group.OFPGALL.getIntValue())));
762 caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
764 //Set request body to main multipart request
765 mprInput.setMultipartRequestBody(caseBuilder.build());
767 //Send the request, no cookies associated, use any connection
768 LOG.debug("Send group statistics request to the switch :{}",mprGroupBuild);
769 this.messageService.multipartRequest(mprInput.build(), null);
771 // Prepare rpc return output. Set xid and send it back.
772 LOG.debug("Return results and transaction id back to caller");
773 GetAllGroupStatisticsOutputBuilder output = new GetAllGroupStatisticsOutputBuilder();
774 output.setTransactionId(generateTransactionId(xid));
775 output.setGroupStats(null);
777 Collection<RpcError> errors = Collections.emptyList();
778 RpcResult<GetAllGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
779 return Futures.immediateFuture(rpcResult);
784 public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(GetGroupDescriptionInput input) {
786 //Generate xid to associate it with the request
787 Long xid = this.getSessionContext().getNextXid();
789 LOG.debug("Prepare group description statistics request - Transaction id - {}",xid);
791 // Create multipart request header
792 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
793 mprInput.setType(MultipartType.OFPMPGROUPDESC);
794 mprInput.setVersion(version);
795 mprInput.setXid(xid);
796 mprInput.setFlags(new MultipartRequestFlags(false));
798 // Create multipart request body for fetch all the group description stats
799 MultipartRequestGroupDescCaseBuilder mprGroupDescBuild = new MultipartRequestGroupDescCaseBuilder();
801 //Set request body to main multipart request
802 mprInput.setMultipartRequestBody(mprGroupDescBuild.build());
804 //Send the request, no cookies associated, use any connection
805 LOG.debug("Send group desciption statistics request to switch : {}",mprGroupDescBuild);
806 this.messageService.multipartRequest(mprInput.build(), null);
808 // Prepare rpc return output. Set xid and send it back.
809 LOG.debug("Return results and transaction id back to caller");
810 GetGroupDescriptionOutputBuilder output = new GetGroupDescriptionOutputBuilder();
811 output.setTransactionId(generateTransactionId(xid));
812 output.setGroupDescStats(null);
814 Collection<RpcError> errors = Collections.emptyList();
815 RpcResult<GetGroupDescriptionOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
816 return Futures.immediateFuture(rpcResult);
821 public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(GetGroupFeaturesInput input) {
823 //Generate xid to associate it with the request
824 Long xid = this.getSessionContext().getNextXid();
826 LOG.debug("Prepare group features statistics request - Transaction id - {}",xid);
828 // Create multipart request header
829 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
830 mprInput.setType(MultipartType.OFPMPGROUPFEATURES);
831 mprInput.setVersion(version);
832 mprInput.setXid(xid);
833 mprInput.setFlags(new MultipartRequestFlags(false));
835 // Create multipart request body for fetch all the group description stats
836 MultipartRequestGroupFeaturesCaseBuilder mprGroupFeaturesBuild = new MultipartRequestGroupFeaturesCaseBuilder();
838 //Set request body to main multipart request
839 mprInput.setMultipartRequestBody(mprGroupFeaturesBuild.build());
841 //Send the request, no cookies associated, use any connection
842 LOG.debug("Send group features statistics request :{}",mprGroupFeaturesBuild);
843 this.messageService.multipartRequest(mprInput.build(), null);
845 // Prepare rpc return output. Set xid and send it back.
846 LOG.debug("Return results and transaction id back to caller");
847 GetGroupFeaturesOutputBuilder output = new GetGroupFeaturesOutputBuilder();
848 output.setTransactionId(generateTransactionId(xid));
850 Collection<RpcError> errors = Collections.emptyList();
851 RpcResult<GetGroupFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
852 return Futures.immediateFuture(rpcResult);
856 public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(GetGroupStatisticsInput input) {
858 //Generate xid to associate it with the request
859 Long xid = this.getSessionContext().getNextXid();
861 LOG.debug("Prepare statistics request for node {} group ({}) - Transaction id - {}",input.getNode(),input.getGroupId(),xid);
863 // Create multipart request header
864 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
865 mprInput.setType(MultipartType.OFPMPGROUP);
866 mprInput.setVersion(version);
867 mprInput.setXid(xid);
868 mprInput.setFlags(new MultipartRequestFlags(false));
870 // Create multipart request body for fetch all the group stats
871 MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
872 MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
873 mprGroupBuild.setGroupId(new GroupId(input.getGroupId().getValue()));
874 caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
876 //Set request body to main multipart request
877 mprInput.setMultipartRequestBody(caseBuilder.build());
879 //Send the request, no cookies associated, use any connection
880 LOG.debug("Send group statistics request :{}",mprGroupBuild);
881 this.messageService.multipartRequest(mprInput.build(), null);
883 // Prepare rpc return output. Set xid and send it back.
884 LOG.debug("Return results and transaction id back to caller");
885 GetGroupStatisticsOutputBuilder output = new GetGroupStatisticsOutputBuilder();
886 output.setTransactionId(generateTransactionId(xid));
887 output.setGroupStats(null);
889 Collection<RpcError> errors = Collections.emptyList();
890 RpcResult<GetGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
891 return Futures.immediateFuture(rpcResult);
895 public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
896 GetAllMeterConfigStatisticsInput input) {
898 //Generate xid to associate it with the request
899 Long xid = this.getSessionContext().getNextXid();
901 LOG.debug("Prepare config request for all the meters - Transaction id - {}",xid);
903 // Create multipart request header
904 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
905 mprInput.setType(MultipartType.OFPMPMETERCONFIG);
906 mprInput.setVersion(version);
907 mprInput.setXid(xid);
908 mprInput.setFlags(new MultipartRequestFlags(false));
910 // Create multipart request body for fetch all the meter stats
911 MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
912 MultipartRequestMeterConfigBuilder mprMeterConfigBuild = new MultipartRequestMeterConfigBuilder();
913 mprMeterConfigBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(Meter.OFPMALL.getIntValue())));
914 caseBuilder.setMultipartRequestMeterConfig(mprMeterConfigBuild.build());
916 //Set request body to main multipart request
917 mprInput.setMultipartRequestBody(caseBuilder.build());
919 //Send the request, no cookies associated, use any connection
920 LOG.debug("Send meter statistics request :{}",mprMeterConfigBuild);
921 this.messageService.multipartRequest(mprInput.build(), null);
923 // Prepare rpc return output. Set xid and send it back.
924 LOG.debug("Return results and transaction id back to caller");
925 GetAllMeterConfigStatisticsOutputBuilder output = new GetAllMeterConfigStatisticsOutputBuilder();
926 output.setTransactionId(generateTransactionId(xid));
927 output.setMeterConfigStats(null);
929 Collection<RpcError> errors = Collections.emptyList();
930 RpcResult<GetAllMeterConfigStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
931 return Futures.immediateFuture(rpcResult);
935 public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(GetAllMeterStatisticsInput input) {
937 //Generate xid to associate it with the request
938 Long xid = this.getSessionContext().getNextXid();
940 LOG.debug("Prepare statistics request for all the meters - Transaction id - {}",xid);
942 // Create multipart request header
943 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
944 mprInput.setType(MultipartType.OFPMPMETER);
945 mprInput.setVersion(version);
946 mprInput.setXid(xid);
947 mprInput.setFlags(new MultipartRequestFlags(false));
949 // Create multipart request body for fetch all the meter stats
950 MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
951 MultipartRequestMeterBuilder mprMeterBuild = new MultipartRequestMeterBuilder();
952 mprMeterBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(Meter.OFPMALL.getIntValue())));
953 caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
955 //Set request body to main multipart request
956 mprInput.setMultipartRequestBody(caseBuilder.build());
958 //Send the request, no cookies associated, use any connection
959 LOG.debug("Send meter statistics request :{}",mprMeterBuild);
960 this.messageService.multipartRequest(mprInput.build(), null);
962 // Prepare rpc return output. Set xid and send it back.
963 LOG.debug("Return results and transaction id back to caller");
964 GetAllMeterStatisticsOutputBuilder output = new GetAllMeterStatisticsOutputBuilder();
965 output.setTransactionId(generateTransactionId(xid));
966 output.setMeterStats(null);
968 Collection<RpcError> errors = Collections.emptyList();
969 RpcResult<GetAllMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
970 return Futures.immediateFuture(rpcResult);
974 public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(GetMeterFeaturesInput input) {
976 //Generate xid to associate it with the request
977 Long xid = this.getSessionContext().getNextXid();
979 LOG.debug("Prepare features statistics request for all the meters - Transaction id - {}",xid);
981 // Create multipart request header
982 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
983 mprInput.setType(MultipartType.OFPMPMETERFEATURES);
984 mprInput.setVersion(version);
985 mprInput.setXid(xid);
986 mprInput.setFlags(new MultipartRequestFlags(false));
988 // Create multipart request body for fetch all the group description stats
989 MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild = new MultipartRequestMeterFeaturesCaseBuilder();
991 //Set request body to main multipart request
992 mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
994 //Send the request, no cookies associated, use any connection
995 LOG.debug("Send meter features statistics request :{}",mprMeterFeaturesBuild);
996 this.messageService.multipartRequest(mprInput.build(), null);
998 // Prepare rpc return output. Set xid and send it back.
999 LOG.debug("Return results and transaction id back to caller");
1000 GetMeterFeaturesOutputBuilder output = new GetMeterFeaturesOutputBuilder();
1001 output.setTransactionId(generateTransactionId(xid));
1003 Collection<RpcError> errors = Collections.emptyList();
1004 RpcResult<GetMeterFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1005 return Futures.immediateFuture(rpcResult);
1009 public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(GetMeterStatisticsInput input) {
1010 //Generate xid to associate it with the request
1011 Long xid = this.getSessionContext().getNextXid();
1013 LOG.debug("Preprae statistics request for Meter ({}) - Transaction id - {}",input.getMeterId().getValue(),xid);
1015 // Create multipart request header
1016 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1017 mprInput.setType(MultipartType.OFPMPMETER);
1018 mprInput.setVersion(version);
1019 mprInput.setXid(xid);
1020 mprInput.setFlags(new MultipartRequestFlags(false));
1022 // Create multipart request body for fetch all the meter stats
1023 MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
1024 MultipartRequestMeterBuilder mprMeterBuild = new MultipartRequestMeterBuilder();
1025 //Select specific meter
1026 mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
1027 caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
1029 //Set request body to main multipart request
1030 mprInput.setMultipartRequestBody(caseBuilder.build());
1032 //Send the request, no cookies associated, use any connection
1033 LOG.debug("Send meter statistics request :{}",mprMeterBuild);
1034 this.messageService.multipartRequest(mprInput.build(), null);
1036 // Prepare rpc return output. Set xid and send it back.
1037 LOG.debug("Return results and transaction id back to caller");
1038 GetMeterStatisticsOutputBuilder output = new GetMeterStatisticsOutputBuilder();
1039 output.setTransactionId(generateTransactionId(xid));
1040 output.setMeterStats(null);
1042 Collection<RpcError> errors = Collections.emptyList();
1043 RpcResult<GetMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1044 return Futures.immediateFuture(rpcResult);
1048 public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(GetAllNodeConnectorsStatisticsInput arg0) {
1050 //Generate xid to associate it with the request
1051 Long xid = this.getSessionContext().getNextXid();
1053 LOG.info("Prepare port statistics request for all ports of node {} - TrasactionId - {}",arg0.getNode().getValue(),xid);
1055 // Create multipart request header
1056 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1057 mprInput.setType(MultipartType.OFPMPPORTSTATS);
1058 mprInput.setVersion(version);
1059 mprInput.setXid(xid);
1060 mprInput.setFlags(new MultipartRequestFlags(false));
1062 // Create multipart request body to fetch stats for all the port of the node
1063 MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
1064 MultipartRequestPortStatsBuilder mprPortStatsBuilder = new MultipartRequestPortStatsBuilder();
1066 mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
1067 caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
1069 //Set request body to main multipart request
1070 mprInput.setMultipartRequestBody(caseBuilder.build());
1072 //Send the request, no cookies associated, use any connection
1073 LOG.debug("Send port statistics request :{}",mprPortStatsBuilder.build().toString());
1074 this.messageService.multipartRequest(mprInput.build(), null);
1076 // Prepare rpc return output. Set xid and send it back.
1077 GetAllNodeConnectorsStatisticsOutputBuilder output = new GetAllNodeConnectorsStatisticsOutputBuilder();
1078 output.setTransactionId(generateTransactionId(xid));
1080 Collection<RpcError> errors = Collections.emptyList();
1081 RpcResult<GetAllNodeConnectorsStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1082 return Futures.immediateFuture(rpcResult);
1086 public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(GetNodeConnectorStatisticsInput arg0) {
1087 //Generate xid to associate it with the request
1088 Long xid = this.getSessionContext().getNextXid();
1090 LOG.info("Prepare port statistics request for port {} of node {} - TrasactionId - {}",arg0.getNodeConnectorId(), arg0.getNode().getValue(),xid);
1092 // Create multipart request header
1093 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1094 mprInput.setType(MultipartType.OFPMPPORTSTATS);
1095 mprInput.setVersion(version);
1096 mprInput.setXid(xid);
1097 mprInput.setFlags(new MultipartRequestFlags(false));
1099 // Create multipart request body to fetch stats for all the port of the node
1100 MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
1101 MultipartRequestPortStatsBuilder mprPortStatsBuilder = new MultipartRequestPortStatsBuilder();
1104 mprPortStatsBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(arg0.getNodeConnectorId()));
1105 caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
1107 //Set request body to main multipart request
1108 mprInput.setMultipartRequestBody(caseBuilder.build());
1110 //Send the request, no cookies associated, use any connection
1111 LOG.debug("Send port statistics request :{}",mprPortStatsBuilder.build().toString());
1112 this.messageService.multipartRequest(mprInput.build(), null);
1114 // Prepare rpc return output. Set xid and send it back.
1115 GetNodeConnectorStatisticsOutputBuilder output = new GetNodeConnectorStatisticsOutputBuilder();
1116 output.setTransactionId(generateTransactionId(xid));
1118 Collection<RpcError> errors = Collections.emptyList();
1119 RpcResult<GetNodeConnectorStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1120 return Futures.immediateFuture(rpcResult);
1123 private TransactionId generateTransactionId(Long xid){
1124 String stringXid =xid.toString();
1125 BigInteger bigIntXid = new BigInteger( stringXid );
1126 return new TransactionId(bigIntXid);
1131 public Future<RpcResult<GetPortOutput>> getPort() {
1132 // TODO Auto-generated method stub
1138 public Future<RpcResult<UpdatePortOutput>> updatePort(UpdatePortInput input) {
1139 PortModInput ofPortModInput = null ;
1140 RpcResult<UpdatePortOutput> rpcResultFromOFLib = null ;
1143 // For Flow provisioning, the SwitchConnectionDistinguisher is set to null so
1144 // the request can be routed through any connection to the switch
1146 SwitchConnectionDistinguisher cookie = null ;
1148 // NSF sends a list of port and the ModelDrivenSwitch will
1149 // send one port at a time towards the switch ( mutiple RPCs calls)
1150 List<Port> inputPorts = input.getUpdatedPort().getPort().getPort() ;
1152 // Get the Xid. The same Xid has to be sent in all the RPCs
1153 Long Xid = sessionContext.getNextXid();
1155 for( Port inputPort : inputPorts) {
1157 // Convert the UpdateGroupInput to GroupModInput
1158 ofPortModInput = PortConvertor.toPortModInput(inputPort, version) ;
1160 // Insert the Xid ( transaction Id) before calling the RPC on the OFLibrary
1162 PortModInputBuilder mdInput = new PortModInputBuilder();
1163 mdInput.setXid(Xid);
1164 mdInput.setVersion(ofPortModInput.getVersion()) ;
1165 mdInput.setPortNo(ofPortModInput.getPortNo()) ;
1166 mdInput.setMaskV10(ofPortModInput.getMaskV10()) ;
1167 mdInput.setMask(ofPortModInput.getMask()) ;
1168 mdInput.setHwAddress(ofPortModInput.getHwAddress());
1169 mdInput.setConfigV10(ofPortModInput.getConfigV10()) ;
1170 mdInput.setConfig(ofPortModInput.getConfig()) ;
1171 mdInput.setAdvertiseV10(ofPortModInput.getAdvertiseV10()) ;
1172 mdInput.setAdvertise(ofPortModInput.getAdvertise()) ;
1174 LOG.debug("Calling the PortMod RPC method on MessageDispatchService");
1175 Future<RpcResult<UpdatePortOutput>> resultFromOFLib = messageService.portMod(ofPortModInput, cookie) ;
1178 rpcResultFromOFLib = resultFromOFLib.get();
1179 } catch( Exception ex ) {
1180 LOG.error( " Error while getting result for updatePort RPC" + ex.getMessage());
1183 // The Future response value for all the RPCs except the last one is ignored
1186 //Extract the Xid only from the Future for the last RPC and
1187 // send it back to the NSF
1188 UpdatePortOutput updatePortOutputOFLib = rpcResultFromOFLib.getResult() ;
1190 UpdatePortOutputBuilder updatePortOutput = new UpdatePortOutputBuilder() ;
1191 updatePortOutput.setTransactionId(updatePortOutputOFLib.getTransactionId()) ;
1192 UpdatePortOutput result = updatePortOutput.build();
1194 Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
1195 RpcResult<UpdatePortOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
1197 LOG.debug("Returning the Update Group RPC result to MD-SAL");
1198 return Futures.immediateFuture(rpcResult);
1203 public Future<RpcResult<UpdateTableOutput>> updateTable(
1204 UpdateTableInput input) {
1206 // Get the Xid. The same Xid has to be sent in all the Multipart requests
1207 Long xid = this.getSessionContext().getNextXid();
1209 LOG.debug("Prepare the Multipart Table Mod requests for Transaction Id {} ",xid);
1211 // Create multipart request header
1212 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1213 mprInput.setType(MultipartType.OFPMPTABLEFEATURES);
1214 mprInput.setVersion((short)0x04);
1215 mprInput.setXid(xid);
1217 //Convert the list of all MD-SAL table feature object into OF library object
1218 List<TableFeatures> ofTableFeatureList = TableFeaturesConvertor.toTableFeaturesRequest(input.getUpdatedTable()) ;
1221 MultipartRequestTableFeaturesCaseBuilder caseRequest = new MultipartRequestTableFeaturesCaseBuilder();
1222 MultipartRequestTableFeaturesBuilder tableFeaturesRequest = new MultipartRequestTableFeaturesBuilder();
1224 mprInput.setFlags(new MultipartRequestFlags(true));
1226 tableFeaturesRequest.setTableFeatures(ofTableFeatureList) ;
1228 //Set request body to main multipart request
1229 caseRequest.setMultipartRequestTableFeatures(tableFeaturesRequest.build());
1230 mprInput.setMultipartRequestBody(caseRequest.build());
1232 //Send the request, no cookies associated, use any connection
1233 LOG.debug("Send Table Feature request :{}",ofTableFeatureList);
1234 this.messageService.multipartRequest(mprInput.build(), null);
1237 //Extract the Xid only from the Future for the last RPC and
1238 // send it back to the NSF
1239 LOG.debug("Returning the result and transaction id to NSF");
1240 LOG.debug("Return results and transaction id back to caller");
1241 UpdateTableOutputBuilder output = new UpdateTableOutputBuilder();
1242 output.setTransactionId(generateTransactionId(xid));
1244 Collection<RpcError> errors = Collections.emptyList();
1245 RpcResult<UpdateTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1246 return Futures.immediateFuture(rpcResult);
1250 public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
1251 GetAllFlowStatisticsFromFlowTableInput arg0) {
1253 //Generate xid to associate it with the request
1254 Long xid = this.getSessionContext().getNextXid();
1256 LOG.debug("Prepare statistics request to get flow stats for switch tables {} - Transaction id - {}"
1257 ,arg0.getTableId().getValue(),xid);
1259 // Create multipart request header
1260 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1261 mprInput.setType(MultipartType.OFPMPFLOW);
1262 mprInput.setVersion(version);
1263 mprInput.setXid(xid);
1264 mprInput.setFlags(new MultipartRequestFlags(false));
1266 // Create multipart request body for fetch all the group stats
1267 MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder ();
1268 MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
1269 mprFlowRequestBuilder.setTableId(arg0.getTableId().getValue());
1270 mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
1271 mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1272 mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1273 mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1274 FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
1276 //Set request body to main multipart request
1277 multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
1278 mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
1280 //Send the request, no cookies associated, use any connection
1281 LOG.debug("Send flow statistics request to the switch :{}",mprFlowRequestBuilder);
1282 this.messageService.multipartRequest(mprInput.build(), null);
1284 // Prepare rpc return output. Set xid and send it back.
1285 LOG.debug("Return results and transaction id back to caller");
1286 GetAllFlowStatisticsFromFlowTableOutputBuilder output =
1287 new GetAllFlowStatisticsFromFlowTableOutputBuilder();
1288 output.setTransactionId(generateTransactionId(xid));
1289 output.setFlowAndStatisticsMapList(null);
1291 Collection<RpcError> errors = Collections.emptyList();
1292 RpcResult<GetAllFlowStatisticsFromFlowTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1293 return Futures.immediateFuture(rpcResult);
1297 public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
1298 GetAllFlowsStatisticsFromAllFlowTablesInput arg0) {
1300 //Generate xid to associate it with the request
1301 Long xid = this.getSessionContext().getNextXid();
1303 LOG.info("Prepare statistics request to get flow stats of all switch tables - Transaction id - {}",xid);
1305 // Create multipart request header
1306 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1307 mprInput.setType(MultipartType.OFPMPFLOW);
1308 mprInput.setVersion(version);
1309 mprInput.setXid(xid);
1310 mprInput.setFlags(new MultipartRequestFlags(false));
1312 // Create multipart request body for fetch all the group stats
1313 MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
1314 MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
1315 mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
1316 mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
1317 mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1318 mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1319 mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1320 mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1322 FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
1324 //Set request body to main multipart request
1325 multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
1326 mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
1328 //Send the request, no cookies associated, use any connection
1329 LOG.debug("Send flow statistics request to the switch :{}",mprFlowRequestBuilder);
1330 this.messageService.multipartRequest(mprInput.build(), null);
1332 // Prepare rpc return output. Set xid and send it back.
1333 GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder output =
1334 new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
1335 output.setTransactionId(generateTransactionId(xid));
1336 output.setFlowAndStatisticsMapList(null);
1338 Collection<RpcError> errors = Collections.emptyList();
1339 RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1340 return Futures.immediateFuture(rpcResult);
1345 public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
1346 GetFlowStatisticsFromFlowTableInput arg0) {
1347 //Generate xid to associate it with the request
1348 Long xid = this.getSessionContext().getNextXid();
1350 LOG.info("Prepare statistics request to get stats for flow {} for switch tables {} - Transaction id - {}"
1351 ,arg0.getMatch().toString(),arg0.getTableId(),xid);
1353 // Create multipart request header
1354 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1355 mprInput.setType(MultipartType.OFPMPFLOW);
1356 mprInput.setVersion(version);
1357 mprInput.setXid(xid);
1358 mprInput.setFlags(new MultipartRequestFlags(false));
1360 // Create multipart request body for fetch all the group stats
1361 MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
1362 MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
1363 mprFlowRequestBuilder.setTableId(arg0.getTableId());
1364 mprFlowRequestBuilder.setOutPort(arg0.getOutPort().longValue());
1365 mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1366 mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1367 mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1369 // convert and inject match
1370 MatchReactor.getInstance().convert(arg0.getMatch(), version, mprFlowRequestBuilder);
1371 //TODO: repeating code
1372 if(version == OFConstants.OFP_VERSION_1_3){
1373 mprFlowRequestBuilder.setCookie(arg0.getCookie());
1374 mprFlowRequestBuilder.setCookieMask(arg0.getCookieMask());
1375 mprFlowRequestBuilder.setOutGroup(arg0.getOutGroup());
1378 //Set request body to main multipart request
1379 multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
1380 mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
1382 //Send the request, no cookies associated, use any connection
1383 LOG.debug("Send flow statistics request to the switch :{}",mprFlowRequestBuilder);
1384 this.messageService.multipartRequest(mprInput.build(), null);
1386 // Prepare rpc return output. Set xid and send it back.
1387 GetFlowStatisticsFromFlowTableOutputBuilder output =
1388 new GetFlowStatisticsFromFlowTableOutputBuilder();
1389 output.setTransactionId(generateTransactionId(xid));
1390 output.setFlowAndStatisticsMapList(null);
1392 Collection<RpcError> errors = Collections.emptyList();
1393 RpcResult<GetFlowStatisticsFromFlowTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1394 return Futures.immediateFuture(rpcResult);
1398 public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
1399 GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput arg0) {
1400 //Generate xid to associate it with the request
1401 Long xid = this.getSessionContext().getNextXid();
1403 LOG.info("Prepare aggregate flow statistics request to get aggregate flow stats for all the flow installed on switch table {} - Transaction id - {}"
1404 ,arg0.getTableId().getValue(),xid);
1406 // Create multipart request header
1407 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1408 mprInput.setType(MultipartType.OFPMPAGGREGATE);
1409 mprInput.setVersion(version);
1410 mprInput.setXid(xid);
1411 mprInput.setFlags(new MultipartRequestFlags(false));
1413 // Create multipart request body for fetch all the group stats
1414 MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder ();
1415 MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
1416 mprAggregateRequestBuilder.setTableId(arg0.getTableId().getValue());
1417 mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
1418 mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1419 mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1420 mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1422 FlowCreatorUtil.setWildcardedFlowMatch(version, mprAggregateRequestBuilder);
1425 //Set request body to main multipart request
1426 multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
1427 mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
1429 //Send the request, no cookies associated, use any connection
1430 LOG.debug("Send request to the switch :{}",multipartRequestAggregateCaseBuilder.build().toString());
1431 this.messageService.multipartRequest(mprInput.build(), null);
1433 // Prepare rpc return output. Set xid and send it back.
1434 GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder output =
1435 new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder();
1436 output.setTransactionId(generateTransactionId(xid));
1438 Collection<RpcError> errors = Collections.emptyList();
1439 RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1440 return Futures.immediateFuture(rpcResult);
1444 public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
1445 GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput arg0) {
1447 //Generate xid to associate it with the request
1448 Long xid = this.getSessionContext().getNextXid();
1450 LOG.debug("Prepare aggregate statistics request to get aggregate stats for flows matching {} and installed in flow tables {} - Transaction id - {}"
1451 ,arg0.getMatch().toString(),arg0.getTableId(),xid);
1453 // Create multipart request header
1454 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1455 mprInput.setType(MultipartType.OFPMPAGGREGATE);
1456 mprInput.setVersion(version);
1457 mprInput.setXid(xid);
1458 mprInput.setFlags(new MultipartRequestFlags(false));
1460 // Create multipart request body for fetch all the group stats
1461 MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder ();
1462 MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
1463 mprAggregateRequestBuilder.setTableId(arg0.getTableId());
1464 mprAggregateRequestBuilder.setOutPort(arg0.getOutPort().longValue());
1465 mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
1466 mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
1467 mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
1470 MatchReactor.getInstance().convert(arg0.getMatch(), version, mprAggregateRequestBuilder);
1471 //TODO: repeating code
1472 if(version == OFConstants.OFP_VERSION_1_3){
1473 mprAggregateRequestBuilder.setCookie(arg0.getCookie());
1474 mprAggregateRequestBuilder.setCookieMask(arg0.getCookieMask());
1475 mprAggregateRequestBuilder.setOutGroup(arg0.getOutGroup());
1478 //Set request body to main multipart request
1479 multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
1480 mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
1482 //Send the request, no cookies associated, use any connection
1483 LOG.debug("Send request to the switch :{}",multipartRequestAggregateCaseBuilder.build().toString());
1484 this.messageService.multipartRequest(mprInput.build(), null);
1486 // Prepare rpc return output. Set xid and send it back.
1487 GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder output =
1488 new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder();
1489 output.setTransactionId(generateTransactionId(xid));
1491 Collection<RpcError> errors = Collections.emptyList();
1492 RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1493 return Futures.immediateFuture(rpcResult);
1497 public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(GetFlowTablesStatisticsInput arg0) {
1498 //Generate xid to associate it with the request
1499 Long xid = this.getSessionContext().getNextXid();
1501 LOG.info("Prepare flow table statistics request to get flow table stats for all tables " +
1502 "from node {}- Transaction id - {}",arg0.getNode(),xid);
1504 // Create multipart request header
1505 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1506 mprInput.setType(MultipartType.OFPMPTABLE);
1507 mprInput.setVersion(version);
1508 mprInput.setXid(xid);
1509 mprInput.setFlags(new MultipartRequestFlags(false));
1511 // Create multipart request body for fetch all the group stats
1512 MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder ();
1513 MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
1514 multipartRequestTableBuilder.setEmpty(true);
1515 multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
1517 //Set request body to main multipart request
1518 mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
1520 //Send the request, no cookies associated, use any connection
1521 LOG.debug("Send request to the switch :{}",multipartRequestTableCaseBuilder.build().toString());
1522 this.messageService.multipartRequest(mprInput.build(), null);
1524 // Prepare rpc return output. Set xid and send it back.
1525 GetFlowTablesStatisticsOutputBuilder output = new GetFlowTablesStatisticsOutputBuilder();
1526 output.setTransactionId(generateTransactionId(xid));
1528 Collection<RpcError> errors = Collections.emptyList();
1529 RpcResult<GetFlowTablesStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1530 return Futures.immediateFuture(rpcResult);
1534 public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
1535 GetAllQueuesStatisticsFromAllPortsInput arg0) {
1536 //Generate xid to associate it with the request
1537 Long xid = this.getSessionContext().getNextXid();
1539 LOG.info("Prepare queue statistics request to collect stats for all queues attached to all the ports of node {} - TrasactionId - {}",arg0.getNode().getValue(),xid);
1541 // Create multipart request header
1542 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1543 mprInput.setType(MultipartType.OFPMPQUEUE);
1544 mprInput.setVersion(version);
1545 mprInput.setXid(xid);
1546 mprInput.setFlags(new MultipartRequestFlags(false));
1548 // Create multipart request body to fetch stats for all the port of the node
1549 MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
1550 MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
1552 mprQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
1553 //Select all the ports
1554 mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
1556 caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
1558 //Set request body to main multipart request
1559 mprInput.setMultipartRequestBody(caseBuilder.build());
1561 //Send the request, no cookies associated, use any connection
1562 LOG.debug("Send queue statistics request :{}",mprQueueBuilder.build().toString());
1563 this.messageService.multipartRequest(mprInput.build(), null);
1565 // Prepare rpc return output. Set xid and send it back.
1566 GetAllQueuesStatisticsFromAllPortsOutputBuilder output = new GetAllQueuesStatisticsFromAllPortsOutputBuilder();
1567 output.setTransactionId(generateTransactionId(xid));
1568 output.setQueueIdAndStatisticsMap(null);
1570 Collection<RpcError> errors = Collections.emptyList();
1571 RpcResult<GetAllQueuesStatisticsFromAllPortsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1572 return Futures.immediateFuture(rpcResult);
1576 public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
1577 GetAllQueuesStatisticsFromGivenPortInput arg0) {
1578 //Generate xid to associate it with the request
1579 Long xid = this.getSessionContext().getNextXid();
1581 LOG.info("Prepare queue statistics request to collect stats for " +
1582 "all queues attached to given port {} of node {} - TrasactionId - {}",arg0.getNodeConnectorId().toString(),arg0.getNode().getValue(),xid);
1584 // Create multipart request header
1585 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1586 mprInput.setType(MultipartType.OFPMPQUEUE);
1587 mprInput.setVersion(version);
1588 mprInput.setXid(xid);
1589 mprInput.setFlags(new MultipartRequestFlags(false));
1591 // Create multipart request body to fetch stats for all the port of the node
1592 MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
1593 MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
1595 mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
1596 //Select specific port
1597 mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(arg0.getNodeConnectorId()));
1599 caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
1601 //Set request body to main multipart request
1602 mprInput.setMultipartRequestBody(caseBuilder.build());
1604 //Send the request, no cookies associated, use any connection
1605 LOG.debug("Send queue statistics request :{}",mprQueueBuilder.build().toString());
1606 this.messageService.multipartRequest(mprInput.build(), null);
1608 // Prepare rpc return output. Set xid and send it back.
1609 GetAllQueuesStatisticsFromGivenPortOutputBuilder output = new GetAllQueuesStatisticsFromGivenPortOutputBuilder();
1610 output.setTransactionId(generateTransactionId(xid));
1611 output.setQueueIdAndStatisticsMap(null);
1613 Collection<RpcError> errors = Collections.emptyList();
1614 RpcResult<GetAllQueuesStatisticsFromGivenPortOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1615 return Futures.immediateFuture(rpcResult);
1619 public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
1620 GetQueueStatisticsFromGivenPortInput arg0) {
1621 //Generate xid to associate it with the request
1622 Long xid = this.getSessionContext().getNextXid();
1624 LOG.info("Prepare queue statistics request to collect stats for " +
1625 "given queue attached to given port {} of node {} - TrasactionId - {}",arg0.getQueueId().toString(),arg0.getNodeConnectorId().toString(),arg0.getNode().getValue(),xid);
1627 // Create multipart request header
1628 MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
1629 mprInput.setType(MultipartType.OFPMPQUEUE);
1630 mprInput.setVersion(version);
1631 mprInput.setXid(xid);
1632 mprInput.setFlags(new MultipartRequestFlags(false));
1634 // Create multipart request body to fetch stats for all the port of the node
1635 MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
1636 MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
1637 //Select specific queue
1638 mprQueueBuilder.setQueueId(arg0.getQueueId().getValue());
1639 //Select specific port
1640 mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(arg0.getNodeConnectorId()));
1642 caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
1644 //Set request body to main multipart request
1645 mprInput.setMultipartRequestBody(caseBuilder.build());
1647 //Send the request, no cookies associated, use any connection
1648 LOG.debug("Send queue statistics request :{}",mprQueueBuilder.build().toString());
1649 this.messageService.multipartRequest(mprInput.build(), null);
1651 // Prepare rpc return output. Set xid and send it back.
1652 GetQueueStatisticsFromGivenPortOutputBuilder output = new GetQueueStatisticsFromGivenPortOutputBuilder();
1653 output.setTransactionId(generateTransactionId(xid));
1654 output.setQueueIdAndStatisticsMap(null);
1656 Collection<RpcError> errors = Collections.emptyList();
1657 RpcResult<GetQueueStatisticsFromGivenPortOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
1658 return Futures.immediateFuture(rpcResult);