Search in sources :

Example 1 with BundlePropertyType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundlePropertyType 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;
}
Also used : ArrayList(java.util.ArrayList) BundleProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty) BundlePropertyType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundlePropertyType)

Example 2 with BundlePropertyType

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundlePropertyType 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);
        }
    }
}
Also used : BundleProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty) BundlePropertyType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundlePropertyType)

Aggregations

BundlePropertyType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundlePropertyType)2 BundleProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.bundle.common.grouping.BundleProperty)2 ArrayList (java.util.ArrayList)1