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();
}
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());
}
}
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);
}
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);
}
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);
}
Aggregations