+ //Extract the Xid only from the Future for the last RPC and
+ // send it back to the NSF
+ UpdatePortOutput updatePortOutputOFLib = rpcResultFromOFLib.getResult() ;
+
+ UpdatePortOutputBuilder updatePortOutput = new UpdatePortOutputBuilder() ;
+ updatePortOutput.setTransactionId(updatePortOutputOFLib.getTransactionId()) ;
+ UpdatePortOutput result = updatePortOutput.build();
+
+ Collection<RpcError> errors = rpcResultFromOFLib.getErrors() ;
+ RpcResult<UpdatePortOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
+
+ LOG.debug("Returning the Update Group RPC result to MD-SAL");
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ @Override
+ public Future<RpcResult<UpdateTableOutput>> updateTable(
+ UpdateTableInput input) {
+
+ // Get the Xid. The same Xid has to be sent in all the Multipart requests
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.debug("Prepare the Multipart Table Mod requests for Transaction Id {} ",xid);
+
+ // Create multipart request header
+ MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+ mprInput.setType(MultipartType.OFPMPTABLEFEATURES);
+ mprInput.setVersion((short)0x04);
+ mprInput.setXid(xid);
+
+ //Convert the list of all MD-SAL table feature object into OF library object
+ List<TableFeatures> ofTableFeatureList = TableFeaturesConvertor.toTableFeaturesRequest(input.getUpdatedTable()) ;
+
+
+ MultipartRequestTableFeaturesCaseBuilder caseRequest = new MultipartRequestTableFeaturesCaseBuilder();
+ MultipartRequestTableFeaturesBuilder tableFeaturesRequest = new MultipartRequestTableFeaturesBuilder();
+
+ mprInput.setFlags(new MultipartRequestFlags(true));
+
+ tableFeaturesRequest.setTableFeatures(ofTableFeatureList) ;
+
+ //Set request body to main multipart request
+ caseRequest.setMultipartRequestTableFeatures(tableFeaturesRequest.build());
+ mprInput.setMultipartRequestBody(caseRequest.build());
+
+ //Send the request, no cookies associated, use any connection
+ LOG.debug("Send Table Feature request :{}",ofTableFeatureList);
+ this.messageService.multipartRequest(mprInput.build(), null);
+
+
+ //Extract the Xid only from the Future for the last RPC and
+ // send it back to the NSF
+ LOG.debug("Returning the result and transaction id to NSF");
+ LOG.debug("Return results and transaction id back to caller");
+ UpdateTableOutputBuilder output = new UpdateTableOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<UpdateTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
+ GetAllFlowStatisticsFromFlowTableInput arg0) {
+
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.debug("Prepare statistics request to get flow stats for switch tables {} - Transaction id - {}"
+ ,arg0.getTableId().getValue(),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().getValue());
+ mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+ mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+
+ if(version == OFConstants.OFP_VERSION_1_0){
+ LOG.info("Target node is running openflow version 1.0");
+ FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,true,true,true,true,true,true,true,true,true);
+ mprFlowRequestBuilder.setMatchV10(new MatchV10Builder().setWildcards(wildCard).build());
+ }
+ if(version == OFConstants.OFP_VERSION_1_3){
+ LOG.info("Target node is running openflow version 1.3+");
+ mprFlowRequestBuilder.setMatch(new MatchBuilder().setType(OxmMatchType.class).build());
+ }
+
+
+ //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.
+ LOG.debug("Return results and transaction id back to caller");
+ GetAllFlowStatisticsFromFlowTableOutputBuilder output =
+ new GetAllFlowStatisticsFromFlowTableOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+ output.setFlowAndStatisticsMapList(null);
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetAllFlowStatisticsFromFlowTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
+ GetAllFlowsStatisticsFromAllFlowTablesInput arg0) {
+
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.info("Prepare statistics request to get flow stats of all switch tables - Transaction id - {}",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(OFConstants.OFPTT_ALL);
+ mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+ mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+ mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+
+ //TODO: repeating code
+ if(version == OFConstants.OFP_VERSION_1_0){
+ FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,true,true,true,true,true,true,true,true,true);
+ mprFlowRequestBuilder.setMatchV10(new MatchV10Builder().setWildcards(wildCard).build());
+ }
+ if(version == OFConstants.OFP_VERSION_1_3){
+ mprFlowRequestBuilder.setMatch(new MatchBuilder().setType(OxmMatchType.class).build());
+ }
+ //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.
+ GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder output =
+ new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+ output.setFlowAndStatisticsMapList(null);
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+
+ }
+
+ @Override
+ public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
+ GetFlowStatisticsFromFlowTableInput arg0) {
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.info("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());
+ mprFlowRequestBuilder.setOutPort(arg0.getOutPort().longValue());
+ mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+
+ // convert and inject match
+ MatchReactor.getInstance().convert(arg0.getMatch(), version, mprFlowRequestBuilder);
+ //TODO: repeating code
+ if(version == OFConstants.OFP_VERSION_1_3){
+ mprFlowRequestBuilder.setCookie(arg0.getCookie());
+ mprFlowRequestBuilder.setCookieMask(arg0.getCookieMask());
+ mprFlowRequestBuilder.setOutGroup(arg0.getOutGroup());
+ }
+
+ //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);
+ }
+
+ @Override
+ public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
+ GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput arg0) {
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.info("Prepare aggregate flow statistics request to get aggregate flow stats for all the flow installed on switch table {} - Transaction id - {}"
+ ,arg0.getTableId().getValue(),xid);
+
+ // Create multipart request header
+ MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+ mprInput.setType(MultipartType.OFPMPAGGREGATE);
+ mprInput.setVersion(version);
+ mprInput.setXid(xid);
+ mprInput.setFlags(new MultipartRequestFlags(false));
+
+ // Create multipart request body for fetch all the group stats
+ MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder ();
+ MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
+ mprAggregateRequestBuilder.setTableId(arg0.getTableId().getValue());
+ mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+ mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+
+ //TODO: repeating code
+ if(version == OFConstants.OFP_VERSION_1_0){
+ FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,true,true,true,true,true,true,true,true,true);
+ mprAggregateRequestBuilder.setMatchV10(new MatchV10Builder().setWildcards(wildCard).build());
+ }
+ if(version == OFConstants.OFP_VERSION_1_3){
+ mprAggregateRequestBuilder.setMatch(new MatchBuilder().setType(OxmMatchType.class).build());
+ }
+
+
+ //Set request body to main multipart request
+ multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
+ mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
+
+ //Send the request, no cookies associated, use any connection
+ LOG.debug("Send request to the switch :{}",multipartRequestAggregateCaseBuilder.build().toString());
+ this.messageService.multipartRequest(mprInput.build(), null);
+
+ // Prepare rpc return output. Set xid and send it back.
+ GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder output =
+ new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
+ GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput arg0) {
+
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.debug("Prepare agregate statistics request to get aggregate stats for flows matching {} and installed in flow tables {} - Transaction id - {}"
+ ,arg0.getMatch().toString(),arg0.getTableId(),xid);
+
+ // Create multipart request header
+ MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+ mprInput.setType(MultipartType.OFPMPAGGREGATE);
+ mprInput.setVersion(version);
+ mprInput.setXid(xid);
+ mprInput.setFlags(new MultipartRequestFlags(false));
+
+ // Create multipart request body for fetch all the group stats
+ MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder ();
+ MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
+ mprAggregateRequestBuilder.setTableId(arg0.getTableId());
+ mprAggregateRequestBuilder.setOutPort(arg0.getOutPort().longValue());
+ mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+
+
+ MatchReactor.getInstance().convert(arg0.getMatch(), version, mprAggregateRequestBuilder);
+ //TODO: repeating code
+ if(version == OFConstants.OFP_VERSION_1_3){
+ mprAggregateRequestBuilder.setCookie(arg0.getCookie());
+ mprAggregateRequestBuilder.setCookieMask(arg0.getCookieMask());
+ mprAggregateRequestBuilder.setOutGroup(arg0.getOutGroup());
+ }
+
+ //Set request body to main multipart request
+ multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
+ mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
+
+ //Send the request, no cookies associated, use any connection
+ LOG.debug("Send request to the switch :{}",multipartRequestAggregateCaseBuilder.build().toString());
+ this.messageService.multipartRequest(mprInput.build(), null);
+
+ // Prepare rpc return output. Set xid and send it back.
+ GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder output =
+ new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(GetFlowTablesStatisticsInput arg0) {
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.info("Prepare flow table statistics request to get flow table stats for all tables " +
+ "from node {}- Transaction id - {}",arg0.getNode(),xid);
+
+ // Create multipart request header
+ MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+ mprInput.setType(MultipartType.OFPMPTABLE);
+ mprInput.setVersion(version);
+ mprInput.setXid(xid);
+ mprInput.setFlags(new MultipartRequestFlags(false));
+
+ // Create multipart request body for fetch all the group stats
+ MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder ();
+ MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
+ multipartRequestTableBuilder.setEmpty(true);
+ multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
+
+ //Set request body to main multipart request
+ mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
+
+ //Send the request, no cookies associated, use any connection
+ LOG.debug("Send request to the switch :{}",multipartRequestTableCaseBuilder.build().toString());
+ this.messageService.multipartRequest(mprInput.build(), null);
+
+ // Prepare rpc return output. Set xid and send it back.
+ GetFlowTablesStatisticsOutputBuilder output = new GetFlowTablesStatisticsOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetFlowTablesStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
+ GetAllQueuesStatisticsFromAllPortsInput arg0) {
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.info("Prepare queue statistics request to collect stats for all queues attached to all the ports of node {} - TrasactionId - {}",arg0.getNode().getValue(),xid);
+
+ // Create multipart request header
+ MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+ mprInput.setType(MultipartType.OFPMPQUEUE);
+ mprInput.setVersion(version);
+ mprInput.setXid(xid);
+ mprInput.setFlags(new MultipartRequestFlags(false));
+
+ // Create multipart request body to fetch stats for all the port of the node
+ MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+ MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
+ //Select all ports
+ mprQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
+ //Select all the ports
+ mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
+
+ caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
+
+ //Set request body to main multipart request
+ mprInput.setMultipartRequestBody(caseBuilder.build());
+
+ //Send the request, no cookies associated, use any connection
+ LOG.debug("Send queue statistics request :{}",mprQueueBuilder.build().toString());
+ this.messageService.multipartRequest(mprInput.build(), null);
+
+ // Prepare rpc return output. Set xid and send it back.
+ GetAllQueuesStatisticsFromAllPortsOutputBuilder output = new GetAllQueuesStatisticsFromAllPortsOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+ output.setQueueIdAndStatisticsMap(null);
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetAllQueuesStatisticsFromAllPortsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
+ GetAllQueuesStatisticsFromGivenPortInput arg0) {
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.info("Prepare queue statistics request to collect stats for " +
+ "all queues attached to given port {} of node {} - TrasactionId - {}",arg0.getNodeConnectorId().toString(),arg0.getNode().getValue(),xid);
+
+ // Create multipart request header
+ MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+ mprInput.setType(MultipartType.OFPMPQUEUE);
+ mprInput.setVersion(version);
+ mprInput.setXid(xid);
+ mprInput.setFlags(new MultipartRequestFlags(false));
+
+ // Create multipart request body to fetch stats for all the port of the node
+ MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+ MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
+ //Select all queues
+ mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
+ //Select specific port
+ mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(arg0.getNodeConnectorId()));
+
+ caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
+
+ //Set request body to main multipart request
+ mprInput.setMultipartRequestBody(caseBuilder.build());
+
+ //Send the request, no cookies associated, use any connection
+ LOG.debug("Send queue statistics request :{}",mprQueueBuilder.build().toString());
+ this.messageService.multipartRequest(mprInput.build(), null);
+
+ // Prepare rpc return output. Set xid and send it back.
+ GetAllQueuesStatisticsFromGivenPortOutputBuilder output = new GetAllQueuesStatisticsFromGivenPortOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+ output.setQueueIdAndStatisticsMap(null);
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetAllQueuesStatisticsFromGivenPortOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
+ GetQueueStatisticsFromGivenPortInput arg0) {
+ //Generate xid to associate it with the request
+ Long xid = this.getSessionContext().getNextXid();
+
+ LOG.info("Prepare queue statistics request to collect stats for " +
+ "given queue attached to given port {} of node {} - TrasactionId - {}",arg0.getQueueId().toString(),arg0.getNodeConnectorId().toString(),arg0.getNode().getValue(),xid);
+
+ // Create multipart request header
+ MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+ mprInput.setType(MultipartType.OFPMPQUEUE);
+ mprInput.setVersion(version);
+ mprInput.setXid(xid);
+ mprInput.setFlags(new MultipartRequestFlags(false));
+
+ // Create multipart request body to fetch stats for all the port of the node
+ MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+ MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
+ //Select specific queue
+ mprQueueBuilder.setQueueId(arg0.getQueueId().getValue());
+ //Select specific port
+ mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(arg0.getNodeConnectorId()));
+
+ caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
+
+ //Set request body to main multipart request
+ mprInput.setMultipartRequestBody(caseBuilder.build());
+
+ //Send the request, no cookies associated, use any connection
+ LOG.debug("Send queue statistics request :{}",mprQueueBuilder.build().toString());
+ this.messageService.multipartRequest(mprInput.build(), null);
+
+ // Prepare rpc return output. Set xid and send it back.
+ GetQueueStatisticsFromGivenPortOutputBuilder output = new GetQueueStatisticsFromGivenPortOutputBuilder();
+ output.setTransactionId(generateTransactionId(xid));
+ output.setQueueIdAndStatisticsMap(null);
+
+ Collection<RpcError> errors = Collections.emptyList();
+ RpcResult<GetQueueStatisticsFromGivenPortOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<GetAllFlowStatisticsOutput>> getAllFlowStatistics(GetAllFlowStatisticsInput arg0) {
+ //TODO: Depricated, need to clean it up. Sal-Compatibility layes is dependent on it.
+ // Once sal-compatibility layer is fixed this rpc call can be removed from yang file
+ return null;
+ }
+
+ @Override
+ public Future<RpcResult<GetAllNodeConnectorStatisticsOutput>> getAllNodeConnectorStatistics(
+ GetAllNodeConnectorStatisticsInput arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput arg0) {
+ //TODO: Depricated, need to clean it up. Sal-Compatibility layes is dependent on it.
+ // Once sal-compatibility layer is fixed this rpc call can be removed from yang file
+ return null;
+ }
+
+ @Override
+ public Future<RpcResult<GetFlowTableStatisticsOutput>> getFlowTableStatistics(GetFlowTableStatisticsInput arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
+ GetNodeConnectorStatisticsInput arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+