Search in sources :

Example 1 with GetFlowTablesStatisticsInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder in project openflowplugin by opendaylight.

the class OpendaylightFlowTableStatisticsServiceImplTest method testGetFlowTablesStatistics.

@Test
public void testGetFlowTablesStatistics() throws Exception {
    Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider).commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
    GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder().setNode(createNodeRef("unitProt:123"));
    rpcResult = RpcResultBuilder.<Object>success(Collections.singletonList(new MultipartReplyMessageBuilder().setVersion(OFConstants.OFP_VERSION_1_3).setMultipartReplyBody(new MultipartReplyTableCaseBuilder().setMultipartReplyTable(new MultipartReplyTableBuilder().setTableStats(Collections.singletonList(new TableStatsBuilder().setActiveCount(31L).setLookupCount(BigInteger.valueOf(32L)).setMatchedCount(BigInteger.valueOf(33L)).setMaxEntries(34L).setName("test-table").setNwDstMask((short) 35).setNwSrcMask((short) 36).setTableId(TABLE_ID).build())).build()).build()).build())).build();
    final Future<RpcResult<GetFlowTablesStatisticsOutput>> resultFuture = flowTableStatisticsService.getFlowTablesStatistics(input.build());
    Assert.assertTrue(resultFuture.isDone());
    final RpcResult<GetFlowTablesStatisticsOutput> rpcResult = resultFuture.get();
    Assert.assertTrue(rpcResult.isSuccessful());
    Assert.assertEquals(MultipartType.OFPMPTABLE, requestInput.getValue().getType());
    Mockito.verify(notificationPublishService).offerNotification(Matchers.<Notification>any());
}
Also used : MultipartReplyTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTableBuilder) GetFlowTablesStatisticsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetFlowTablesStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput) TableStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStatsBuilder) FutureCallback(com.google.common.util.concurrent.FutureCallback) MultipartReplyTableCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCaseBuilder) Test(org.junit.Test)

Example 2 with GetFlowTablesStatisticsInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder in project openflowplugin by opendaylight.

the class OpendaylightFlowTableStatisticsServiceImplTest method testBuildRequest.

@Test
public void testBuildRequest() throws Exception {
    Xid xid = new Xid(42L);
    GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder().setNode(createNodeRef("unitProt:123"));
    final OfHeader request = flowTableStatisticsService.buildRequest(xid, input.build());
    Assert.assertTrue(request instanceof MultipartRequestInput);
    final MultipartRequestInput mpRequest = (MultipartRequestInput) request;
    Assert.assertEquals(MultipartType.OFPMPTABLE, mpRequest.getType());
    Assert.assertTrue(mpRequest.getMultipartRequestBody() instanceof MultipartRequestTableCase);
    final MultipartRequestTableCase mpRequestBody = (MultipartRequestTableCase) (mpRequest.getMultipartRequestBody());
    Assert.assertTrue(mpRequestBody.getMultipartRequestTable().isEmpty());
}
Also used : MultipartRequestTableCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCase) Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) GetFlowTablesStatisticsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 GetFlowTablesStatisticsInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder)2 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)1 GetFlowTablesStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput)1 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)1 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)1 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)1 MultipartReplyTableCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCaseBuilder)1 MultipartReplyTableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTableBuilder)1 TableStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStatsBuilder)1 MultipartRequestTableCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCase)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1