Search in sources :

Example 1 with ExperimenterIdMeterBandBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBandBuilder in project openflowplugin by opendaylight.

the class MeterConvertor method getBandsFromSAL.

private static void getBandsFromSAL(MeterBandHeaders meterBandHeaders, List<Bands> bands) {
    for (MeterBandHeader meterBandHeader : meterBandHeaders.getMeterBandHeader()) {
        // The band types :drop,DSCP_Remark or experimenter.
        if (null != meterBandHeader.getMeterBandTypes() && null != meterBandHeader.getMeterBandTypes().getFlags()) {
            if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtDrop()) {
                if (meterBandHeader.getBandType() != null) {
                    MeterBandDropBuilder meterBandDropBuilder = new MeterBandDropBuilder();
                    meterBandDropBuilder.setType(MeterBandType.OFPMBTDROP);
                    Drop drop = (Drop) meterBandHeader.getBandType();
                    meterBandDropBuilder.setBurstSize(drop.getDropBurstSize());
                    meterBandDropBuilder.setRate(drop.getDropRate());
                    MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
                    dropCaseBuilder.setMeterBandDrop(meterBandDropBuilder.build());
                    MeterBand meterBandItem = dropCaseBuilder.build();
                    BandsBuilder bandsB = new BandsBuilder();
                    bandsB.setMeterBand(meterBandItem);
                    // Bands list
                    bands.add(bandsB.build());
                } else {
                    logBandTypeMissing(MeterBandType.OFPMBTDROP);
                }
            } else if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtDscpRemark()) {
                if (meterBandHeader.getBandType() != null) {
                    MeterBandDscpRemarkBuilder meterBandDscpRemarkBuilder = new MeterBandDscpRemarkBuilder();
                    meterBandDscpRemarkBuilder.setType(MeterBandType.OFPMBTDSCPREMARK);
                    DscpRemark dscpRemark = (DscpRemark) meterBandHeader.getBandType();
                    meterBandDscpRemarkBuilder.setBurstSize(dscpRemark.getDscpRemarkBurstSize());
                    meterBandDscpRemarkBuilder.setRate(dscpRemark.getDscpRemarkRate());
                    meterBandDscpRemarkBuilder.setPrecLevel(dscpRemark.getPrecLevel());
                    MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
                    dscpCaseBuilder.setMeterBandDscpRemark(meterBandDscpRemarkBuilder.build());
                    MeterBand meterBandItem = dscpCaseBuilder.build();
                    BandsBuilder bandsB = new BandsBuilder();
                    bandsB.setMeterBand(meterBandItem);
                    // Bands list
                    bands.add(bandsB.build());
                } else {
                    logBandTypeMissing(MeterBandType.OFPMBTDSCPREMARK);
                }
            } else if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtExperimenter()) {
                if (meterBandHeader.getBandType() != null) {
                    MeterBandExperimenterBuilder meterBandExperimenterBuilder = new MeterBandExperimenterBuilder();
                    meterBandExperimenterBuilder.setType(MeterBandType.OFPMBTEXPERIMENTER);
                    Experimenter experimenter = (Experimenter) meterBandHeader.getBandType();
                    meterBandExperimenterBuilder.setBurstSize(experimenter.getExperimenterBurstSize());
                    meterBandExperimenterBuilder.setRate(experimenter.getExperimenterRate());
                    ExperimenterIdMeterBandBuilder expBuilder = new ExperimenterIdMeterBandBuilder();
                    expBuilder.setExperimenter(new ExperimenterId(experimenter.getExperimenter()));
                    meterBandExperimenterBuilder.addAugmentation(ExperimenterIdMeterBand.class, expBuilder.build());
                    // TODO - implement / finish experimenter meter band translation
                    MeterBandExperimenterCaseBuilder experimenterCaseBuilder = new MeterBandExperimenterCaseBuilder();
                    experimenterCaseBuilder.setMeterBandExperimenter(meterBandExperimenterBuilder.build());
                    MeterBand meterBandItem = experimenterCaseBuilder.build();
                    BandsBuilder bandsB = new BandsBuilder();
                    bandsB.setMeterBand(meterBandItem);
                    // Bands list
                    bands.add(bandsB.build());
                } else {
                    logBandTypeMissing(MeterBandType.OFPMBTEXPERIMENTER);
                }
            }
        } else {
            LOG.error("Invalid meter band data found.");
        }
    }
}
Also used : MeterBand(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.MeterBand) ExperimenterIdMeterBand(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBand) DscpRemark(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark) MeterBandDscpRemarkCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCaseBuilder) Experimenter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Experimenter) MeterBandDropBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.drop._case.MeterBandDropBuilder) MeterBandExperimenterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCaseBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) Drop(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Drop) MeterBandDscpRemarkBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder) MeterBandExperimenterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenterBuilder) MeterBandDropCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCaseBuilder) ExperimenterIdMeterBandBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBandBuilder) MeterBandHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader) BandsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.BandsBuilder)

Aggregations

Drop (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Drop)1 DscpRemark (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark)1 Experimenter (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Experimenter)1 MeterBandHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader)1 ExperimenterIdMeterBand (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBand)1 ExperimenterIdMeterBandBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBandBuilder)1 ExperimenterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)1 MeterBand (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.MeterBand)1 MeterBandDropCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCaseBuilder)1 MeterBandDscpRemarkCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCaseBuilder)1 MeterBandExperimenterCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCaseBuilder)1 MeterBandDropBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.drop._case.MeterBandDropBuilder)1 MeterBandDscpRemarkBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder)1 MeterBandExperimenterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenterBuilder)1 BandsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.BandsBuilder)1