Search in sources :

Example 1 with GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput in project openflowplugin by opendaylight.

the class OpendaylightFlowStatisticsServiceDelegateImplTest method testGetAggregateFlowStatisticsFromFlowTableForAllFlows.

@Test
public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
    GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder().setNode(createNodeRef("unitProt:123")).setTableId(new TableId((short) 1));
    Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.eq(deviceInfo), Matchers.any())).thenReturn(new AggregatedFlowStatisticsBuilder().setByteCount(new Counter64(BigInteger.valueOf(50L))).setPacketCount(new Counter64(BigInteger.valueOf(51L))).setFlowCount(new Counter32(52L)).build());
    rpcResult = RpcResultBuilder.<Object>success(Collections.singletonList(new MultipartReplyMessageBuilder().setType(MultipartType.OFPMPAGGREGATE).setVersion(OFConstants.OFP_VERSION_1_3).setFlags(new MultipartRequestFlags(false)).setMultipartReplyBody(new MultipartReplyAggregateCaseBuilder().setMultipartReplyAggregate(new MultipartReplyAggregateBuilder().setByteCount(BigInteger.valueOf(50L)).setPacketCount(BigInteger.valueOf(51L)).setFlowCount(52L).build()).build()).build())).build();
    final Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> resultFuture = flowStatisticsServiceDelegate.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
    Assert.assertTrue(resultFuture.isDone());
    final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResultCompatible = resultFuture.get();
    Assert.assertTrue(rpcResultCompatible.isSuccessful());
    Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
    Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)).offerNotification(Matchers.any(Notification.class));
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) AggregatedFlowStatisticsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatisticsBuilder) Notification(org.opendaylight.yangtools.yang.binding.Notification) Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) MultipartReplyAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder) Counter64(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64) GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput) MultipartReplyAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder) AbstractSingleStatsServiceTest(org.opendaylight.openflowplugin.impl.statistics.services.AbstractSingleStatsServiceTest) Test(org.junit.Test)

Example 2 with GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput in project openflowplugin by opendaylight.

the class AbstractCompatibleStatServiceTest method testHandleAndNotify.

@Test
public void testHandleAndNotify() throws Exception {
    GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder().setNode(createNodeRef("unitProt:123")).setTableId(new TableId((short) 1)).build();
    rpcResult = RpcResultBuilder.<Object>success(Collections.singletonList(new MultipartReplyMessageBuilder().setVersion(OFConstants.OFP_VERSION_1_3).setMultipartReplyBody(new MultipartReplyAggregateCaseBuilder().setMultipartReplyAggregate(new MultipartReplyAggregateBuilder().setByteCount(BigInteger.valueOf(11L)).setFlowCount(12L).setPacketCount(BigInteger.valueOf(13L)).build()).build()).build())).build();
    AggregatedFlowStatistics aggregatedStats = new AggregatedFlowStatisticsBuilder().setByteCount(new Counter64(BigInteger.valueOf(11L))).setFlowCount(new Counter32(12L)).setPacketCount(new Counter64(BigInteger.valueOf(13L))).build();
    Mockito.when(translator.translate(Matchers.any(MultipartReply.class), Matchers.eq(deviceInfo), Matchers.any())).thenReturn(aggregatedStats);
    ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> resultFuture = service.handleAndNotify(input, notificationPublishService);
    Assert.assertTrue(resultFuture.isDone());
    final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> result = resultFuture.get();
    Assert.assertTrue(result.isSuccessful());
    Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
    Mockito.verify(notificationPublishService, Mockito.timeout(500)).offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class));
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput) AggregatedFlowStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatistics) AggregatedFlowStatisticsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatisticsBuilder) MultipartReplyAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder) Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) Counter64(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64) GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) AggregateFlowStatisticsUpdate(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate) GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput) MultipartReplyAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder) Test(org.junit.Test) AbstractStatsServiceTest(org.opendaylight.openflowplugin.impl.statistics.services.AbstractStatsServiceTest)

Aggregations

Test (org.junit.Test)2 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)2 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)2 GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder)2 GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput)2 AggregatedFlowStatisticsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatisticsBuilder)2 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)2 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)2 MultipartReplyAggregateCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder)2 MultipartReplyAggregateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder)2 TableId (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId)2 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)2 AbstractSingleStatsServiceTest (org.opendaylight.openflowplugin.impl.statistics.services.AbstractSingleStatsServiceTest)1 AbstractStatsServiceTest (org.opendaylight.openflowplugin.impl.statistics.services.AbstractStatsServiceTest)1 AggregateFlowStatisticsUpdate (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate)1 GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput)1 AggregatedFlowStatistics (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatistics)1 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)1 Notification (org.opendaylight.yangtools.yang.binding.Notification)1