Class SwitchConnectionProviderImpl
- java.lang.Object
-
- org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderImpl
-
- All Implemented Interfaces:
AutoCloseable
,DeserializerExtensionProvider
,SerializerExtensionProvider
,ConnectionInitializer
,SwitchConnectionProvider
public class SwitchConnectionProviderImpl extends Object implements SwitchConnectionProvider, ConnectionInitializer
Exposed class for server handling.
C -MatchEntrySerializerKey
parameter representing oxm_class (see specification)
F -MatchEntrySerializerKey
parameter representing oxm_field (see specification)- Author:
- mirehak, michal.polkorab
-
-
Constructor Summary
Constructors Constructor Description SwitchConnectionProviderImpl(@Nullable ConnectionConfiguration connConfig, OpenflowDiagStatusProvider openflowDiagStatusProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
ConnectionConfiguration
getConfiguration()
Returns the connection configuration.ServerFacade
getServerFacade()
void
initiateConnection(String host, int port)
Initiates connection towards device.void
registerActionDeserializer(ExperimenterActionDeserializerKey key, OFGeneralDeserializer deserializer)
Registers action deserializer.void
registerActionSerializer(ActionSerializerKey<?> key, OFGeneralSerializer serializer)
Registers an action serializer.void
registerDeserializer(MessageCodeKey key, OFGeneralDeserializer deserializer)
Registers deserializer.void
registerDeserializerMapping(TypeToClassKey key, Class<?> clazz)
Registers type to class mapping used to assign return type when deserializing message.void
registerErrorDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<ErrorMessage> deserializer)
Registers error message deserializer.void
registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<? extends ExperimenterDataOfChoice> deserializer)
Registers experimenter (vendor) message deserializer.void
registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<? extends ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer)
Registers an experimenter (vendor) message serializer.void
registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key, OFGeneralDeserializer deserializer)
Registers instruction deserializer.void
registerInstructionSerializer(InstructionSerializerKey<?> key, OFGeneralSerializer serializer)
Registers an instruction serializer.void
registerMatchEntryDeserializer(MatchEntryDeserializerKey key, OFGeneralDeserializer deserializer)
Registers match entry deserializer.<C extends OxmClassBase,F extends MatchField>
voidregisterMatchEntrySerializer(MatchEntrySerializerKey<C,F> key, OFGeneralSerializer serializer)
Registers a match entry serializer.void
registerMeterBandDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<MeterBandExperimenterCase> deserializer)
Registers meter band deserializer (used in multipart-reply meter-config).void
registerMeterBandSerializer(ExperimenterIdMeterSubTypeSerializerKey<MeterBandExperimenterCase> key, OFSerializer<MeterBandExperimenterCase> serializer)
Registers a meter band serializer (used in meter-mod messages).void
registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key, OFSerializer<MeterBandExperimenterCase> serializer)
Deprecated.Since we have used ExperimenterIdMeterSubTypeSerializerKey as MeterBandSerializer's key, in order to avoid the occurrence of an error, we should discard this function.void
registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<? extends ExperimenterDataOfChoice> deserializer)
Registers multipart-reply (stats) message deserializer.void
registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key, OFGeneralDeserializer deserializer)
Registers multipart-reply table-features message deserializer.void
registerMultipartRequestSerializer(ExperimenterIdSerializerKey<? extends ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer)
Registers a multipart-request (stats-request) serializer.void
registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key, OFGeneralSerializer serializer)
Registers a multipart-request table-features serializer.void
registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<QueueProperty> deserializer)
Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer.<K> void
registerSerializer(MessageTypeKey<K> key, OFGeneralSerializer serializer)
Registers a custom serializer.void
setSwitchConnectionHandler(SwitchConnectionHandler switchConnectionHandler)
Sets the SwitchConnectionHandler.com.google.common.util.concurrent.ListenableFuture<Boolean>
shutdown()
Stop listening to switches.com.google.common.util.concurrent.ListenableFuture<Boolean>
startup()
Start listening to switches, but please don't forget to doSwitchConnectionProvider.setSwitchConnectionHandler(SwitchConnectionHandler)
first.boolean
unregisterDeserializer(ExperimenterDeserializerKey key)
Unregisters custom deserializer.boolean
unregisterDeserializerMapping(TypeToClassKey key)
Unregisters type to class mapping used to assign return type when deserializing message.boolean
unregisterSerializer(ExperimenterSerializerKey key)
Unregisters a custom serializer.
-
-
-
Constructor Detail
-
SwitchConnectionProviderImpl
public SwitchConnectionProviderImpl(@Nullable ConnectionConfiguration connConfig, OpenflowDiagStatusProvider openflowDiagStatusProvider)
-
-
Method Detail
-
setSwitchConnectionHandler
public void setSwitchConnectionHandler(SwitchConnectionHandler switchConnectionHandler)
Description copied from interface:SwitchConnectionProvider
Sets the SwitchConnectionHandler.- Specified by:
setSwitchConnectionHandler
in interfaceSwitchConnectionProvider
- Parameters:
switchConnectionHandler
- instance being informed when new switch connects
-
shutdown
public com.google.common.util.concurrent.ListenableFuture<Boolean> shutdown()
Description copied from interface:SwitchConnectionProvider
Stop listening to switches.- Specified by:
shutdown
in interfaceSwitchConnectionProvider
- Returns:
- future, triggered to true, when all listening channels are down
-
startup
public com.google.common.util.concurrent.ListenableFuture<Boolean> startup()
Description copied from interface:SwitchConnectionProvider
Start listening to switches, but please don't forget to doSwitchConnectionProvider.setSwitchConnectionHandler(SwitchConnectionHandler)
first.- Specified by:
startup
in interfaceSwitchConnectionProvider
- Returns:
- future, triggered to true, when listening channel is up and running
-
getServerFacade
public ServerFacade getServerFacade()
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
unregisterSerializer
public boolean unregisterSerializer(ExperimenterSerializerKey key)
Description copied from interface:SerializerExtensionProvider
Unregisters a custom serializer.- Specified by:
unregisterSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookup- Returns:
- true if serializer was removed, false if no serializer was found under specified key
-
unregisterDeserializer
public boolean unregisterDeserializer(ExperimenterDeserializerKey key)
Description copied from interface:DeserializerExtensionProvider
Unregisters custom deserializer.- Specified by:
unregisterDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookup- Returns:
- true if deserializer was removed, false if no deserializer was found under specified key
-
registerActionSerializer
public void registerActionSerializer(ActionSerializerKey<?> key, OFGeneralSerializer serializer)
Description copied from interface:SerializerExtensionProvider
Registers an action serializer.- Specified by:
registerActionSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerActionDeserializer
public void registerActionDeserializer(ExperimenterActionDeserializerKey key, OFGeneralDeserializer deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers action deserializer.- Specified by:
registerActionDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerInstructionSerializer
public void registerInstructionSerializer(InstructionSerializerKey<?> key, OFGeneralSerializer serializer)
Description copied from interface:SerializerExtensionProvider
Registers an instruction serializer.- Specified by:
registerInstructionSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerInstructionDeserializer
public void registerInstructionDeserializer(ExperimenterInstructionDeserializerKey key, OFGeneralDeserializer deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers instruction deserializer.- Specified by:
registerInstructionDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerMatchEntrySerializer
public <C extends OxmClassBase,F extends MatchField> void registerMatchEntrySerializer(MatchEntrySerializerKey<C,F> key, OFGeneralSerializer serializer)
Description copied from interface:SerializerExtensionProvider
Registers a match entry serializer.- Specified by:
registerMatchEntrySerializer
in interfaceSerializerExtensionProvider
- Type Parameters:
C
- oxm typeF
- match field type- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerMatchEntryDeserializer
public void registerMatchEntryDeserializer(MatchEntryDeserializerKey key, OFGeneralDeserializer deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers match entry deserializer.- Specified by:
registerMatchEntryDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerErrorDeserializer
public void registerErrorDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<ErrorMessage> deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers error message deserializer.- Specified by:
registerErrorDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerExperimenterMessageDeserializer
public void registerExperimenterMessageDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<? extends ExperimenterDataOfChoice> deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers experimenter (vendor) message deserializer.- Specified by:
registerExperimenterMessageDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerMultipartReplyMessageDeserializer
public void registerMultipartReplyMessageDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<? extends ExperimenterDataOfChoice> deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers multipart-reply (stats) message deserializer.- Specified by:
registerMultipartReplyMessageDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerMultipartReplyTFDeserializer
public void registerMultipartReplyTFDeserializer(ExperimenterIdDeserializerKey key, OFGeneralDeserializer deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers multipart-reply table-features message deserializer.- Specified by:
registerMultipartReplyTFDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerQueuePropertyDeserializer
public void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<QueueProperty> deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer.- Specified by:
registerQueuePropertyDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerMeterBandDeserializer
public void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key, OFDeserializer<MeterBandExperimenterCase> deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers meter band deserializer (used in multipart-reply meter-config).- Specified by:
registerMeterBandDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerExperimenterMessageSerializer
public void registerExperimenterMessageSerializer(ExperimenterIdSerializerKey<? extends ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer)
Description copied from interface:SerializerExtensionProvider
Registers an experimenter (vendor) message serializer.- Specified by:
registerExperimenterMessageSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerMultipartRequestSerializer
public void registerMultipartRequestSerializer(ExperimenterIdSerializerKey<? extends ExperimenterDataOfChoice> key, OFSerializer<? extends ExperimenterDataOfChoice> serializer)
Description copied from interface:SerializerExtensionProvider
Registers a multipart-request (stats-request) serializer.- Specified by:
registerMultipartRequestSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerMultipartRequestTFSerializer
public void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey<TableFeatureProperties> key, OFGeneralSerializer serializer)
Description copied from interface:SerializerExtensionProvider
Registers a multipart-request table-features serializer.- Specified by:
registerMultipartRequestTFSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerMeterBandSerializer
@Deprecated public void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key, OFSerializer<MeterBandExperimenterCase> serializer)
Deprecated.Since we have used ExperimenterIdMeterSubTypeSerializerKey as MeterBandSerializer's key, in order to avoid the occurrence of an error, we should discard this function.Deprecated.- Specified by:
registerMeterBandSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerMeterBandSerializer
public void registerMeterBandSerializer(ExperimenterIdMeterSubTypeSerializerKey<MeterBandExperimenterCase> key, OFSerializer<MeterBandExperimenterCase> serializer)
Description copied from interface:SerializerExtensionProvider
Registers a meter band serializer (used in meter-mod messages).- Specified by:
registerMeterBandSerializer
in interfaceSerializerExtensionProvider
- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
initiateConnection
public void initiateConnection(String host, int port)
Description copied from interface:ConnectionInitializer
Initiates connection towards device.- Specified by:
initiateConnection
in interfaceConnectionInitializer
- Parameters:
host
- - host IPport
- - port number
-
getConfiguration
public ConnectionConfiguration getConfiguration()
Description copied from interface:SwitchConnectionProvider
Returns the connection configuration.- Specified by:
getConfiguration
in interfaceSwitchConnectionProvider
- Returns:
- configuration [protocol, port, address and supported features]
-
registerSerializer
public <K> void registerSerializer(MessageTypeKey<K> key, OFGeneralSerializer serializer)
Description copied from interface:SerializerExtensionProvider
Registers a custom serializer.Throws IllegalStateException when there is a serializer already registered under given key.
If the serializer implements
SerializerRegistryInjector
interface, the serializer is injected with SerializerRegistry instance.- Specified by:
registerSerializer
in interfaceSerializerExtensionProvider
- Type Parameters:
K
- serializer key type- Parameters:
key
- used for serializer lookupserializer
- serializer implementation
-
registerDeserializer
public void registerDeserializer(MessageCodeKey key, OFGeneralDeserializer deserializer)
Description copied from interface:DeserializerExtensionProvider
Registers deserializer. Throws IllegalStateException when there is a deserializer already registered under given key.If the deserializer implements
DeserializerRegistryInjector
interface, the deserializer is injected with DeserializerRegistry instance.- Specified by:
registerDeserializer
in interfaceDeserializerExtensionProvider
- Parameters:
key
- used for deserializer lookupdeserializer
- deserializer instance
-
registerDeserializerMapping
public void registerDeserializerMapping(TypeToClassKey key, Class<?> clazz)
Description copied from interface:DeserializerExtensionProvider
Registers type to class mapping used to assign return type when deserializing message.- Specified by:
registerDeserializerMapping
in interfaceDeserializerExtensionProvider
- Parameters:
key
- type to class keyclazz
- return class
-
unregisterDeserializerMapping
public boolean unregisterDeserializerMapping(TypeToClassKey key)
Description copied from interface:DeserializerExtensionProvider
Unregisters type to class mapping used to assign return type when deserializing message.- Specified by:
unregisterDeserializerMapping
in interfaceDeserializerExtensionProvider
- Parameters:
key
- type to class key- Returns:
- true if mapping was successfully removed
-
-