use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.
the class OF10StatsRequestInputFactory method serializeExperimenterBody.
private void serializeExperimenterBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
MultipartRequestExperimenterCase expCase = (MultipartRequestExperimenterCase) multipartRequestBody;
MultipartRequestExperimenter experimenter = expCase.getMultipartRequestExperimenter();
final long expId = experimenter.getExperimenter().getValue().longValue();
// write experimenterId
output.writeInt((int) expId);
OFSerializer<ExperimenterDataOfChoice> serializer = registry.getSerializer(ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(EncodeConstants.OF10_VERSION_ID, expId, -1));
serializer.serialize(experimenter.getExperimenterDataOfChoice(), output);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.
the class BundleControlFactory method createExperimenterBundleProperty.
// FB doesn't recognize Objects.requireNonNull
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
private BundleProperty createExperimenterBundleProperty(final int length, final ByteBuf message) {
Objects.requireNonNull(deserializerRegistry);
BundlePropertyExperimenterBuilder experimenterProperty = new BundlePropertyExperimenterBuilder();
long experimenterId = message.readUnsignedInt();
long expType = message.readUnsignedInt();
experimenterProperty.setExperimenter(new ExperimenterId(experimenterId));
experimenterProperty.setExpType(expType);
OFDeserializer<BundlePropertyExperimenterData> deserializer = deserializerRegistry.getDeserializer(new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF13_VERSION_ID, experimenterId, expType, BundlePropertyExperimenterData.class));
experimenterProperty.setBundlePropertyExperimenterData(deserializer.deserialize(message.readBytes(length - 12)));
return new BundlePropertyBuilder().setType(BundlePropertyType.ONFETBPTEXPERIMENTER).setBundlePropertyEntry(experimenterProperty.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.
the class BundleAddMessageConverterTest method testConvert.
private void testConvert(final BundleInnerMessage message, Class clazz, final boolean withProperty) throws Exception {
final BundleAddMessageSal original = createMessage(withProperty, message);
final BundleAddMessageOnf converted = converter.convert(original);
Assert.assertEquals("Wrong BundleId", new BundleId(original.getSalAddMessageData().getBundleId().getValue()), converted.getOnfAddMessageGroupingData().getBundleId());
Assert.assertEquals("Wrong flags", new BundleFlags(original.getSalAddMessageData().getFlags().isAtomic(), original.getSalAddMessageData().getFlags().isOrdered()), converted.getOnfAddMessageGroupingData().getFlags());
Assert.assertEquals("Wrong inner message conversion", clazz, converted.getOnfAddMessageGroupingData().getBundleInnerMessage().getImplementedInterface());
if (withProperty) {
final BundlePropertyExperimenter originalProperty = (BundlePropertyExperimenter) original.getSalAddMessageData().getBundleProperty().get(0).getBundlePropertyEntry();
final BundlePropertyExperimenter convertedProperty = (BundlePropertyExperimenter) converted.getOnfAddMessageGroupingData().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", converted.getOnfAddMessageGroupingData().getBundleProperty().isEmpty());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.
the class OF13MatchSerializerTest method testSerializeExperimenterMatchEntry.
/**
* Test serialize experimenter match entry - with no experimenter
* match entry serializer registered.
*/
@Test(expected = IllegalStateException.class)
public void testSerializeExperimenterMatchEntry() {
final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(ExperimenterClass.class);
builder.setOxmMatchField(OxmMatchFieldClass.class);
builder.setHasMask(true);
ExperimenterIdCaseBuilder caseBuilder = new ExperimenterIdCaseBuilder();
ExperimenterBuilder expBuilder = new ExperimenterBuilder();
expBuilder.setExperimenter(new ExperimenterId(42L));
caseBuilder.setExperimenter(expBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
entries.add(builder.build());
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
((OF13MatchSerializer) matchSerializer).serializeMatchEntries(entries, out);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.
the class SalExperimenterMessageServiceImplTest method setup.
@Override
protected void setup() {
salExperimenterMessageService = new SalExperimenterMessageServiceImpl(mockedRequestContextStack, mockedDeviceContext, extensionConverterProvider);
Mockito.when(extensionConverterProvider.getMessageConverter(Matchers.<TypeVersionKey>any())).thenReturn(extensionConverter);
Mockito.when(extensionConverter.getExperimenterId()).thenReturn(new ExperimenterId(43L));
Mockito.when(extensionConverter.getType()).thenReturn(44L);
}
Aggregations