Search in sources :

Example 26 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class FlowDirectStatisticsServiceTest method testBuildReply.

@Override
public void testBuildReply() throws Exception {
    final FlowAndStatisticsMapList flowStat = new FlowAndStatisticsMapListBuilder().setDuration(new DurationBuilder().setSecond(new Counter32(1L)).setNanosecond(new Counter32(1L)).build()).setTableId(TABLE_NO).setByteCount(new Counter64(BigInteger.ONE)).setPacketCount(new Counter64(BigInteger.ONE)).setFlags(new FlowModFlags(true, false, false, false, false)).setMatch(new MatchBuilder().build()).build();
    final MultipartReply reply = new MultipartReplyBuilder().setMultipartReplyBody(new MultipartReplyFlowStatsBuilder().setFlowAndStatisticsMapList(Collections.singletonList(flowStat)).build()).build();
    final List<MultipartReply> input = Collections.singletonList(reply);
    final GetFlowStatisticsOutput output = service.buildReply(input, true);
    assertTrue(output.getFlowAndStatisticsMapList().size() > 0);
    final FlowAndStatisticsMap stats = output.getFlowAndStatisticsMapList().get(0);
    assertEquals(stats.getTableId(), TABLE_NO);
}
Also used : FlowModFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply) FlowAndStatisticsMap(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowAndStatisticsMap) FlowAndStatisticsMapList(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList) FlowAndStatisticsMapListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder) 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) MultipartReplyFlowStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStatsBuilder) MultipartReplyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder) GetFlowStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutput) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) DurationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)

Example 27 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class AllMeterConfigStatsService method transformToNotification.

@Override
public MeterConfigStatsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
    MeterConfigStatsUpdatedBuilder message = new MeterConfigStatsUpdatedBuilder();
    message.setId(getDeviceInfo().getNodeId());
    message.setMoreReplies(Boolean.FALSE);
    message.setTransactionId(emulatedTxId);
    message.setMeterConfigStats(new ArrayList<>());
    for (MultipartReply mpReply : result) {
        MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase) mpReply.getMultipartReplyBody();
        MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
        final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
        meterConfigStatsList.ifPresent(meterConfigStats -> message.getMeterConfigStats().addAll(meterConfigStats));
    }
    return message.build();
}
Also used : MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MeterConfigStatsUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterConfigStatsUpdatedBuilder) ArrayList(java.util.ArrayList) List(java.util.List) MultipartReplyMeterConfigCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfigCase) MultipartReplyMeterConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.MultipartReplyMeterConfig)

Example 28 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtilTest method translatePortDesc.

@Test
public void translatePortDesc() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPPORTDESC, new MultipartReplyPortDescCaseBuilder().setMultipartReplyPortDesc(new MultipartReplyPortDescBuilder().setPorts(Collections.singletonList(new PortsBuilder().build())).build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReplyPortDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.MultipartReplyPortDescBuilder) MultipartReplyPortDescCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortDescCaseBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) PortsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.desc._case.multipart.reply.port.desc.PortsBuilder) Test(org.junit.Test)

Example 29 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtilTest method translateAggregate.

@Test
public void translateAggregate() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPAGGREGATE, new MultipartReplyAggregateCaseBuilder().setMultipartReplyAggregate(new MultipartReplyAggregateBuilder().setByteCount(BigInteger.ONE).setFlowCount(10L).setPacketCount(BigInteger.ONE).build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReplyAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MultipartReplyAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder) Test(org.junit.Test)

Example 30 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtilTest method translateTable.

@Test
public void translateTable() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPTABLE, new MultipartReplyTableCaseBuilder().setMultipartReplyTable(new MultipartReplyTableBuilder().setTableStats(Collections.singletonList(new TableStatsBuilder().setActiveCount(10L).setLookupCount(BigInteger.ONE).setMatchedCount(BigInteger.ONE).setTableId((short) 10).build())).build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReplyTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTableBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) TableStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStatsBuilder) MultipartReplyTableCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCaseBuilder) Test(org.junit.Test)

Aggregations

MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)52 Test (org.junit.Test)29 ArrayList (java.util.ArrayList)25 List (java.util.List)25 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)13 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)11 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)10 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)10 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)7 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)6 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)6 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply)6 MultipartReplyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder)6 ConvertorManager (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager)5 QueueId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId)5 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)5 TranslatorKey (org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey)4 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)4 MultipartReplyFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase)4 MultipartReplyMeterCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterCase)4