use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty in project openflowplugin by opendaylight.
the class BundleControlFactory method deserialize.
@Override
public BundleControlOnf deserialize(ByteBuf message) {
BundleId bundleId = new BundleId(message.readUnsignedInt());
BundleControlType type = BundleControlType.forValue(message.readUnsignedShort());
BundleFlags flags = createBundleFlags(message.readUnsignedShort());
OnfControlGroupingDataBuilder builder = new OnfControlGroupingDataBuilder();
List<BundleProperty> properties = createBundleProperties(message);
builder.setBundleId(bundleId).setType(type).setFlags(flags).setBundleProperty(properties);
return new BundleControlOnfBuilder().setOnfControlGroupingData(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty 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.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty in project openflowplugin by opendaylight.
the class BundleAddMessageConverterTest method createMessage.
private static BundleAddMessageSal createMessage(final boolean withProperty, final BundleInnerMessage innerMessage) {
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
dataBuilder.setBundleId(new BundleId(1L));
dataBuilder.setFlags(new BundleFlags(true, false));
List<BundleProperty> properties = new ArrayList<>();
if (withProperty) {
properties.add(BundleTestUtils.createExperimenterProperty(Mockito.mock(BundlePropertyExperimenterData.class)));
}
dataBuilder.setBundleProperty(properties);
dataBuilder.setBundleInnerMessage(innerMessage);
return new BundleAddMessageSalBuilder().setSalAddMessageData(dataBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty in project openflowplugin by opendaylight.
the class BundleControlFactory method createBundleProperties.
private List<BundleProperty> createBundleProperties(final ByteBuf message) {
List<BundleProperty> properties = new ArrayList<>();
while (message.readableBytes() > 0) {
BundlePropertyType type = BundlePropertyType.forValue(message.readUnsignedShort());
int length = message.readUnsignedShort();
if (type != null && type.equals(BundlePropertyType.ONFETBPTEXPERIMENTER)) {
properties.add(createExperimenterBundleProperty(length, message));
} else {
message.skipBytes(length);
}
}
return properties;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty in project openflowplugin by opendaylight.
the class AbstractBundleMessageFactory method writeBundleProperties.
void writeBundleProperties(final List<BundleProperty> properties, final ByteBuf outBuffer) {
for (BundleProperty property : properties) {
BundlePropertyType type = property.getType();
if (type != null && type.equals(BundlePropertyType.ONFETBPTEXPERIMENTER)) {
final int startIndex = outBuffer.writerIndex();
outBuffer.writeShort(type.getIntValue());
int lengthIndex = outBuffer.writerIndex();
outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
writeBundleExperimenterProperty((BundlePropertyExperimenter) property.getBundlePropertyEntry(), outBuffer);
outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);
} else {
LOG.warn("Trying to serialize unknown bundle property (type: {}), skipping", type != null ? type.getIntValue() : 0);
}
}
}
Aggregations