use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder in project openflowplugin by opendaylight.
the class OpendaylightFlowStatisticsServiceImpl2Test method testGetAggregateFlowStatisticsFromFlowTableForGivenMatch.
@Test
public void testGetAggregateFlowStatisticsFromFlowTableForGivenMatch() throws Exception {
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider).commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
Mockito.doAnswer((Answer<Void>) invocation -> {
final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder().setVersion(OFConstants.OFP_VERSION_1_3);
rqContextMp.setResult(RpcResultBuilder.success(Collections.<MultipartReply>singletonList(messageBuilder.build())).build());
return null;
}).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.same(deviceInfo), Matchers.isNull())).thenReturn(new AggregatedFlowStatisticsBuilder().build());
GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder input = new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder().setNode(createNodeRef("unitProt:123")).setPriority(5).setTableId((short) 1);
final Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> resultFuture = flowStatisticsService.getAggregateFlowStatisticsFromFlowTableForGivenMatch(input.build());
Assert.assertTrue(resultFuture.isDone());
final RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> rpcResult = resultFuture.get();
Assert.assertTrue(rpcResult.isSuccessful());
Assert.assertEquals(1, rpcResult.getResult().getAggregatedFlowStatistics().size());
Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder in project openflowplugin by opendaylight.
the class SingleLayerAggregateFlowMultipartServiceTest method handleAndReply.
@Test
public void handleAndReply() throws Exception {
mockSuccessfulFuture(Collections.singletonList(new MultipartReplyBuilder().setMultipartReplyBody(new MultipartReplyFlowAggregateStatsBuilder().setByteCount(new Counter64(BYTE_COUNT)).build()).build()));
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input = new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder().setTableId(TABLE_ID).build();
final Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> rpcResultFuture = service.handleAndReply(input);
final RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> sendAggregateFlowMpRequestOutputRpcResult = rpcResultFuture.get();
assertEquals(BYTE_COUNT, sendAggregateFlowMpRequestOutputRpcResult.getResult().getAggregatedFlowStatistics().get(0).getByteCount().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder in project openflowplugin by opendaylight.
the class SingleLayerAggregateFlowMultipartServiceTest method buildRequest.
@Test
public void buildRequest() throws Exception {
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input = new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder().setTableId(TABLE_ID).build();
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
final MultipartRequestFlowAggregateStats result = MultipartRequestFlowAggregateStats.class.cast(MultipartRequest.class.cast(ofHeader).getMultipartRequestBody());
assertEquals(TABLE_ID, result.getTableId().shortValue());
}
Aggregations