use of org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey in project openflowplugin by opendaylight.
the class MessageDeserializerInjector method revertLegacyDeserializers.
@VisibleForTesting
static void revertLegacyDeserializers(final DeserializerExtensionProvider provider) {
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 14));
provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 14), FlowModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 15));
provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 15), GroupModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 29));
provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 29), MeterModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 16));
provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 16), PortModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 19));
}
use of org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey in project openflowplugin by opendaylight.
the class DeserializationFactory method deserialize.
/**
* Transforms ByteBuf into correct POJO message.
*
* @param rawMessage the message
* @param version
* version decoded from OpenFlow protocol message
* @return correct POJO as DataObject
*/
public DataObject deserialize(final ByteBuf rawMessage, final short version) {
DataObject dataObject = null;
int type = rawMessage.readUnsignedByte();
Class<?> clazz = messageClassMap.get(new TypeToClassKey(version, type));
rawMessage.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
OFDeserializer<DataObject> deserializer = registry.getDeserializer(new MessageCodeKey(version, type, clazz));
dataObject = deserializer.deserialize(rawMessage);
return dataObject;
}
use of org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey in project openflowplugin by opendaylight.
the class MessageDeserializerInjectorTest method injectDeserializers.
@Test
public void injectDeserializers() throws Exception {
injector.apply(10).apply(OfHeader.class).accept(ofDeserializer);
verify(switchConnectionProvider).unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10));
verify(switchConnectionProvider).registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10), OfHeader.class);
verify(switchConnectionProvider).registerDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 10, OfHeader.class), ofDeserializer);
}
use of org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey in project openflowplugin by opendaylight.
the class MessageDeserializerInjector method revertDeserializers.
/**
* Reverts original message deserializers in provided.
* {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
*
* @param provider OpenflowJava deserializer extension provider
*/
static void revertDeserializers(final DeserializerExtensionProvider provider) {
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10));
provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10), PacketInMessage.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 19));
provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 19), MultipartReplyMessage.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 27));
provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 27), GetAsyncOutput.class);
}
Aggregations