import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
/**
+ * Manages a switch connection.
+ *
* @author mirehak
* @author michal.polkorab
*/
public interface ConnectionAdapter extends OpenflowProtocolService {
/**
- * disconnect corresponding switch
+ * Disconnect corresponding switch.
+ *
* @return future set to true, when disconnect completed
*/
Future<Boolean> disconnect();
/**
+ * Determines if the connection to the switch is alive.
+ *
* @return true, if connection to switch is alive
*/
boolean isAlive();
/**
+ * Returns the address of the connected switch.
+ *
* @return address of the remote end - address of a switch if connected
*/
InetSocketAddress getRemoteAddress();
/**
+ * Sets the protocol message listener.
+ *
* @param messageListener here will be pushed all messages from switch
*/
void setMessageListener(OpenflowProtocolListener messageListener);
/**
+ * Sets the system message listener.
+ *
* @param systemListener here will be pushed all system messages from library
*/
void setSystemListener(SystemNotificationsListener systemListener);
/**
- * Set handler for alien messages received from device
+ * Set handler for alien messages received from device.
+ *
* @param alienMessageListener here will be pushed all alien messages from switch
*/
void setAlienMessageListener(AlienMessageListener alienMessageListener);
/**
- * Throws exception if any of required listeners is missing
+ * Throws exception if any of required listeners is missing.
*/
void checkListeners();
/**
- * notify listener about connection ready-to-use event
+ * Notify listener about connection ready-to-use event.
*/
void fireConnectionReadyNotification();
/**
- * set listener for connection became ready-to-use event
+ * Set listener for connection became ready-to-use event.
+ *
* @param connectionReadyListener listens to connection ready event
*/
void setConnectionReadyListener(ConnectionReadyListener connectionReadyListener);
/**
- * sets option for automatic channel reading;
- * if set to false, incoming messages won't be read
+ * Sets option for automatic channel reading - if set to false, incoming messages won't be read.
*
* @param autoRead target value to be switched to
*/
void setAutoRead(boolean autoRead);
/**
- * @return true, if channel is configured to autoread
+ * Determines if the channel is configured to auto-read.
+ *
+ * @return true, if channel is configured to auto-read
*/
boolean isAutoRead();
/**
- * Registers a new bypass outbound queue
+ * Registers a new bypass outbound queue.
+ *
* @param <T> handler type
* @param handler queue handler
* @param maxQueueDepth max amount of not confirmed messaged in queue (i.e. edge for barrier message)
import java.net.InetAddress;
/**
+ * Configuration for a switch connection.
+ *
* @author mirehak
*/
public interface ConnectionConfiguration {
/**
+ * Returns address to bind.
+ *
* @return address to bind, if null, all available interfaces will be used
*/
InetAddress getAddress();
/**
+ * Returns the port to bind.
+ *
* @return port to bind
*/
int getPort();
/**
+ * Returns the transport protocol to use.
+ *
* @return transport protocol to use
*/
Object getTransferProtocol();
/**
+ * Returns the TLS configuration.
+ *
* @return TLS configuration object
*/
TlsConfiguration getTlsConfiguration();
/**
+ * Returns the swicth idle timeout.
+ *
* @return silence time (in milliseconds) - after this time
* {@link org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent}
* message is sent upstream
long getSwitchIdleTimeout();
/**
+ * Returns the SSL context.
+ *
* @return seed for {@link javax.net.ssl.SSLEngine}
*/
Object getSslContext();
/**
+ * Returns the thread configuration.
+ *
* @return thread numbers for TcpHandler's eventloopGroups
*/
ThreadConfiguration getThreadConfiguration();
/**
+ * Determines if a barrier shoild be used.
+ *
* @return boolean value for usability of Barrier
*/
boolean useBarrier();
package org.opendaylight.openflowjava.protocol.api.connection;
/**
- * @author mirehak
+ * Listener that is notified when a switch connection is ready.
*
+ * @author mirehak
*/
public interface ConnectionReadyListener {
/**
- * fired when connection becomes ready-to-use
+ * Fired when connection becomes ready-to-use.
*/
void onConnectionReady();
}
import java.util.concurrent.Future;
/**
- * for testing purposed
+ * For testing purposes.
+ *
* @author mirehak
*/
public interface ListeningStatusProvider {
/**
+ * Determines if the plugin has successfully started.
+ *
* @return future holding startup result of all library instances under plugin's control
*/
Future<Boolean> isOnline();
* with a response, the object reported will be non-null. If the request's completion
* is implied by a barrier, the object reported will be null.
*
+ * <p>
* If this request fails on the remote device, {@link FutureCallback#onFailure(Throwable)}
* will be called with an instance of {@link DeviceRequestFailedException}.
*
+ * <p>
* If the request fails due to local reasons, {@link FutureCallback#onFailure(Throwable)}
* will be called with an instance of {@link OutboundQueueException}. In particular, if
* this request failed because the device disconnected, {@link OutboundQueueException#DEVICE_DISCONNECTED}
* with a response, the object reported will be non-null. If the request's completion
* is implied by a barrier, the object reported will be null.
*
+ * <p>
* If this request fails on the remote device, {@link FutureCallback#onFailure(Throwable)}
* will be called with an instance of {@link DeviceRequestFailedException}.
*
+ * <p>
* If the request fails due to local reasons, {@link FutureCallback#onFailure(Throwable)}
* will be called with an instance of {@link OutboundQueueException}. In particular, if
* this request failed because the device disconnected, {@link OutboundQueueException#DEVICE_DISCONNECTED}
package org.opendaylight.openflowjava.protocol.api.connection;
/**
- * Used for StatisticsCounter configuration
+ * Used for StatisticsCounter configuration.
*
* @author madamjak
*/
public interface StatisticsConfiguration {
/**
+ * Determines if statistics are enabled.
+ *
* @return true if statistics are / will be collected, false otherwise
*/
boolean getStatisticsCollect();
/**
+ * Returns the delay between two statistics logs.
+ *
* @return delay between two statistics logs (in milliseconds)
*/
int getLogReportDelay();
-}
\ No newline at end of file
+}
import java.net.InetAddress;
/**
+ * Handler for a swictch connection.
+ *
* @author mirehak
* @author michal.polkorab
*
public interface SwitchConnectionHandler {
/**
+ * Invoked when a switch connects.
+ *
* @param connection to switch proving message sending/receiving, connection management
*/
void onSwitchConnected(ConnectionAdapter connection);
/**
+ * Invoked to determine if a switch connection should be accepted.
+ *
* @param switchAddress address of incoming connection (address + port)
* @return true, if connection from switch having given address shell be accepted; false otherwise
*/
package org.opendaylight.openflowjava.protocol.api.connection;
/**
- * @author michal.polkorab
+ * Threading configuration.
*
+ * @author michal.polkorab
*/
public interface ThreadConfiguration {
/**
- * @return desired number of workerThreads processing the Openflow I/O
+ * Returns the desired number of Openflow I/O worker threads.
+ *
+ * @return desired number of worker threads processing the Openflow I/O
*/
int getWorkerThreadCount();
/**
- * @return desired number of bossThreads registering incomming Openflow connections
+ * Returns the desired number of incoming Openflow connection threads.
+ *
+ * @return desired number of bossThreads registering incoming Openflow connections
*/
int getBossThreadCount();
}
package org.opendaylight.openflowjava.protocol.api.connection;
import java.util.List;
-
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
/**
- * @author michal.polkorab
+ * Tls configuration.
*
+ * @author michal.polkorab
*/
public interface TlsConfiguration {
/**
- * @return keystore location
+ * Returns the key store location.
+ *
+ * @return key store location
*/
String getTlsKeystore();
/**
- * @return keystore type
+ * Returns the key store type.
+ *
+ * @return key store type
*/
KeystoreType getTlsKeystoreType();
/**
- * @return truststore location
+ * Returns the trust store location.
+ *
+ * @return trust store location
*/
String getTlsTruststore();
/**
- * @return truststore type
+ * Returns the trust store type.
+ *
+ * @return trust store type
*/
KeystoreType getTlsTruststoreType();
/**
- * @return keystore path type (CLASSPATH or PATH)
+ * Returns the key store path type.
+ *
+ * @return key store path type (CLASSPATH or PATH)
*/
PathType getTlsKeystorePathType();
/**
- * @return truststore path type (CLASSPATH or PATH)
+ * Returns the trust store path type.
+ *
+ * @return trust store path type (CLASSPATH or PATH)
*/
PathType getTlsTruststorePathType();
/**
- * @return password protecting specified keystore
+ * Returns the password protecting the key store.
+ *
+ * @return password protecting the specified key store
*/
String getKeystorePassword();
/**
+ * Returns the password protecting the certificate.
+ *
* @return password protecting certificate
*/
String getCertificatePassword();
/**
- * @return password protecting specified truststore
+ * Returns the password protecting the trust store.
+ *
+ * @return password protecting specified trust store
*/
String getTruststorePassword();
/**
+ * Returns the list of cipher suites for TLS connection.
+ *
* @return list of cipher suites for TLS connection
*/
List<String> getCipherSuites();
package org.opendaylight.openflowjava.protocol.api.connection;
import java.util.List;
-
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
/**
- * Class is used only for testing purposes - passwords are hardcoded
+ * Class is used only for testing purposes - passwords are hard-coded.
+ *
* @author michal.polkorab
*/
public class TlsConfigurationImpl implements TlsConfiguration {
- private KeystoreType trustStoreType;
- private String trustStore;
- private KeystoreType keyStoreType;
- private String keyStore;
- private PathType keystorePathType;
- private PathType truststorePathType;
- private List<String> cipherSuites;
+ private final KeystoreType trustStoreType;
+ private final String trustStore;
+ private final KeystoreType keyStoreType;
+ private final String keyStore;
+ private final PathType keystorePathType;
+ private final PathType truststorePathType;
+ private final List<String> cipherSuites;
/**
- * Default constructor
+ * Default constructor.
+ *
* @param trustStoreType JKS or PKCS12
* @param trustStore path to trustStore file
* @param trustStorePathType truststore path type (classpath or path)
public interface AlienMessageListener {
/**
- * Handler for alien but successfully deserialized messages for device
+ * Handler for alien but successfully deserialized messages for device.
+ *
* @param message alien message
* @return true if alien message was successfully processed
*/
boolean onAlienMessage(OfHeader message);
-}
\ No newline at end of file
+}
* vendor / experimenter subtype, vendor has to switch / choose between
* these subtypes.<br>
*
+ * <p>
* This has to be done in this way because of experimenter headers, which
* provide only vendor / experimenter ID. Subtype position may be different
* for different vendors (or not present at all) - that's why vendor has to
* Registers deserializer.
* Throws IllegalStateException when there is
* a deserializer already registered under given key.
+ *
* <p>
* If the deserializer implements {@link DeserializerRegistryInjector} interface,
* the deserializer is injected with DeserializerRegistry instance.
OFGeneralDeserializer deserializer);
/**
- * Unregisters custom deserializer
+ * Unregisters custom deserializer.
+ *
* @param key used for deserializer lookup
* @return true if deserializer was removed,
- * false if no deserializer was found under specified key
+ * false if no deserializer was found under specified key
*/
boolean unregisterDeserializer(ExperimenterDeserializerKey key);
/**
- * Registers action deserializer
+ * Registers action deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFGeneralDeserializer deserializer);
/**
- * Registers instruction deserializer
+ * Registers instruction deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFGeneralDeserializer deserializer);
/**
- * Registers match entry deserializer
+ * Registers match entry deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFGeneralDeserializer deserializer);
/**
- * Registers error message deserializer
+ * Registers error message deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFDeserializer<ErrorMessage> deserializer);
/**
- * Registers experimenter (vendor) message deserializer
+ * Registers experimenter (vendor) message deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFDeserializer<? extends ExperimenterDataOfChoice> deserializer);
/**
- * Registers multipart-reply (stats) message deserializer
+ * Registers multipart-reply (stats) message deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFDeserializer<? extends ExperimenterDataOfChoice> deserializer);
/**
- * Registers multipart-reply table-features message deserializer
+ * Registers multipart-reply table-features message deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFGeneralDeserializer deserializer);
/**
- * Registers meter band deserializer (used in multipart-reply meter-config)
+ * Registers meter band deserializer (used in multipart-reply meter-config).
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFDeserializer<MeterBandExperimenterCase> deserializer);
/**
- * Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer
+ * Registers queue property (QUEUE_GET_CONFIG_REPLY message) deserializer.
+ *
* @param key used for deserializer lookup
* @param deserializer deserializer instance
*/
OFDeserializer<QueueProperty> deserializer);
/**
- * Registers type to class mapping used to assign return type when deserializing message
+ * Registers type to class mapping used to assign return type when deserializing message.
+ *
* @param key type to class key
* @param clazz return class
*/
void registerDeserializerMapping(TypeToClassKey key, Class<?> clazz);
/**
- * Unregisters type to class mapping used to assign return type when deserializing message
+ * Unregisters type to class mapping used to assign return type when deserializing message.
+ *
* @param key type to class key
* @return true if mapping was successfully removed
*/
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
-
/**
- * @author michal.polkorab
+ * Registry for deserializers.
*
+ * @author michal.polkorab
*/
public interface DeserializerRegistry {
/**
- * Initializes deserializers
+ * Initializes deserializers.
*/
void init();
/**
+ * Gets the deserializer for the given key.
+ *
* @param <T> type of particular deserializer
* @param key used for deserializer lookup
* @return deserializer found
T getDeserializer(MessageCodeKey key);
/**
- * Registers deserializer.
+ * Registers a deserializer.
* Throws IllegalStateException when there is
* a deserializer already registered under given key.
*
+ * <p>
* If the deserializer implements {@link DeserializerRegistryInjector} interface,
* the deserializer is injected with DeserializerRegistry instance.
*
OFGeneralDeserializer deserializer);
/**
- * Unregisters deserializer
+ * Unregisters a deserializer.
+ *
* @param key used for deserializer lookup
* @return true if deserializer was removed,
- * false if no deserializer was found under specified key
+ * false if no deserializer was found under specified key
*/
boolean unregisterDeserializer(MessageCodeKey key);
}
package org.opendaylight.openflowjava.protocol.api.extensibility;
/**
- * Injects registry
+ * Injects registries.
+ *
* @author michal.polkorab
*/
public interface DeserializerRegistryInjector {
/**
- * Injects deserializer registry into deserializer
+ * Injects deserializer registry into deserializer.
+ *
* @param deserializerRegistry registry of deserializers
*/
void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry);
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
/**
- * @author michal.polkorab
+ * Enhanced MessageCodeKey.
*
+ * @author michal.polkorab
*/
public class EnhancedMessageCodeKey extends MessageCodeKey {
- private int msgType2;
+ private final int msgType2;
/**
- * Constructor
+ * Constructor.
+ *
* @param version wire protocol version
* @param value used as distinguisher
* @param value2 used as detailed distinguisher
public String toString() {
return super.toString() + " msgType2: " + msgType2;
}
-}
\ No newline at end of file
+}
/**
- * More specific key for {@link SerializerRegistry}
+ * More specific key for {@link SerializerRegistry}.
+ *
* @author michal.polkorab
* @param <E> main type
* @param <F> specific type
private final Class<F> msgType2;
/**
+ * Constructor.
+ *
* @param msgVersion protocol version
* @param msgType main type
* @param msgType2 subtype
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((msgType2 == null) ? 0 : msgType2.hashCode());
+ result = prime * result + (msgType2 == null ? 0 : msgType2.hashCode());
return result;
}
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
+ * Deserializes headers.
+ *
* @author michal.polkorab
* @param <E> output message type
*/
public interface HeaderDeserializer<E extends DataContainer> extends OFGeneralDeserializer {
/**
- * Deserializes byte message headers
+ * Deserializes a byte message headers.
*
* @param rawMessage message as bytes in ByteBuf
* @return POJO/DTO
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * Does only-header serialization (such as oxm_ids, action_ids, instruction_ids)
+ * Does only-header serialization (such as oxm_ids, action_ids, instruction_ids).
+ *
* @author michal.polkorab
* @param <T> input message type
*/
public interface HeaderSerializer<T extends DataContainer> extends OFGeneralSerializer {
/**
- * Serializes object headers (e.g. for Multipart message - Table Features)
+ * Serializes object headers (e.g. for Multipart message - Table Features).
+ *
* @param input object whose headers should be serialized
* @param outBuffer output buffer
*/
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * Uniform interface for deserializing factories
+ * Uniform interface for deserializing factories.
+ *
* @author michal.polkorab
* @author timotej.kubas
* @param <E> message code type
*/
package org.opendaylight.openflowjava.protocol.api.extensibility;
-
/**
+ * Unifying super interface for a general deserializer.
+ *
* @author michal.polkorab
*/
public interface OFGeneralDeserializer {
package org.opendaylight.openflowjava.protocol.api.extensibility;
/**
- * Unifying superinterface
+ * Unifying super interface for a general derializer.
+ *
* @author michal.polkorab
* */
public interface OFGeneralSerializer {
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * Uniform interface for serializers
+ * Uniform interface for serializers.
+ *
* @author michal.polkorab
* @author timotej.kubas
* @param <T> message type
* vendor / experimenter subtype, vendor has to switch / choose between
* these subtypes.<br>
*
+ * <p>
* This has to be done in this way because of unknown augmentations
* - that's why vendor has to handle it in his own implementations.
* @author michal.polkorab
public interface SerializerExtensionProvider {
/**
- * Registers serializer
+ * Registers a custom serializer.
+ *
* Throws IllegalStateException when there is
* a serializer already registered under given key.
*
OFGeneralSerializer serializer);
/**
- * Unregisters custom serializer
+ * Unregisters a custom serializer.
+ *
* @param key used for serializer lookup
- * @return true if serializer was removed,
- * false if no serializer was found under specified key
+ * @return true if serializer was removed, false if no serializer was found under specified key
*/
boolean unregisterSerializer(ExperimenterSerializerKey key);
/**
- * Registers action serializer
+ * Registers an action serializer.
+ *
* @param key used for serializer lookup
* @param serializer serializer implementation
*/
OFGeneralSerializer serializer);
/**
- * Registers instruction serializer
+ * Registers an instruction serializer.
+ *
* @param key used for serializer lookup
* @param serializer serializer implementation
*/
OFGeneralSerializer serializer);
/**
- * Registers match entry serializer
+ * Registers a match entry serializer.
+ *
* @param <C> oxm type
* @param <F> match field type
* @param key used for serializer lookup
MatchEntrySerializerKey<C, F> key,OFGeneralSerializer serializer);
/**
- * Registers experimenter (vendor) message serializer
+ * Registers an experimenter (vendor) message serializer.
+ *
* @param key used for serializer lookup
* @param serializer serializer implementation
*/
OFSerializer<? extends ExperimenterDataOfChoice> serializer);
/**
- * Registers multipart-request (stats-request) serializer
+ * Registers a multipart-request (stats-request) serializer.
+ *
* @param key used for serializer lookup
* @param serializer serializer implementation
*/
OFSerializer<? extends ExperimenterDataOfChoice> serializer);
/**
- * Registers multipart-request table-features serializer
+ * Registers a multipart-request table-features serializer.
+ *
* @param key used for serializer lookup
* @param serializer serializer implementation
*/
OFGeneralSerializer serializer);
/**
- * @deprecated Since we use ExperimenterIdMeterSubTypeSerializerKey as MeterBandSerializer's key, in order to avoid
- * the occurrence of an error,we should discard this function
- * Registers meter band serializer (used in meter-mod messages)
+ * Registers a meter band serializer (used in meter-mod messages).
+ *
* @param key used for serializer lookup
* @param serializer serializer implementation
+ * @deprecated Since we use ExperimenterIdMeterSubTypeSerializerKey as MeterBandSerializer's key, in order to avoid
+ * the occurrence of an error,we should discard this function
*/
@Deprecated
void registerMeterBandSerializer(ExperimenterIdSerializerKey<MeterBandExperimenterCase> key,
OFSerializer<MeterBandExperimenterCase> serializer);
/**
- * Registers meter band serializer (used in meter-mod messages)
+ * Registers a meter band serializer (used in meter-mod messages).
+ *
* @param key used for serializer lookup
* @param serializer serializer implementation
*/
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
/**
- * Stores and handles serializers<br>
+ * Stores and handles serializers. <br>
* K - {@link MessageTypeKey} parameter type,<br>
* S - returned serializer type
* @author michal.polkorab
public interface SerializerRegistry {
/**
- * Serializer registry provisioning
+ * Serializer registry provisioning.
*/
void init();
/**
+ * Gets the serializer for the given type.
+ *
* @param <K> input key type
* @param <S> type of resulting serializer
* @param msgTypeKey lookup key
<K, S extends OFGeneralSerializer> S getSerializer(MessageTypeKey<K> msgTypeKey);
/**
- * Registers serializer
+ * Registers a serializer.
+ *
* Throws IllegalStateException when there is
* a serializer already registered under given key.
*
OFGeneralSerializer serializer);
/**
- * Unregisters serializer
+ * Unregisters a serializer.
+ *
* @param <K> serializer key type
* @param key used for serializer lookup
* @return true if serializer was removed,
package org.opendaylight.openflowjava.protocol.api.extensibility;
/**
- * Serializer registry injector
+ * Serializer registry injector.
+ *
* @author michal.polkorab
*/
public interface SerializerRegistryInjector {
/**
- * Injects serializer registry
+ * Injects serializer registry.
+ *
* @param serializerRegistry registry instance
*/
void injectSerializerRegistry(SerializerRegistry serializerRegistry);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
/**
- * @author michal.polkorab
+ * Key for an action deserializer.
*
+ * @author michal.polkorab
*/
public class ActionDeserializerKey extends MessageCodeKey {
- private Long experimenterId;
+ private final Long experimenterId;
+
/**
+ * Constructor.
+ *
* @param version protocol wire version
* @param type action type
* @param experimenterId experimenter / vendor ID
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
return result;
}
public String toString() {
return super.toString() + " experimenterID: " + experimenterId;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
/**
+ * Key for an action serializer.
+ *
* @author michal.polkorab
* @param <T> action type
*/
public class ActionSerializerKey<T extends ActionChoice> extends MessageTypeKey<Action>
implements ExperimenterSerializerKey {
- private Class<T> actionType;
- private Long experimenterId;
+ private final Class<T> actionType;
+ private final Long experimenterId;
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param actionType type of action
* @param experimenterId experimenter / vendor ID
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((actionType == null) ? 0 : actionType.hashCode());
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + (actionType == null ? 0 : actionType.hashCode());
+ result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
return result;
}
public String toString() {
return super.toString() + " action type: " + actionType.getName() + " experimenterID: " + experimenterId;
}
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Key for an experimenter action deserializer.
*
+ * @author michal.polkorab
*/
public final class ExperimenterActionDeserializerKey extends ActionDeserializerKey
implements ExperimenterDeserializerKey {
/**
+ * Constructor.
+ *
* @param version protocol wire version
* @param experimenterId experimenter / vendor ID
*/
public ExperimenterActionDeserializerKey(short version, Long experimenterId) {
super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);
}
-
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.ExperimenterActionSubType;
/**
+ * Key for an experimenter action serializer.
+ *
* @author michal.polkorab
*/
public final class ExperimenterActionSerializerKey extends ActionSerializerKey<ExperimenterIdCase>
implements ExperimenterSerializerKey {
- private Class<? extends ExperimenterActionSubType> actionSubType;
+ private final Class<? extends ExperimenterActionSubType> actionSubType;
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param experimenterId experimenter / vendor ID
* @param actionSubType vendor defined subtype
*/
- public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId, Class<? extends ExperimenterActionSubType> actionSubType) {
+ public ExperimenterActionSerializerKey(short msgVersion, Long experimenterId,
+ Class<? extends ExperimenterActionSubType> actionSubType) {
super(msgVersion, ExperimenterIdCase.class, experimenterId);
this.actionSubType = actionSubType;
}
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((actionSubType == null) ? 0 : actionSubType.hashCode());
+ result = prime * result + (actionSubType == null ? 0 : actionSubType.hashCode());
return result;
}
}
return true;
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.api.keys;
/**
- * Marker interface - marks keys appropriate for experimenter deserializer registration
+ * Marker interface - marks keys appropriate for experimenter deserializer registration.
+ *
* @author michal.polkorab
*/
public interface ExperimenterDeserializerKey {
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
+ * Key for an experimenter id deserializer.
+ *
* @author michal.polkorab
*/
public class ExperimenterIdDeserializerKey extends MessageCodeKey implements ExperimenterDeserializerKey {
- private long experimenterId;
+ private final long experimenterId;
/**
+ * Constructor.
+ *
* @param <E> type of target experimenter object
* @param version protocol wire version
* @param experimenterId experimenter / vendor ID
}
protected int hashCodeOfLong(long longValue) {
- return (int) (longValue ^ (longValue >>> 32));
+ return (int) (longValue ^ longValue >>> 32);
}
@Override
public String toString() {
return super.toString() + " experimenterID: " + experimenterId;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
- * Created by hyy on 2016/9/8.
+ * Key for an experimenter id meter subtype serializer.
+ *
+ * @author hyy on 2016/9/8.
*/
public class ExperimenterIdMeterSubTypeSerializerKey<T extends DataContainer> extends ExperimenterIdSerializerKey<T> {
- private Class<? extends ExperimenterMeterBandSubType> meterSubType;
+ private final Class<? extends ExperimenterMeterBandSubType> meterSubType;
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param experimenterId experimenter / vendor ID
* @param objectClass class of object to be serialized
* @param meterSubType vendor defined subtype
*/
public ExperimenterIdMeterSubTypeSerializerKey(short msgVersion, long experimenterId,
- Class<T> objectClass, Class<? extends ExperimenterMeterBandSubType> meterSubType) {
+ Class<T> objectClass, Class<? extends ExperimenterMeterBandSubType> meterSubType) {
super(msgVersion, experimenterId, objectClass);
this.meterSubType = meterSubType;
}
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((meterSubType == null) ? 0 : meterSubType.hashCode());
+ result = prime * result + (meterSubType == null ? 0 : meterSubType.hashCode());
return result;
}
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
+ * Key for an experimenter id serializer.
+ *
* @author michal.polkorab
* @param <T> class of object to be serialized
*/
public class ExperimenterIdSerializerKey<T extends DataContainer> extends MessageTypeKey<T>
implements ExperimenterSerializerKey {
- private long experimenterId;
+ private final long experimenterId;
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param experimenterId experimenter / vendor ID
* @param objectClass class of object to be serialized
}
protected int hashCodeOfLong(long longValue) {
- return (int) (longValue ^ (longValue >>> 32));
+ return (int) (longValue ^ longValue >>> 32);
}
@Override
public String toString() {
return super.toString() + " experimenterID: " + experimenterId;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
+ * Key for an experimenter id type deserializer.
+ *
* @author michal.polkorab
*/
public class ExperimenterIdTypeDeserializerKey extends ExperimenterIdDeserializerKey {
- private long type;
+ private final long type;
/**
+ * Constructor.
+ *
* @param <T> type of target experimenter object
* @param version protocol wire version
* @param experimenterId experimenter / vendor ID
public String toString() {
return super.toString() + "; type: " + type;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
+ * Key for an experimenter id type serializer.
+ *
* @param <T> class of object to be serialized
* @author michal.polkorab
*/
public class ExperimenterIdTypeSerializerKey<T extends DataContainer> extends ExperimenterIdSerializerKey<T> {
- private long type;
+ private final long type;
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param experimenterId experimenter / vendor ID
* @param type data type according to vendor implementation
public String toString() {
return super.toString() + "; type: " + type;
}
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Key for an experimenter instruction deserializer.
*
+ * @author michal.polkorab
*/
public final class ExperimenterInstructionDeserializerKey extends InstructionDeserializerKey
implements ExperimenterDeserializerKey {
/**
+ * Constructor.
+ *
* @param version protocol wire version
* @param experimenterId experimenter (vendor) identifier
*/
super(version, EncodeConstants.EXPERIMENTER_VALUE, experimenterId);
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.instruction.container.instruction.choice.ExperimenterIdCase;
/**
+ * Key for an experimenter instruction serializer.
+ *
* @author michal.polkorab
*/
public final class ExperimenterInstructionSerializerKey extends InstructionSerializerKey<ExperimenterIdCase>
implements ExperimenterSerializerKey {
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param experimenterId experimenter / vendor ID
*/
super(msgVersion, ExperimenterIdCase.class, experimenterId);
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.api.keys;
/**
- * Marker interface - marks keys appropriate for experimenter serializer registration
+ * Marker interface - marks keys appropriate for experimenter serializer registration.
+ *
* @author michal.polkorab
*/
public interface ExperimenterSerializerKey {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
/**
- * @author michal.polkorab
+ * Key for an instruction deserializer.
*
+ * @author michal.polkorab
*/
public class InstructionDeserializerKey extends MessageCodeKey {
- private Long experimenterId;
+ private final Long experimenterId;
+
/**
+ * Constructor.
+ *
* @param version protocol wire version
* @param type instruction type
* @param experimenterId experimenter (vendor) identifier
*/
- public InstructionDeserializerKey(short version, int type,
- Long experimenterId) {
+ public InstructionDeserializerKey(short version, int type, Long experimenterId) {
super(version, type, Instruction.class);
this.experimenterId = experimenterId;
}
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
return result;
}
public String toString() {
return super.toString() + " experimenterID: " + experimenterId;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
/**
+ * Key for an instruction serializer.
+ *
* @author michal.polkorab
* @param <T> instruction type
*/
public class InstructionSerializerKey<T extends InstructionChoice>
extends MessageTypeKey<Instruction> implements ExperimenterSerializerKey {
- private Class<T> instructionType;
- private Long experimenterId;
+ private final Class<T> instructionType;
+ private final Long experimenterId;
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param instructionType type of instruction
* @param experimenterId experimenter / vendor ID
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
- result = prime * result + ((instructionType == null) ? 0 : instructionType.hashCode());
+ result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
+ result = prime * result + (instructionType == null ? 0 : instructionType.hashCode());
return result;
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
/**
- * @author michal.polkorab
+ * Key for a match entry deserializer.
*
+ * @author michal.polkorab
*/
public final class MatchEntryDeserializerKey extends MessageCodeKey
implements ExperimenterDeserializerKey {
- private int oxmField;
+ private final int oxmField;
private Long experimenterId;
/**
+ * Constructor.
+ *
* @param version protocol wire version
* @param oxmClass oxm_class (see specification)
* @param oxmField oxm_field (see specification)
}
/**
+ * Sets the experimenter id.
+ *
* @param experimenterId experimenter / vendor ID
*/
public void setExperimenterId(Long experimenterId) {
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
+ result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
result = prime * result + oxmField;
return result;
}
public String toString() {
return super.toString() + " oxm_field: " + oxmField + " experimenterID: " + experimenterId;
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
/**
+ * Key for a match entry serializer.
+ *
* @author michal.polkorab
* @param <C> oxm_class (see specification)
* @param <F> oxm_field (see specification)
public final class MatchEntrySerializerKey<C extends OxmClassBase, F extends MatchField>
extends MessageTypeKey<MatchEntry> implements ExperimenterSerializerKey {
- private Class<C> oxmClass;
- private Class<F> oxmField;
+ private final Class<C> oxmClass;
+ private final Class<F> oxmField;
private Long experimenterId;
/**
+ * Constructor.
+ *
* @param msgVersion protocol wire version
* @param oxmClass oxm_class (see specification)
* @param oxmField oxm_field (see specification)
}
/**
+ * Sets the experimenter id.
+ *
* @param experimenterId experimenter / vendor ID
*/
public void setExperimenterId(Long experimenterId) {
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
- result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
- result = prime * result + ((oxmClass == null) ? 0 : oxmClass.hashCode());
- result = prime * result + ((oxmField == null) ? 0 : oxmField.hashCode());
+ result = prime * result + (experimenterId == null ? 0 : experimenterId.hashCode());
+ result = prime * result + (oxmClass == null ? 0 : oxmClass.hashCode());
+ result = prime * result + (oxmField == null ? 0 : oxmField.hashCode());
return result;
}
package org.opendaylight.openflowjava.protocol.api.keys;
/**
+ * Key for a message code.
+ *
* @author michal.polkorab
*/
public class MessageCodeKey {
- private short msgVersion;
- private int msgType;
- private Class<?> clazz;
+ private final short msgVersion;
+ private final int msgType;
+ private final Class<?> clazz;
/**
- * Constructor
+ * Constructor.
+ *
* @param version wire protocol version
* @param value used as distinguisher (read from binary data / buffer)
* @param clazz class of object that is going to be deserialized
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());
+ result = prime * result + (clazz == null ? 0 : clazz.hashCode());
result = prime * result + msgType;
result = prime * result + msgVersion;
return result;
public String toString() {
return "msgVersion: " + msgVersion + " objectClass: " + clazz.getName() + " msgType: " + msgType;
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.api.keys;
/**
- * Class used as a key in {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry}
+ * Class used as a key in {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry}.
+ *
* @author michal.polkorab
* @author timotej.kubas
* @param <E> message type (class)
private final short msgVersion;
/**
+ * Constructor.
+ *
* @param msgVersion protocol version
* @param msgType type of message - class of serialized object
*/
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((msgType == null) ? 0 : msgType.hashCode());
+ result = prime * result + (msgType == null ? 0 : msgType.hashCode());
result = prime * result + msgVersion;
return result;
}
package org.opendaylight.openflowjava.protocol.api.keys;
/**
- * @author michal.polkorab
+ * Key for a class type.
*
+ * @author michal.polkorab
*/
public class TypeToClassKey {
- private short version;
- private int type;
+ private final short version;
+ private final int type;
/**
- * Constructor
+ * Constructor.
+ *
* @param version wire protocol version
* @param type message type / code
*/
}
return true;
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowjava.protocol.api.util;
/**
- * @author michal.polkorab
+ * Conversion utilities.
*
+ * @author michal.polkorab
*/
public abstract class BinContent {
}
/**
+ * Converts an int to unsigned long.
+ *
* @param value input integer value (might be negative)
* @return int part wrapped in long (always positive)
*/
}
/**
+ * Converts an unsigned long to int.
+ *
* @param value input long value
* @return long cut into int
*/
/**
* Stores common constants.
+ *
* @author michal.polkorab
*/
-public abstract class EncodeConstants {
-
- /** Default OF padding (in bytes) */
- public static final byte PADDING = 8;
- /** OpenFlow v1.0 wire protocol number */
- public static final byte OF10_VERSION_ID = 0x01;
- /** OpenFlow v1.3 wire protocol number */
- public static final byte OF13_VERSION_ID = 0x04;
- /** OpenFlow v1.4 wire protocol number */
- public static final byte OF14_VERSION_ID = 0x05;
- /** OpenFlow v1.5 wire protocol number */
- public static final byte OF15_VERSION_ID = 0x06;
- /** OpenFlow Hello message type value */
- public static final byte OF_HELLO_MESSAGE_TYPE_VALUE = 0;
- /** OpenFlow PacketIn message type value */
- public static final byte OF_PACKETIN_MESSAGE_TYPE_VALUE = 10;
- /** Index of length in Openflow header */
- public static final int OFHEADER_LENGTH_INDEX = 2;
- /** Size of Openflow header */
- public static final int OFHEADER_SIZE = 8;
- /** Zero length - used when the length is updated later */
- public static final int EMPTY_LENGTH = 0;
-
- /** Length of mac address */
- public static final byte MAC_ADDRESS_LENGTH = 6;
- /** Number of groups in ipv4 address */
- public static final byte GROUPS_IN_IPV4_ADDRESS = 4;
- /** Number of groups in ipv6 address */
- public static final byte GROUPS_IN_IPV6_ADDRESS = 8;
- /** Length of ipv6 address in bytes */
- public static final byte SIZE_OF_IPV6_ADDRESS_IN_BYTES = (8 * Short.SIZE) / Byte.SIZE;
-
- /** Length of long in bytes */
- public static final byte SIZE_OF_LONG_IN_BYTES = Long.SIZE / Byte.SIZE;
- /** Length of int in bytes */
- public static final byte SIZE_OF_INT_IN_BYTES = Integer.SIZE / Byte.SIZE;
- /** Length of short in bytes */
- public static final byte SIZE_OF_SHORT_IN_BYTES = Short.SIZE / Byte.SIZE;
- /** Length of byte in bytes */
- public static final byte SIZE_OF_BYTE_IN_BYTES = Byte.SIZE / Byte.SIZE;
- /** Length of 3 bytes */
- public static final byte SIZE_OF_3_BYTES = 3;
-
- /** Empty (zero) int value */
- public static final int EMPTY_VALUE = 0;
- /** Common experimenter value */
- public static final int EXPERIMENTER_VALUE = 0xFFFF;
-
- /** OF v1.0 maximal port name length */
- public static final byte MAX_PORT_NAME_LENGTH = 16;
-
- /** ONF Approved Extensions Constants */
- /** Experimenter ID of ONF approved extensions */
- public static final long ONF_EXPERIMENTER_ID = 0x4F4E4600;
- /** ONFOXM_ET_TCP_FLAGS value */
- public static final int ONFOXM_ET_TCP_FLAGS = 42;
-
- private EncodeConstants() {
- //not called
- }
+public interface EncodeConstants {
+
+ /** Default OF padding (in bytes). */
+ byte PADDING = 8;
+
+ /** OpenFlow v1.0 wire protocol number. */
+ byte OF10_VERSION_ID = 0x01;
+
+ /** OpenFlow v1.3 wire protocol number. */
+ byte OF13_VERSION_ID = 0x04;
+
+ /** OpenFlow v1.4 wire protocol number. */
+ byte OF14_VERSION_ID = 0x05;
+
+ /** OpenFlow v1.5 wire protocol number. */
+ byte OF15_VERSION_ID = 0x06;
+
+ /** OpenFlow Hello message type value. */
+ byte OF_HELLO_MESSAGE_TYPE_VALUE = 0;
+
+ /** OpenFlow PacketIn message type value. */
+ byte OF_PACKETIN_MESSAGE_TYPE_VALUE = 10;
+
+ /** Index of length in Openflow header. */
+ int OFHEADER_LENGTH_INDEX = 2;
+
+ /** Size of Openflow header. */
+ int OFHEADER_SIZE = 8;
+
+ /** Zero length - used when the length is updated later. */
+ int EMPTY_LENGTH = 0;
+
+ /** Length of mac address. */
+ byte MAC_ADDRESS_LENGTH = 6;
+
+ /** Number of groups in ipv4 address. */
+ byte GROUPS_IN_IPV4_ADDRESS = 4;
+
+ /** Number of groups in ipv6 address. */
+ byte GROUPS_IN_IPV6_ADDRESS = 8;
+
+ /** Length of ipv6 address in bytes. */
+ byte SIZE_OF_IPV6_ADDRESS_IN_BYTES = 8 * Short.SIZE / Byte.SIZE;
+
+ /** Length of long in bytes. */
+ byte SIZE_OF_LONG_IN_BYTES = Long.SIZE / Byte.SIZE;
+
+ /** Length of int in bytes. */
+ byte SIZE_OF_INT_IN_BYTES = Integer.SIZE / Byte.SIZE;
+
+ /** Length of short in bytes. */
+ byte SIZE_OF_SHORT_IN_BYTES = Short.SIZE / Byte.SIZE;
+
+ /** Length of byte in bytes. */
+ byte SIZE_OF_BYTE_IN_BYTES = Byte.SIZE / Byte.SIZE;
+
+ /** Length of 3 bytes. */
+ byte SIZE_OF_3_BYTES = 3;
+
+ /** Empty (zero) int value. */
+ int EMPTY_VALUE = 0;
+
+ /** Common experimenter value. */
+ int EXPERIMENTER_VALUE = 0xFFFF;
+
+ /** OF v1.0 maximal port name length. */
+ byte MAX_PORT_NAME_LENGTH = 16;
+
+ // ONF Approved Extensions Constants.
+
+ /** Experimenter ID of ONF approved extensions. */
+ long ONF_EXPERIMENTER_ID = 0x4F4E4600;
+
+ /** ONFOXM_ET_TCP_FLAGS value. */
+ int ONFOXM_ET_TCP_FLAGS = 42;
}
/**
* Stores oxm_match constants.
+ *
* @author michal.polkorab
*/
-public abstract class OxmMatchConstants {
-
- /** Backward compatibility with NXM */
- public static final int NXM_0_CLASS = 0x0000;
- /** Backward compatibility with NXM */
- public static final int NXM_1_CLASS = 0x0001;
- /** Basic class for OpenFlow */
- public static final int OPENFLOW_BASIC_CLASS = 0x8000;
- /** Experimenter class */
- public static final int EXPERIMENTER_CLASS = 0xFFFF;
-
- /** Switch input port */
- public static final int IN_PORT = 0;
- /** Switch physical input port */
- public static final int IN_PHY_PORT = 1;
- /** Metadata passed between tables */
- public static final int METADATA = 2;
- /** Ethernet destination address */
- public static final int ETH_DST = 3;
- /** Ethernet source address */
- public static final int ETH_SRC = 4;
- /** Ethernet frame type */
- public static final int ETH_TYPE = 5;
+public interface OxmMatchConstants {
+
+ /** Backward compatibility with NXM. */
+ int NXM_0_CLASS = 0x0000;
+
+ /** Backward compatibility with NXM. */
+ int NXM_1_CLASS = 0x0001;
+
+ /** Basic class for OpenFlow. */
+ int OPENFLOW_BASIC_CLASS = 0x8000;
+
+ /** Experimenter class. */
+ int EXPERIMENTER_CLASS = 0xFFFF;
+
+ /** Switch input port. */
+ int IN_PORT = 0;
+
+ /** Switch physical input port. */
+ int IN_PHY_PORT = 1;
+
+ /** Metadata passed between tables. */
+ int METADATA = 2;
+
+ /** Ethernet destination address. */
+ int ETH_DST = 3;
+
+ /** Ethernet source address. */
+ int ETH_SRC = 4;
+
+ /** Ethernet frame type. */
+ int ETH_TYPE = 5;
+
/** VLAN id. */
- public static final int VLAN_VID = 6;
+ int VLAN_VID = 6;
+
/** VLAN priority. */
- public static final int VLAN_PCP = 7;
+ int VLAN_PCP = 7;
+
/** IP DSCP (6 bits in ToS field). */
- public static final int IP_DSCP = 8;
+ int IP_DSCP = 8;
+
/** IP ECN (2 bits in ToS field). */
- public static final int IP_ECN = 9;
+ int IP_ECN = 9;
+
/** IP protocol. */
- public static final int IP_PROTO = 10;
+ int IP_PROTO = 10;
+
/** IPv4 source address. */
- public static final int IPV4_SRC = 11;
+ int IPV4_SRC = 11;
+
/** IPv4 destination address. */
- public static final int IPV4_DST = 12;
+ int IPV4_DST = 12;
+
/** TCP source port. */
- public static final int TCP_SRC = 13;
+ int TCP_SRC = 13;
+
/** TCP destination port. */
- public static final int TCP_DST = 14;
+ int TCP_DST = 14;
+
/** UDP source port. */
- public static final int UDP_SRC = 15;
+ int UDP_SRC = 15;
+
/** UDP destination port. */
- public static final int UDP_DST = 16;
+ int UDP_DST = 16;
+
/** SCTP source port. */
- public static final int SCTP_SRC = 17;
+ int SCTP_SRC = 17;
+
/** SCTP destination port. */
- public static final int SCTP_DST = 18;
+ int SCTP_DST = 18;
+
/** ICMP type. */
- public static final int ICMPV4_TYPE = 19;
+ int ICMPV4_TYPE = 19;
+
/** ICMP code. */
- public static final int ICMPV4_CODE = 20;
+ int ICMPV4_CODE = 20;
+
/** ARP opcode. */
- public static final int ARP_OP = 21;
+ int ARP_OP = 21;
+
/** ARP source IPv4 address. */
- public static final int ARP_SPA = 22;
+ int ARP_SPA = 22;
+
/** ARP target IPv4 address. */
- public static final int ARP_TPA = 23;
+ int ARP_TPA = 23;
+
/** ARP source hardware address. */
- public static final int ARP_SHA = 24;
+ int ARP_SHA = 24;
+
/** ARP target hardware address. */
- public static final int ARP_THA = 25;
+ int ARP_THA = 25;
+
/** IPv6 source address. */
- public static final int IPV6_SRC = 26;
+ int IPV6_SRC = 26;
+
/** IPv6 destination address. */
- public static final int IPV6_DST = 27;
- /** IPv6 Flow Label */
- public static final int IPV6_FLABEL = 28;
+ int IPV6_DST = 27;
+
+ /** IPv6 Flow Label. */
+ int IPV6_FLABEL = 28;
+
/** ICMPv6 type. */
- public static final int ICMPV6_TYPE = 29;
+ int ICMPV6_TYPE = 29;
+
/** ICMPv6 code. */
- public static final int ICMPV6_CODE = 30;
+ int ICMPV6_CODE = 30;
+
/** Target address for ND. */
- public static final int IPV6_ND_TARGET = 31;
+ int IPV6_ND_TARGET = 31;
+
/** Source link-layer for ND. */
- public static final int IPV6_ND_SLL = 32;
+ int IPV6_ND_SLL = 32;
+
/** Target link-layer for ND. */
- public static final int IPV6_ND_TLL = 33;
+ int IPV6_ND_TLL = 33;
+
/** MPLS label. */
- public static final int MPLS_LABEL = 34;
+ int MPLS_LABEL = 34;
+
/** MPLS TC. */
- public static final int MPLS_TC = 35;
+ int MPLS_TC = 35;
+
/** MPLS BoS bit. */
- public static final int MPLS_BOS = 36;
+ int MPLS_BOS = 36;
+
/** PBB I-SID. */
- public static final int PBB_ISID = 37;
+ int PBB_ISID = 37;
+
/** Logical Port Metadata. */
- public static final int TUNNEL_ID = 38;
- /** IPv6 Extension Header pseudo-field */
- public static final int IPV6_EXTHDR = 39;
+ int TUNNEL_ID = 38;
+
+ /** IPv6 Extension Header pseudo-field. */
+ int IPV6_EXTHDR = 39;
/**
- * OFPXMC_NXM_1 class Constants
+ * OFPXMC_NXM_1 class Constants.
*/
- /** NXM IPv4 Tunnel Endpoint Source */
- public static final int NXM_NX_TUN_IPV4_SRC = 31;
- /** NXM IPv4 Tunnel Endpoint Destination */
- public static final int NXM_NX_TUN_IPV4_DST = 32;
- /** NXM TCP_Flag value */
- public static final int NXM_NX_TCP_FLAG = 34;
-
- private OxmMatchConstants() {
- //not called
- }
-}
\ No newline at end of file
+ /** NXM IPv4 Tunnel Endpoint Source. */
+ int NXM_NX_TUN_IPV4_SRC = 31;
+
+ /** NXM IPv4 Tunnel Endpoint Destination.
+ * */
+ int NXM_NX_TUN_IPV4_DST = 32;
+
+ /** NXM TCP_Flag value. */
+ int NXM_NX_TCP_FLAG = 34;
+}
package org.opendaylight.openflowjava.protocol.api.connection;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import com.google.common.collect.Lists;
import java.util.List;
-
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
-import com.google.common.collect.Lists;
-
/**
- * @author michal.polkorab
+ * Unit tests for TlsConfigurationImpl.
*
+ * @author michal.polkorab
*/
public class TlsConfigurationImplTest {
/**
- * Test correct TlsConfigurationImpl creation
+ * Test correct TlsConfigurationImpl creation.
*/
@Test
public void test() {
- List<String> cipherSuites = Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256");
+ List<String> cipherSuites = Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA",
+ "TLS_RSA_WITH_AES_128_CBC_SHA256");
TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,
"user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH, cipherSuites);
assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());
assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());
assertEquals("Wrong cipher suites", cipherSuites, config.getCipherSuites());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
/**
- * @author michal.polkorab
+ * Unit tests for EnhancedMessageCodeKey.
*
+ * @author michal.polkorab
*/
public class EnhancedMessageCodeKeyTest {
/**
- * Test EnhancedMessageCodeKey equals and hashCode
+ * Test EnhancedMessageCodeKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test EnhancedMessageTypeKey equals - additional test
+ * Test EnhancedMessageTypeKey equals - additional test.
*/
@Test
public void testEquals() {
}
/**
- * Test EnhancedMessageCodeKey toString()
+ * Test EnhancedMessageCodeKey toString().
*/
@Test
public void testToString() {
EnhancedMessageCodeKey key1 =
new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class);
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ Assert.assertEquals("Wrong toString()",
+ "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ ".openflow.protocol.rev130731.BarrierInput msgType: 4 msgType2: 8", key1.toString());
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
/**
- * @author michal.polkorab
+ * Unit tests for EnhancedMessageTypeKey.
*
+ * @author michal.polkorab
*/
public class EnhancedMessageTypeKeyTest {
/**
- * Test EnhancedMessageTypeKey equals and hashCode
+ * Test EnhancedMessageTypeKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test EnhancedMessageTypeKey equals - additional test
+ * Test EnhancedMessageTypeKey equals - additional test.
*/
@Test
public void testEquals() {
}
/**
- * Test EnhancedMessageTypeKey toString()
+ * Test EnhancedMessageTypeKey toString().
*/
@Test
public void testToString() {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
/**
- * @author michal.polkorab
+ * Unit tests for MessageCodeKey.
*
+ * @author michal.polkorab
*/
public class MessageCodeKeyTest {
/**
- * Test MessageCodeKey equals and hashCode
+ * Test MessageCodeKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test MessageCodeKey equals - additional test
+ * Test MessageCodeKey equals - additional test.
*/
@Test
public void testEquals() {
}
/**
- * Test MessageCodeKey toString()
+ * Test MessageCodeKey toString().
*/
@Test
public void testToString() {
Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"
+ ".opendaylight.openflow.protocol.rev130731.BarrierInput msgType: 4", key1.toString());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
/**
- * @author michal.polkorab
+ * Unit tests for MessageTypeKey.
*
+ * @author michal.polkorab
*/
public class MessageTypeKeyTest {
/**
- * Test MessageTypeKey equals and hashCode
+ * Test MessageTypeKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test MessageTypeKey equals - additional test
+ * Test MessageTypeKey equals - additional test.
*/
@Test
public void testEquals() {
- MessageTypeKey<?> key1;
- MessageTypeKey<?> key2;
- key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+ MessageTypeKey<?> key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
Assert.assertFalse("Wrong equal to null.", key1.equals(null));
Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
key1 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
- key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
+ MessageTypeKey<?> key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, BarrierInput.class);
Assert.assertFalse("Wrong equal by msgType.", key1.equals(key2));
key2 = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, null);
}
/**
- * Test MessageTypeKey toString()
+ * Test MessageTypeKey toString().
*/
@Test
public void testToString() {
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for ActionDeserializerKey.
*
+ * @author michal.polkorab
*/
public class ActionDeserializerKeyTest {
/**
- * Test ActionDeserializerKey equals and hashCode
+ * Test ActionDeserializerKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test ActionDeserializerKey equals - additional test
+ * Test ActionDeserializerKey equals - additional test.
*/
@Test
- public void testEquals(){
+ public void testEquals() {
ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
ActionDeserializerKey key2 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 42L);
}
/**
- * Test InstructionDeserializerKey toString()
+ * Test InstructionDeserializerKey toString().
*/
@Test
- public void testToString(){
+ public void testToString() {
ActionDeserializerKey key1 = new ActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn"
+ ".opendaylight.openflow.common.action.rev150203.actions.grouping.Action msgType: 11"
+ " experimenterID: null", key1.toString());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCase;
/**
- * @author michal.polkorab
+ * Unit tests for ActionSerializerKey.
*
+ * @author michal.polkorab
*/
public class ActionSerializerKeyTest {
/**
- * Test ActionSerializerKey equals and hashCode
+ * Test ActionSerializerKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test ActionSerializerKey equals - additional test
+ * Test ActionSerializerKey equals - additional test.
*/
@Test
- public void testEquals(){
+ public void testEquals() {
ActionSerializerKey<?> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L);
ActionSerializerKey<?> key2 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
CopyTtlInCase.class, 42L);
}
/**
- * Test ActionSerializerKey toString()
+ * Test ActionSerializerKey toString().
*/
@Test
- public void testToString(){
+ public void testToString() {
ActionSerializerKey<CopyTtlInCase> key1 = new ActionSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
CopyTtlInCase.class, 42L);
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for InstructionDeserializerKey.
*
+ * @author michal.polkorab
*/
public class InstructionDeserializerKeyTest {
/**
- * Test InstructionDeserializerKey equals and hashCode
+ * Test InstructionDeserializerKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test InstructionDeserializerKey equals - additional test
+ * Test InstructionDeserializerKey equals - additional test.
*/
@Test
- public void testEquals(){
+ public void testEquals() {
InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
InstructionDeserializerKey key2 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, 24L);
}
/**
- * Test InstructionDeserializerKey toString()
+ * Test InstructionDeserializerKey toString().
*/
@Test
- public void testToString(){
+ public void testToString() {
InstructionDeserializerKey key1 = new InstructionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 11, null);
- Assert.assertEquals("Wrong toString()", "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ Assert.assertEquals("Wrong toString()",
+ "msgVersion: 1 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight"
+ ".openflow.common.instruction.rev130731.instructions.grouping.Instruction msgType: 11"
+ " experimenterID: null", key1.toString());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase;
/**
- * @author michal.polkorab
+ * Unit tests for InstructionSerializerKey.
*
+ * @author michal.polkorab
*/
public class InstructionSerializerKeyTest {
/**
- * Test InstructionSerializerKey equals and hashCode
+ * Test InstructionSerializerKey equals and hashCode.
*/
@Test
public void test() {
InstructionSerializerKey<?> key1 =
new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L);
- InstructionSerializerKey<?> key2 =
+ InstructionSerializerKey<?> key2 =
new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
}
/**
- * Test InstructionSerializerKey equals - additional test
+ * Test InstructionSerializerKey equals - additional test.
*/
@Test
- public void testEquals(){
+ public void testEquals() {
InstructionSerializerKey<?> key1 =
new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L);
- InstructionSerializerKey<?> key2 =
- new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
+ InstructionSerializerKey<?> key2 =
+ new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L);
key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, null);
Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
}
/**
- * Test InstructionSerializerKey toString()
+ * Test InstructionSerializerKey toString().
*/
@Test
- public void testToString(){
+ public void testToString() {
InstructionSerializerKey<?> key1 =
new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L);
+ "instructionType type: org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction"
+ ".rev130731.instruction.grouping.instruction.choice.ApplyActionsCase vendorID: 42", key1.toString());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
/**
+ * Unit tests for keys.
+ *
* @author michal.polkorab
*/
public class KeysTest {
/**
- * Testing equals() and hashcode() methods of extension deserializer's keys
+ * Testing equals() and hashcode() methods of extension deserializer's keys.
*/
@Test
public void testEqualsAndHashcodeOfDeserializerKeys() {
InstructionDeserializerKey instructionDeserializerKey = new InstructionDeserializerKey(
EncodeConstants.OF13_VERSION_ID, EncodeConstants.EXPERIMENTER_VALUE, 1L);
- ExperimenterInstructionDeserializerKey experimenterInstructionDeserializerKey = new ExperimenterInstructionDeserializerKey(
+ ExperimenterInstructionDeserializerKey experimenterInstructionDeserializerKey =
+ new ExperimenterInstructionDeserializerKey(
EncodeConstants.OF13_VERSION_ID, 1L);
Assert.assertEquals(instructionDeserializerKey, experimenterInstructionDeserializerKey);
Assert.assertEquals(instructionDeserializerKey.hashCode(), experimenterInstructionDeserializerKey.hashCode());
}
/**
- * Testing equals() and hashcode() methods of extension serializer's keys
+ * Testing equals() and hashcode() methods of extension serializer's keys.
*/
@Test
public void testEqualsAndHashcodeOfActionDeserializerKeys() {
Assert.assertFalse(experimenterActionSerializerKey.equals(actionSerializerKey));
InstructionSerializerKey<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225
- .instruction.container.instruction.choice.ExperimenterIdCase> instructionSerializerKey =
+ .instruction.container.instruction.choice.ExperimenterIdCase> instructionSerializerKey =
new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, org.opendaylight.yang.gen.v1.urn
.opendaylight.openflow.augments.rev150225.instruction.container.instruction.choice
.ExperimenterIdCase.class, 1L);
- ExperimenterInstructionSerializerKey experimenterInstructionSerializerKey = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 1L);
+ ExperimenterInstructionSerializerKey experimenterInstructionSerializerKey =
+ new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 1L);
Assert.assertEquals(instructionSerializerKey, experimenterInstructionSerializerKey);
Assert.assertEquals(instructionSerializerKey.hashCode(), experimenterInstructionSerializerKey.hashCode());
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for MatchEntryDeserializerKey.
*
+ * @author michal.polkorab
*/
public class MatchEntryDeserializerKeyTest {
/**
- * Test MatchEntryDeserializerKey equals and hashCode
+ * Test MatchEntryDeserializerKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test MatchEntryDeserializerKey equals - additional test
+ * Test MatchEntryDeserializerKey equals - additional test.
*/
@Test
public void testEquals() {
MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
- MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
- Long expId1=123456L;
- Long expId2=654321L;
+ MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0x8000, 42);
+
+ Long expId2 = 654321L;
key1.setExperimenterId(null);
key2.setExperimenterId(expId2);
Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));
+ Long expId1 = 123456L;
key1.setExperimenterId(expId1);
Assert.assertFalse("Wrong equal by experimeterId.", key1.equals(key2));
Assert.assertFalse("Wrong equals with different object class", key1.equals(key2));
}
/**
- * Test MatchEntryDeserializerKey toString()
+ * Test MatchEntryDeserializerKey toString().
*/
@Test
- public void testToString(){
+ public void testToString() {
MatchEntryDeserializerKey key1 = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, 0x8000, 42);
Assert.assertEquals("Wrong toString()", "msgVersion: 4 objectClass: org.opendaylight.yang.gen.v1.urn"
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
/**
- * @author michal.polkorab
+ * Unit tests for MatchEntrySerializerKey.
*
+ * @author michal.polkorab
*/
public class MatchEntrySerializerKeyTest {
/**
- * Test MatchEntrySerializerKey equals and hashCode
+ * Test MatchEntrySerializerKey equals and hashCode.
*/
@Test
public void test() {
- MatchEntrySerializerKey<?, ?> key1 = new MatchEntrySerializerKey<>
- (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
- MatchEntrySerializerKey<?, ?> key2 = new MatchEntrySerializerKey<>
- (EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+ MatchEntrySerializerKey<?, ?> key1 = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+ MatchEntrySerializerKey<?, ?> key2 = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashCode", key1.hashCode() == key2.hashCode());
key2 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID,
}
/**
- * Test MatchEntrySerializerKey equals - additional test
+ * Test MatchEntrySerializerKey equals - additional test.
*/
@Test
- public void testEquals(){
+ public void testEquals() {
MatchEntrySerializerKey<?, ?> key1;
MatchEntrySerializerKey<?, ?> key2;
key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object()));
- Long expId1 = 987654331L;
Long expId2 = 123456789L;
key1.setExperimenterId(null);
key2.setExperimenterId(expId2);
Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
+
+ Long expId1 = 987654331L;
key1.setExperimenterId(expId1);
Assert.assertFalse("Wrong equal by experimenterId", key1.equals(key2));
key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, null, InPort.class);
}
/**
- * Test MatchEntrySerializerKey toString()
+ * Test MatchEntrySerializerKey toString().
*/
@Test
- public void testToString(){
+ public void testToString() {
MatchEntrySerializerKey<?, ?> key1;
key1 = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, OpenflowBasicClass.class, InPort.class);
+ ".OpenflowBasicClass oxm_field: org.opendaylight.yang.gen.v1.urn.opendaylight.openflow"
+ ".oxm.rev150225.InPort experimenterID: null", key1.toString());
}
-}
\ No newline at end of file
+}
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+
/**
+ * Unit tests for TypeToClassKey.
*
* @author madamjak
- *
*/
public class TypeToClassKeyTest {
/**
- * Test equals
+ * Test equals.
*/
@Test
- public void test(){
+ public void test() {
final short ver10 = EncodeConstants.OF10_VERSION_ID;
final short ver13 = EncodeConstants.OF13_VERSION_ID;
final int type1 = 1;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterActionDeserializerKey.
*
+ * @author michal.polkorab
*/
public class ExperimenterActionDeserializerKeyTest {
/**
- * Test ExperimenterActionDeserializerKey equals and hashCode
+ * Test ExperimenterActionDeserializerKey equals and hashCode.
*/
@Test
public void test() {
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.ExperimenterActionSubType;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterActionSerializerKey.
*
+ * @author michal.polkorab
*/
public class ExperimenterActionSerializerKeyTest {
-
/**
- * Test ExperimenterActionSerializerKey equals and hashCode
+ * Test ExperimenterActionSerializerKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test ExperimenterActionSerializerKey equals
+ * Test ExperimenterActionSerializerKey equals.
*/
@Test
public void testEquals() {
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterIdDeserializerKey.
*
+ * @author michal.polkorab
*/
public class ExperimenterIdDeserializerKeyTest {
/**
- * Test ExperimenterIdDeserializerKey equals and hashCode
+ * Test ExperimenterIdDeserializerKey equals and hashCode.
*/
@Test
public void test() {
}
/**
- * Test ExperimenterIdDeserializerKey equals - additional test
+ * Test ExperimenterIdDeserializerKey equals - additional test.
*/
@Test
public void testEquals() {
ExperimenterIdDeserializerKey key1 =
new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 0L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
- MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);
+ MessageCodeKey mk = new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,
+ EncodeConstants.EXPERIMENTER_VALUE, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
ExperimenterIdDeserializerKey key2 =
new ExperimenterIdDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterIdSerializerKey.
*
+ * @author michal.polkorab
*/
public class ExperimenterIdSerializerKeyTest {
/**
- * Test ExperimenterIdSerializerKey equals and hashCode
+ * Test ExperimenterIdSerializerKey equals and hashCode.
*/
@Test
public void testHashCodeAndEquals() {
}
/**
- * Test ExperimenterIdSerializerKey equals - additional test
+ * Test ExperimenterIdSerializerKey equals - additional test.
*/
@Test
public void testEquals() {
ExperimenterIdSerializerKey<?> key1 =
new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 41L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
- MessageTypeKey<?>mk = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,ExperimenterMessage.class);
+ MessageTypeKey<?> mk = new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID,ExperimenterMessage.class);
Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
ExperimenterIdSerializerKey<?> key2 =
new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
/**
+ * Unit tests for ExperimenterIdTypeDeserializerKey.
+ *
* @author michal.polkorab
*/
public class ExperimenterIdTypeDeserializerKeyTest {
/**
- * Test ExperimenterIdTypeDeserializerKey equals and hashCode
+ * Test ExperimenterIdTypeDeserializerKey equals and hashCode.
*/
@Test
public void testHashCodeAndEquals() {
- ExperimenterIdTypeDeserializerKey key1 =
- new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
- ExperimenterIdTypeDeserializerKey key2 =
- new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ ExperimenterIdTypeDeserializerKey key1 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 42L, 1L, ExperimenterMessage.class);
+ ExperimenterIdTypeDeserializerKey key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 42L, 1L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L, 1L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, 1L, ExperimenterMessage.class);
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, 1L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L, 1L, null);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 2L, ExperimenterMessage.class);
+ key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 2L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
/**
- * Test ExperimenterIdTypeDeserializerKey equals - additional test
+ * Test ExperimenterIdTypeDeserializerKey equals - additional test.
*/
@Test
public void testEquals() {
- ExperimenterIdTypeDeserializerKey key1 =
- new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 41L, 1L, ExperimenterMessage.class);
+ ExperimenterIdTypeDeserializerKey key1 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 41L, 1L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
- ExperimenterIdSerializerKey<?> mk = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ ExperimenterIdSerializerKey<?> mk = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
- ExperimenterIdTypeDeserializerKey key2 =
- new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ ExperimenterIdTypeDeserializerKey key2 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 42L, 1L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
- ExperimenterIdTypeDeserializerKey key3 =
- new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID, 41L, 2L, ExperimenterMessage.class);
+ ExperimenterIdTypeDeserializerKey key3 = new ExperimenterIdTypeDeserializerKey(EncodeConstants.OF10_VERSION_ID,
+ 41L, 2L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal by type.", key1.equals(key3));
}
-}
\ No newline at end of file
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
/**
+ * Unit tests for ExperimenterIdTypeSerializerKey.
+ *
* @author michal.polkorab
*/
public class ExperimenterIdTypeSerializerKeyTest {
/**
- * Test ExperimenterIdTypeSerializerKey equals and hashCode
+ * Test ExperimenterIdTypeSerializerKey equals and hashCode.
*/
@Test
public void testHashCodeAndEquals() {
ExperimenterIdTypeSerializerKey<?> key1 =
- new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
- ExperimenterIdTypeSerializerKey<?> key2 =
- new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, 1L,
+ ExperimenterMessage.class);
+ ExperimenterIdTypeSerializerKey<?> key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ 42L, 1L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equals", key1.equals(key2));
Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF13_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF13_VERSION_ID, 42L, 1L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, 1L, ExperimenterMessage.class);
+ key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, 1L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 55L, 1L, null);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
- key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, 2L, ExperimenterMessage.class);
+ key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, 2L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
/**
- * Test ExperimenterIdTypeSerializerKey equals - additional test
+ * Test ExperimenterIdTypeSerializerKey equals - additional test.
*/
@Test
public void testEquals() {
- ExperimenterIdTypeSerializerKey<?> key1 =
- new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 41L, 1L, ExperimenterMessage.class);
+ ExperimenterIdTypeSerializerKey<?> key1 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ 41L, 1L, ExperimenterMessage.class);
Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
- ExperimenterIdSerializerKey<?> mk = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, ExperimenterMessage.class);
+ ExperimenterIdSerializerKey<?> mk = new ExperimenterIdSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L,
+ ExperimenterMessage.class);
Assert.assertFalse("Wrong equal to different class.", key1.equals(mk));
- ExperimenterIdTypeSerializerKey<?> key2 =
- new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 42L, 1L, ExperimenterMessage.class);
+ ExperimenterIdTypeSerializerKey<?> key2 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ 42L, 1L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2));
- ExperimenterIdTypeSerializerKey<?> key3 =
- new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID, 41L, 2L, ExperimenterMessage.class);
+ ExperimenterIdTypeSerializerKey<?> key3 = new ExperimenterIdTypeSerializerKey<>(EncodeConstants.OF10_VERSION_ID,
+ 41L, 2L, ExperimenterMessage.class);
Assert.assertFalse("Wrong equal by type.", key1.equals(key3));
}
-
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterInstructionDeserializerKey.
*
+ * @author michal.polkorab
*/
public class ExperimenterInstructionDeserializerKeyTest {
/**
- * Test ExperimenterInstructionDeserializerKey equals and hashCode
+ * Test ExperimenterInstructionDeserializerKey equals and hashCode.
*/
@Test
public void test() {
Assert.assertFalse("Wrong equals", key1.equals(key2));
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
-}
\ No newline at end of file
+}
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
/**
- * @author michal.polkorab
+ * Unit tests for ExperimenterInstructionSerializerKey.
*
+ * @author michal.polkorab
*/
public class ExperimenterInstructionSerializerKeyTest {
/**
- * Test ExperimenterInstructionSerializerKey equals and hashCode
+ * Test ExperimenterInstructionSerializerKey equals and hashCode.
*/
@Test
public void test() {
Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
}
-}
\ No newline at end of file
+}
import org.junit.Test;
/**
+ * Unit tests for BinContent.
+ *
* @author michal.polkorab
*/
public class BinContentTest {
/**
- * Testing correct conversion from signed int value to unsigned long value
+ * Testing correct conversion from signed int value to unsigned long value.
*/
@Test
public void testIntToUnsignedLong() {
- int a = 0;
- int b = 1;
- int c = -1;
- int d = Integer.MAX_VALUE;
- int e = Integer.MIN_VALUE;
- int f = 12345;
- Assert.assertEquals("Wrong conversion", 0, BinContent.intToUnsignedLong(a));
- Assert.assertEquals("Wrong conversion", 1, BinContent.intToUnsignedLong(b));
- Assert.assertEquals("Wrong conversion", 4294967295L, BinContent.intToUnsignedLong(c));
- Assert.assertEquals("Wrong conversion", Integer.MAX_VALUE, BinContent.intToUnsignedLong(d));
- Assert.assertEquals("Wrong conversion", ((long) Integer.MAX_VALUE) + 1, BinContent.intToUnsignedLong(e));
- Assert.assertEquals("Wrong conversion", 12345, BinContent.intToUnsignedLong(f));
+ Assert.assertEquals("Wrong conversion", 0, BinContent.intToUnsignedLong(0));
+ Assert.assertEquals("Wrong conversion", 1, BinContent.intToUnsignedLong(1));
+ Assert.assertEquals("Wrong conversion", 4294967295L, BinContent.intToUnsignedLong(-1));
+ Assert.assertEquals("Wrong conversion", Integer.MAX_VALUE, BinContent.intToUnsignedLong(Integer.MAX_VALUE));
+ Assert.assertEquals("Wrong conversion", (long) Integer.MAX_VALUE + 1,
+ BinContent.intToUnsignedLong(Integer.MIN_VALUE));
+ Assert.assertEquals("Wrong conversion", 12345, BinContent.intToUnsignedLong(12345));
}
/**
- * Testing correct conversion from unsigned long value to signed int value
+ * Testing correct conversion from unsigned long value to signed int value.
*/
@Test
public void testLongToSignedInt() {
- long a = 0;
- long b = 1;
- long c = -1;
- long d = Integer.MAX_VALUE;
- long e = Integer.MIN_VALUE;
- long f = 12345;
- long g = Long.MAX_VALUE;
- long h = 1094624935644L;
- long i = ((long) Integer.MAX_VALUE) + 1;
- Assert.assertEquals("Wrong conversion", 0, BinContent.longToSignedInt(a));
- Assert.assertEquals("Wrong conversion", 1, BinContent.longToSignedInt(b));
- Assert.assertEquals("Wrong conversion", -1, BinContent.longToSignedInt(c));
- Assert.assertEquals("Wrong conversion", Integer.MAX_VALUE, BinContent.longToSignedInt(d));
- Assert.assertEquals("Wrong conversion", Integer.MIN_VALUE, BinContent.longToSignedInt(e));
- Assert.assertEquals("Wrong conversion", 12345, BinContent.longToSignedInt(f));
- Assert.assertEquals("Wrong conversion", -1, BinContent.longToSignedInt(g));
- Assert.assertEquals("Wrong conversion", -591724836, BinContent.longToSignedInt(h));
- Assert.assertEquals("Wrong conversion", Integer.MIN_VALUE, BinContent.longToSignedInt(i));
+ Assert.assertEquals("Wrong conversion", 0, BinContent.longToSignedInt(0L));
+ Assert.assertEquals("Wrong conversion", 1, BinContent.longToSignedInt(1L));
+ Assert.assertEquals("Wrong conversion", -1, BinContent.longToSignedInt(-1L));
+ Assert.assertEquals("Wrong conversion", Integer.MAX_VALUE, BinContent.longToSignedInt(Integer.MAX_VALUE));
+ Assert.assertEquals("Wrong conversion", Integer.MIN_VALUE, BinContent.longToSignedInt(Integer.MIN_VALUE));
+ Assert.assertEquals("Wrong conversion", 12345, BinContent.longToSignedInt(12345L));
+ Assert.assertEquals("Wrong conversion", -1, BinContent.longToSignedInt(Long.MAX_VALUE));
+ Assert.assertEquals("Wrong conversion", -591724836, BinContent.longToSignedInt(1094624935644L));
+ Assert.assertEquals("Wrong conversion", Integer.MIN_VALUE, BinContent.longToSignedInt(Integer.MAX_VALUE + 1L));
}
}