- final GetFlowStatisticsFromFlowTableInput arg0) {
- // Generate xid to associate it with the request
- Long xid = this.getSessionContext().getNextXid();
-
- LOG.debug("Prepare statistics request to get stats for flow {} for switch tables {} - Transaction id - {}",
- arg0.getMatch().toString(), arg0.getTableId(), xid);
-
- // Create multipart request header
- MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
- mprInput.setType(MultipartType.OFPMPFLOW);
- mprInput.setVersion(version);
- mprInput.setXid(xid);
- mprInput.setFlags(new MultipartRequestFlags(false));
-
- // Create multipart request body for fetch all the group stats
- MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
- MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
- mprFlowRequestBuilder.setTableId(arg0.getTableId());
-
- if (arg0.getOutPort() != null)
- mprFlowRequestBuilder.setOutPort(arg0.getOutPort().longValue());
- else
- mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
-
- if (arg0.getOutGroup() != null)
- mprFlowRequestBuilder.setOutGroup(arg0.getOutGroup());
- else
- mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
-
- if (arg0.getCookie() != null)
- mprFlowRequestBuilder.setCookie(arg0.getCookie().getValue());
- else
- mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
-
- if (arg0.getCookieMask() != null)
- mprFlowRequestBuilder.setCookieMask(arg0.getCookieMask().getValue());
- else
- mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
-
- // convert and inject match
- MatchReactor.getInstance().convert(arg0.getMatch(), version, mprFlowRequestBuilder,
- this.getSessionContext().getFeatures().getDatapathId());
-
- // Set request body to main multipart request
- multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
- mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
-
- // Send the request, no cookies associated, use any connection
- LOG.debug("Send flow statistics request to the switch :{}", mprFlowRequestBuilder);
- this.messageService.multipartRequest(mprInput.build(), null);
-
- // Prepare rpc return output. Set xid and send it back.
- GetFlowStatisticsFromFlowTableOutputBuilder output = new GetFlowStatisticsFromFlowTableOutputBuilder();
- output.setTransactionId(generateTransactionId(xid));
- output.setFlowAndStatisticsMapList(null);
-
- Collection<RpcError> errors = Collections.emptyList();
- RpcResult<GetFlowStatisticsFromFlowTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
- return Futures.immediateFuture(rpcResult);