Search in sources :

Example 31 with MultipartReply

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

the class MultipartReplyTranslatorUtilTest method translateTableFeatures.

@Test
public void translateTableFeatures() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPTABLEFEATURES, new MultipartReplyTableFeaturesCaseBuilder().setMultipartReplyTableFeatures(new MultipartReplyTableFeaturesBuilder().build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MultipartReplyTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCaseBuilder) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder) Test(org.junit.Test)

Example 32 with MultipartReply

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

the class MultipartReplyTranslatorUtilTest method translateFlow.

@Test
public void translateFlow() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPFLOW, new MultipartReplyFlowCaseBuilder().setMultipartReplyFlow(new MultipartReplyFlowBuilder().build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MultipartReplyFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlowBuilder) MultipartReplyFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCaseBuilder) Test(org.junit.Test)

Example 33 with MultipartReply

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

the class GroupFeaturesService method transformToNotification.

@Override
public GroupFeaturesUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
    final int mpSize = result.size();
    Preconditions.checkArgument(mpSize == 1, "unexpected (!=1) mp-reply size received: {}", mpSize);
    GroupFeaturesUpdatedBuilder notification = new GroupFeaturesUpdatedBuilder();
    notification.setId(getDeviceInfo().getNodeId());
    notification.setMoreReplies(Boolean.FALSE);
    notification.setTransactionId(emulatedTxId);
    MultipartReplyGroupFeaturesCase caseBody = (MultipartReplyGroupFeaturesCase) result.get(0).getMultipartReplyBody();
    MultipartReplyGroupFeatures replyBody = caseBody.getMultipartReplyGroupFeatures();
    notification.setGroupTypesSupported(extractSupportedGroupTypes(replyBody.getTypes()));
    notification.setMaxGroups(replyBody.getMaxGroups());
    notification.setGroupCapabilitiesSupported(extractSupportedCapabilities(replyBody.getCapabilities()));
    notification.setActions(GroupUtil.extractGroupActionsSupportBitmap(replyBody.getActionsBitmap()));
    return notification.build();
}
Also used : MultipartReplyGroupFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCase) GroupFeaturesUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdatedBuilder) MultipartReplyGroupFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeatures)

Example 34 with MultipartReply

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

the class OpendaylightFlowTableStatisticsServiceImpl method transformToNotification.

@Override
public FlowTableStatisticsUpdate transformToNotification(List<MultipartReply> mpReplyList, TransactionId emulatedTxId) {
    FlowTableStatisticsUpdateBuilder notification = new FlowTableStatisticsUpdateBuilder();
    notification.setId(getDeviceInfo().getNodeId());
    notification.setMoreReplies(Boolean.FALSE);
    notification.setTransactionId(emulatedTxId);
    final List<FlowTableAndStatisticsMap> salFlowStats = new ArrayList<>();
    notification.setFlowTableAndStatisticsMap(salFlowStats);
    for (MultipartReply mpReply : mpReplyList) {
        MultipartReplyTableCase caseBody = (MultipartReplyTableCase) mpReply.getMultipartReplyBody();
        MultipartReplyTable replyBody = caseBody.getMultipartReplyTable();
        List<TableStats> swTablesStats = replyBody.getTableStats();
        // TODO: Duplicate code: look at MultiReplyTranslatorUtil method translateTable
        for (TableStats swTableStats : swTablesStats) {
            FlowTableAndStatisticsMapBuilder statisticsBuilder = new FlowTableAndStatisticsMapBuilder();
            statisticsBuilder.setActiveFlows(new Counter32(swTableStats.getActiveCount()));
            statisticsBuilder.setPacketsLookedUp(new Counter64(swTableStats.getLookupCount()));
            statisticsBuilder.setPacketsMatched(new Counter64(swTableStats.getMatchedCount()));
            statisticsBuilder.setTableId(new TableId(swTableStats.getTableId()));
            salFlowStats.add(statisticsBuilder.build());
        }
    }
    return notification.build();
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId) MultipartReplyTableCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) FlowTableStatisticsUpdateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdateBuilder) ArrayList(java.util.ArrayList) FlowTableAndStatisticsMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMapBuilder) TableStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStats) FlowTableAndStatisticsMap(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap) 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) MultipartReplyTable(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable)

Example 35 with MultipartReply

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

the class PortDirectStatisticsService method buildReply.

@Override
protected GetNodeConnectorStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
    final List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMap = new ArrayList<>();
    if (success) {
        for (final MultipartReply mpReply : input) {
            final MultipartReplyPortStatsCase caseBody = (MultipartReplyPortStatsCase) mpReply.getMultipartReplyBody();
            final MultipartReplyPortStats replyBody = caseBody.getMultipartReplyPortStats();
            for (final PortStats portStats : replyBody.getPortStats()) {
                final NodeConnectorId nodeConnectorId = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(getDatapathId(), portStats.getPortNo(), getOfVersion());
                final BytesBuilder bytesBuilder = new BytesBuilder().setReceived(portStats.getRxBytes()).setTransmitted(portStats.getTxBytes());
                final PacketsBuilder packetsBuilder = new PacketsBuilder().setReceived(portStats.getRxPackets()).setTransmitted(portStats.getTxPackets());
                final DurationBuilder durationBuilder = new DurationBuilder();
                if (portStats.getDurationSec() != null) {
                    durationBuilder.setSecond(new Counter32(portStats.getDurationSec()));
                }
                if (portStats.getDurationNsec() != null) {
                    durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
                }
                final NodeConnectorStatisticsAndPortNumberMap stats = new NodeConnectorStatisticsAndPortNumberMapBuilder().setBytes(bytesBuilder.build()).setPackets(packetsBuilder.build()).setNodeConnectorId(nodeConnectorId).setDuration(durationBuilder.build()).setCollisionCount(portStats.getCollisions()).setKey(new NodeConnectorStatisticsAndPortNumberMapKey(nodeConnectorId)).setReceiveCrcError(portStats.getRxCrcErr()).setReceiveDrops(portStats.getRxDropped()).setReceiveErrors(portStats.getRxErrors()).setReceiveFrameError(portStats.getRxFrameErr()).setReceiveOverRunError(portStats.getRxOverErr()).setTransmitDrops(portStats.getTxDropped()).setTransmitErrors(portStats.getTxErrors()).build();
                nodeConnectorStatisticsAndPortNumberMap.add(stats);
            }
        }
    }
    return new GetNodeConnectorStatisticsOutputBuilder().setNodeConnectorStatisticsAndPortNumberMap(nodeConnectorStatisticsAndPortNumberMap).build();
}
Also used : MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) GetNodeConnectorStatisticsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsOutputBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) ArrayList(java.util.ArrayList) PacketsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder) Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) NodeConnectorStatisticsAndPortNumberMapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey) NodeConnectorStatisticsAndPortNumberMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder) MultipartReplyPortStatsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCase) MultipartReplyPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats) PortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStats) NodeConnectorStatisticsAndPortNumberMap(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap) BytesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder) DurationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)

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