Search in sources :

Example 1 with MeterCapability

use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterCapability in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtil method translateMeterFeatures.

private static org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterFeatures translateMeterFeatures(final MultipartReply msg) {
    MultipartReplyMeterFeaturesBuilder message = new MultipartReplyMeterFeaturesBuilder();
    MultipartReplyMeterFeaturesCase caseBody = (MultipartReplyMeterFeaturesCase) msg.getMultipartReplyBody();
    MultipartReplyMeterFeatures replyBody = caseBody.getMultipartReplyMeterFeatures();
    message.setMaxBands(replyBody.getMaxBands());
    message.setMaxColor(replyBody.getMaxColor());
    message.setMaxMeter(new Counter32(replyBody.getMaxMeter()));
    List<Class<? extends MeterCapability>> supportedCapabilities = new ArrayList<>();
    if (replyBody.getCapabilities().isOFPMFBURST()) {
        supportedCapabilities.add(MeterBurst.class);
    }
    if (replyBody.getCapabilities().isOFPMFKBPS()) {
        supportedCapabilities.add(MeterKbps.class);
    }
    if (replyBody.getCapabilities().isOFPMFPKTPS()) {
        supportedCapabilities.add(MeterPktps.class);
    }
    if (replyBody.getCapabilities().isOFPMFSTATS()) {
        supportedCapabilities.add(MeterStats.class);
    }
    message.setMeterCapabilitiesSupported(supportedCapabilities);
    List<Class<? extends MeterBand>> supportedMeterBand = new ArrayList<>();
    if (replyBody.getBandTypes().isOFPMBTDROP()) {
        supportedMeterBand.add(MeterBandDrop.class);
    }
    if (replyBody.getBandTypes().isOFPMBTDSCPREMARK()) {
        supportedMeterBand.add(MeterBandDscpRemark.class);
    }
    message.setMeterBandSupported(supportedMeterBand);
    return message.build();
}
Also used : Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) MeterBand(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterBand) MultipartReplyMeterFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesBuilder) MultipartReplyMeterFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.features._case.MultipartReplyMeterFeatures) ArrayList(java.util.ArrayList) MeterCapability(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterCapability) MultipartReplyMeterFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase)

Aggregations

ArrayList (java.util.ArrayList)1 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)1 MultipartReplyMeterFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesBuilder)1 MeterBand (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterBand)1 MeterCapability (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterCapability)1 MultipartReplyMeterFeaturesCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase)1 MultipartReplyMeterFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.features._case.MultipartReplyMeterFeatures)1