Search in sources :

Example 1 with UpdatedMeter

use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter in project openflowplugin by opendaylight.

the class SalMeterServiceImplTest method updateMeter.

private void updateMeter() throws Exception {
    final UpdatedMeter dummyUpdatedMeter = new UpdatedMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
    final OriginalMeter dummyOriginalMeter = new OriginalMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
    final UpdateMeterInput updateMeterInput = new UpdateMeterInputBuilder().setUpdatedMeter(dummyUpdatedMeter).setOriginalMeter(dummyOriginalMeter).build();
    this.<AddMeterOutput>mockSuccessfulFuture();
    salMeterService.updateMeter(updateMeterInput);
    verify(mockedRequestContextStack).createRequestContext();
}
Also used : OriginalMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeter) UpdateMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder) AddMeterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput) UpdatedMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter) UpdatedMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder) OriginalMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder) UpdateMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)

Example 2 with UpdatedMeter

use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter in project openflowplugin by opendaylight.

the class MeterConvertor method convert.

@Override
public MeterModInputBuilder convert(Meter source, VersionConvertorData data) {
    MeterModInputBuilder meterModInputBuilder = new MeterModInputBuilder();
    List<Bands> bands = new ArrayList<>();
    if (source instanceof AddMeterInput) {
        meterModInputBuilder.setCommand(MeterModCommand.OFPMCADD);
    } else if (source instanceof RemoveMeterInput) {
        meterModInputBuilder.setCommand(MeterModCommand.OFPMCDELETE);
    } else if (source instanceof UpdatedMeter) {
        meterModInputBuilder.setCommand(MeterModCommand.OFPMCMODIFY);
    }
    meterModInputBuilder.setMeterId(new MeterId(source.getMeterId().getValue()));
    if (null != source.getFlags()) {
        meterModInputBuilder.setFlags(new MeterFlags(source.getFlags().isMeterBurst(), source.getFlags().isMeterKbps(), source.getFlags().isMeterPktps(), source.getFlags().isMeterStats()));
    } else {
        /*
             * As per 0F1.3.1,The rate field indicates the rate value above
             * which the corresponding band may apply to packets (see 5.7.1).
             * The rate value is in kilobit per seconds, unless the flags eld
             * includes OFPMF_PKTPS, in which case the rate is in packets per
             * seconds.
             */
        meterModInputBuilder.setFlags(new MeterFlags(false, false, true, false));
    }
    if (source.getMeterBandHeaders() != null) {
        getBandsFromSAL(source.getMeterBandHeaders(), bands);
        meterModInputBuilder.setBands(bands);
    } else {
        LOG.error("For this meter Id" + source.getMeterId().getValue() + ",no associated band data found!");
    }
    meterModInputBuilder.setVersion(data.getVersion());
    return meterModInputBuilder;
}
Also used : MeterModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder) Bands(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.Bands) AddMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput) MeterFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags) ArrayList(java.util.ArrayList) UpdatedMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter) RemoveMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId)

Aggregations

UpdatedMeter (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter)2 ArrayList (java.util.ArrayList)1 AddMeterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput)1 AddMeterOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput)1 RemoveMeterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput)1 UpdateMeterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput)1 UpdateMeterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder)1 OriginalMeter (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeter)1 OriginalMeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder)1 UpdatedMeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder)1 MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)1 MeterFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags)1 MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId)1 MeterModInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder)1 Bands (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.Bands)1