Search in sources :

Example 26 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class MultipartReplyMessageFactory method setExperimenter.

private MultipartReplyExperimenterCase setExperimenter(final ByteBuf input) {
    final long expId = input.readUnsignedInt();
    final long expType = input.readUnsignedInt();
    final OFDeserializer<ExperimenterDataOfChoice> deserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId, expType));
    final MultipartReplyExperimenterBuilder mpExperimenterBld = new MultipartReplyExperimenterBuilder().setExperimenter(new ExperimenterId(expId)).setExpType(expType).setExperimenterDataOfChoice(deserializer.deserialize(input));
    final MultipartReplyExperimenterCaseBuilder mpReplyExperimenterCaseBld = new MultipartReplyExperimenterCaseBuilder().setMultipartReplyExperimenter(mpExperimenterBld.build());
    return mpReplyExperimenterCaseBld.build();
}
Also used : MultipartReplyExperimenterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyExperimenterCaseBuilder) ExperimenterDataOfChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) MultipartReplyExperimenterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenterBuilder)

Example 27 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class BundleControlConverterTest method testConvert.

private static void testConvert(final BundleControlSal ofpMessage, final BundleControlOnf ofjMessage, final boolean withProperty) {
    Assert.assertEquals("Wrong BundleId", new BundleId(ofpMessage.getSalControlData().getBundleId().getValue()), ofjMessage.getOnfControlGroupingData().getBundleId());
    Assert.assertEquals("Wrong type", BundleControlType.forValue(ofpMessage.getSalControlData().getType().getIntValue()), ofjMessage.getOnfControlGroupingData().getType());
    Assert.assertEquals("Wrong flags", new BundleFlags(ofpMessage.getSalControlData().getFlags().isAtomic(), ofpMessage.getSalControlData().getFlags().isOrdered()), ofjMessage.getOnfControlGroupingData().getFlags());
    if (withProperty) {
        final BundlePropertyExperimenter originalProperty = (BundlePropertyExperimenter) ofpMessage.getSalControlData().getBundleProperty().get(0).getBundlePropertyEntry();
        final BundlePropertyExperimenter convertedProperty = (BundlePropertyExperimenter) ofjMessage.getOnfControlGroupingData().getBundleProperty().get(0).getBundlePropertyEntry();
        Assert.assertEquals("Wrong property ExperimenterId", new ExperimenterId(originalProperty.getExperimenter()), convertedProperty.getExperimenter());
        Assert.assertEquals("Wrong property experimenter type", originalProperty.getExpType(), convertedProperty.getExpType());
        Assert.assertEquals("Wrong property data", originalProperty.getBundlePropertyExperimenterData(), convertedProperty.getBundlePropertyExperimenterData());
    } else {
        Assert.assertTrue("Properties not empty", ofjMessage.getOnfControlGroupingData().getBundleProperty().isEmpty());
    }
}
Also used : BundleId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleId) BundlePropertyExperimenter(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.property.grouping.bundle.property.entry.BundlePropertyExperimenter) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) BundleFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags)

Example 28 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class MultipartRequestInputFactory method serializeExperimenterBody.

private void serializeExperimenterBody(final MultipartRequestInput message, final ByteBuf outBuffer) {
    MultipartRequestExperimenterCase expCase = (MultipartRequestExperimenterCase) message.getMultipartRequestBody();
    MultipartRequestExperimenter experimenter = expCase.getMultipartRequestExperimenter();
    final long expId = experimenter.getExperimenter().getValue().longValue();
    final long expType = experimenter.getExpType().longValue();
    // write experimenterId and type
    outBuffer.writeInt((int) expId);
    outBuffer.writeInt((int) expType);
    // serialize experimenter data
    OFSerializer<ExperimenterDataOfChoice> serializer = registry.getSerializer(ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(EncodeConstants.OF13_VERSION_ID, expId, expType));
    serializer.serialize(experimenter.getExperimenterDataOfChoice(), outBuffer);
}
Also used : MultipartRequestExperimenter(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter) ExperimenterDataOfChoice(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice) MultipartRequestExperimenterCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCase)

Example 29 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class ExperimenterInputMessageFactoryTest method testV10.

/**
 * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
 * lookup and serialization.
 */
@Test
public void testV10() throws Exception {
    startUp(false);
    ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    builder.setExperimenter(new ExperimenterId(42L));
    builder.setExpType(21L);
    builder.setExperimenterDataOfChoice(vendorData);
    ExperimenterInput input = builder.build();
    Mockito.when(registry.getSerializer((ExperimenterIdSerializerKey<?>) Matchers.any())).thenReturn(serializer);
    expFactory.serialize(input, out);
    Mockito.verify(serializer, Mockito.times(1)).serialize(input.getExperimenterDataOfChoice(), out);
}
Also used : ExperimenterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) ExperimenterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput) Test(org.junit.Test)

Example 30 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class ExperimenterInputMessageFactoryTest method testV10Real.

/**
 * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
 * lookup and serialization.
 */
@Test(expected = IllegalStateException.class)
public void testV10Real() throws Exception {
    startUp(true);
    ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    builder.setExperimenter(new ExperimenterId(42L));
    builder.setExpType(21L);
    builder.setExperimenterDataOfChoice(vendorData);
    ExperimenterInput input = builder.build();
    expFactory.serialize(input, out);
}
Also used : ExperimenterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) ExperimenterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput) Test(org.junit.Test)

Aggregations

ExperimenterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)37 Test (org.junit.Test)14 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)13 ExperimenterDataOfChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice)9 ByteBuf (io.netty.buffer.ByteBuf)6 ExperimenterIdCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder)5 ExperimenterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder)5 ExperimenterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput)5 ExperimenterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder)5 ArrayList (java.util.ArrayList)4 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)4 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)3 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)3 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)2 MultipartRequestInputFactory (org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory)2 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)2 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)2 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)2 BigInteger (java.math.BigInteger)1