Search in sources :

Example 21 with MeterBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder in project openflowplugin by opendaylight.

the class MeterInstructionSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final long meter = 2;
    final Instruction instruction = new MeterCaseBuilder().setMeter(new MeterBuilder().setMeterId(new MeterId(meter)).build()).build();
    assertInstruction(instruction, out -> assertEquals(out.readUnsignedInt(), meter));
}
Also used : MeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction) MeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId) Test(org.junit.Test)

Example 22 with MeterBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginMeterTestCommandProvider method _modifyMeter.

public void _modifyMeter(CommandInterpreter ci) {
    String nref = ci.nextArgument();
    if (nref == null) {
        ci.println("test node added");
        createTestNode();
    } else {
        ci.println("User node added" + nref);
        createUserNode(nref);
    }
    MeterBuilder meter = createTestMeter();
    meter.setMeterName(updatedMeterName);
    writeMeter(ci, meter.build());
    meter.setMeterName(originalMeterName);
    writeMeter(ci, meter.build());
}
Also used : MeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder)

Example 23 with MeterBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginMeterTestCommandProvider method createTestMeter.

private MeterBuilder createTestMeter() {
    // Sample data , committing to DataStore
    long id = 12;
    MeterKey key = new MeterKey(new MeterId(id));
    MeterBuilder meter = new MeterBuilder();
    meter.setContainerName("abcd");
    meter.setKey(key);
    meter.setMeterId(new MeterId(9L));
    meter.setMeterName(originalMeterName);
    meter.setFlags(new MeterFlags(true, false, false, false));
    MeterBandHeaderBuilder bandHeader = new MeterBandHeaderBuilder();
    bandHeader.setBandRate((long) 234);
    bandHeader.setBandBurstSize((long) 444);
    DscpRemarkBuilder dscpRemark = new DscpRemarkBuilder();
    dscpRemark.setDscpRemarkBurstSize((long) 5);
    dscpRemark.setPrecLevel((short) 1);
    dscpRemark.setDscpRemarkRate((long) 12);
    bandHeader.setBandType(dscpRemark.build());
    MeterBandTypesBuilder bandTypes = new MeterBandTypesBuilder();
    MeterBandType bandType = new MeterBandType(false, true, false);
    bandTypes.setFlags(bandType);
    bandHeader.setMeterBandTypes(bandTypes.build());
    bandHeader.setBandId(new BandId(0L));
    List<MeterBandHeader> bandHdr = new ArrayList<>();
    bandHdr.add(bandHeader.build());
    MeterBandHeadersBuilder bandHeaders = new MeterBandHeadersBuilder();
    bandHeaders.setMeterBandHeader(bandHdr);
    meter.setMeterBandHeaders(bandHeaders.build());
    testMeter = meter.build();
    return meter;
}
Also used : MeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder) DscpRemarkBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemarkBuilder) MeterBandType(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterBandType) MeterBandTypesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder) ArrayList(java.util.ArrayList) MeterBandHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId) MeterKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey) MeterBandHeadersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeadersBuilder) MeterFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterFlags) MeterBandHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader) BandId(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.BandId)

Example 24 with MeterBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder in project openflowplugin by opendaylight.

the class MultipartRequestInputMessageFactory method setMeter.

private MultipartRequestMeterCase setMeter(ByteBuf input) {
    MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
    MultipartRequestMeterBuilder meterBuilder = new MultipartRequestMeterBuilder();
    meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
    caseBuilder.setMultipartRequestMeter(meterBuilder.build());
    return caseBuilder.build();
}
Also used : MultipartRequestMeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder) MultipartRequestMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId)

Example 25 with MeterBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder in project openflowplugin by opendaylight.

the class MultipartRequestInputMessageFactory method setMeterConfig.

private MultipartRequestMeterConfigCase setMeterConfig(ByteBuf input) {
    MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
    MultipartRequestMeterConfigBuilder meterBuilder = new MultipartRequestMeterConfigBuilder();
    meterBuilder.setMeterId(new MeterId(input.readUnsignedInt()));
    caseBuilder.setMultipartRequestMeterConfig(meterBuilder.build());
    return caseBuilder.build();
}
Also used : MultipartRequestMeterConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder) MultipartRequestMeterConfigCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterConfigCaseBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId)

Aggregations

MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)13 ArrayList (java.util.ArrayList)12 MeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder)11 Test (org.junit.Test)10 MeterCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder)7 MeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder)7 Meter (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter)6 MeterKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey)6 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)6 MeterCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder)6 MeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder)6 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder)6 InstructionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder)5 InstructionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder)5 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)4 StaleMeter (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.StaleMeter)4 StaleMeterKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.StaleMeterKey)4 BigInteger (java.math.BigInteger)3 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder)3 ClearActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCaseBuilder)3