getCipherSuites() {
+ return cipherSuites;
+ }
}
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/AlienMessageListener.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/AlienMessageListener.java
new file mode 100644
index 00000000..a3cd7c6c
--- /dev/null
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/AlienMessageListener.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.extensibility;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+
+public interface AlienMessageListener {
+
+ /**
+ * Handler for alien but successfully deserialized messages for device
+ * @param message alien message
+ */
+ void onAlienMessage(OfHeader message);
+}
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/DeserializerExtensionProvider.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/DeserializerExtensionProvider.java
index b227453e..5a0658eb 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/DeserializerExtensionProvider.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/DeserializerExtensionProvider.java
@@ -13,6 +13,8 @@
import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionDeserializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
+import org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
@@ -33,6 +35,20 @@
*/
public interface DeserializerExtensionProvider {
+ /**
+ * Registers deserializer.
+ * Throws IllegalStateException when there is
+ * a deserializer already registered under given key.
+ *
+ * If the deserializer implements {@link DeserializerRegistryInjector} interface,
+ * the deserializer is injected with DeserializerRegistry instance.
+ *
+ * @param key used for deserializer lookup
+ * @param deserializer deserializer instance
+ */
+ void registerDeserializer(MessageCodeKey key,
+ OFGeneralDeserializer deserializer);
+
/**
* Unregisters custom deserializer
* @param key used for deserializer lookup
@@ -112,4 +128,18 @@ void registerMeterBandDeserializer(ExperimenterIdDeserializerKey key,
*/
void registerQueuePropertyDeserializer(ExperimenterIdDeserializerKey key,
OFDeserializer deserializer);
+
+ /**
+ * 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
+ * @param key type to class key
+ * @return true if mapping was successfully removed
+ */
+ boolean unregisterDeserializerMapping(TypeToClassKey key);
}
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderDeserializer.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderDeserializer.java
index a0fe9391..c80df7b9 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderDeserializer.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderDeserializer.java
@@ -8,13 +8,13 @@
package org.opendaylight.openflowjava.protocol.api.extensibility;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* @author michal.polkorab
* @param output message type
*/
-public interface HeaderDeserializer extends OFGeneralDeserializer {
+public interface HeaderDeserializer extends OFGeneralDeserializer {
/**
* Deserializes byte message headers
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderSerializer.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderSerializer.java
index b8b8a029..427d84ce 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderSerializer.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/HeaderSerializer.java
@@ -8,14 +8,14 @@
package org.opendaylight.openflowjava.protocol.api.extensibility;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
/**
* Does only-header serialization (such as oxm_ids, action_ids, instruction_ids)
* @author michal.polkorab
* @param input message type
*/
-public interface HeaderSerializer extends OFGeneralSerializer {
+public interface HeaderSerializer extends OFGeneralSerializer {
/**
* Serializes object headers (e.g. for Multipart message - Table Features)
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerExtensionProvider.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerExtensionProvider.java
old mode 100644
new mode 100755
index 13162491..366cd3ab
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerExtensionProvider.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/extensibility/SerializerExtensionProvider.java
@@ -9,10 +9,12 @@
package org.opendaylight.openflowjava.protocol.api.extensibility;
import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdMeterSubTypeSerializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterSerializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
@@ -33,6 +35,21 @@
*/
public interface SerializerExtensionProvider {
+ /**
+ * Registers serializer
+ * Throws IllegalStateException when there is
+ * a serializer already registered under given key.
+ *
+ * If the serializer implements {@link SerializerRegistryInjector} interface,
+ * the serializer is injected with SerializerRegistry instance.
+ *
+ * @param serializer key type
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerSerializer(MessageTypeKey key,
+ OFGeneralSerializer serializer);
+
/**
* Unregisters custom serializer
* @param key used for serializer lookup
@@ -92,10 +109,21 @@ void registerMultipartRequestTFSerializer(ExperimenterIdSerializerKey key,
OFSerializer serializer);
+
+ /**
+ * Registers meter band serializer (used in meter-mod messages)
+ * @param key used for serializer lookup
+ * @param serializer serializer implementation
+ */
+ void registerMeterBandSerializer(ExperimenterIdMeterSubTypeSerializerKey key,
+ OFSerializer serializer);
}
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdDeserializerKey.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdDeserializerKey.java
index 8f66900d..ec2cf3e1 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdDeserializerKey.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdDeserializerKey.java
@@ -13,10 +13,8 @@
/**
* @author michal.polkorab
- *
*/
-public class ExperimenterIdDeserializerKey extends MessageCodeKey
- implements ExperimenterDeserializerKey {
+public class ExperimenterIdDeserializerKey extends MessageCodeKey implements ExperimenterDeserializerKey {
private long experimenterId;
@@ -26,8 +24,8 @@ public class ExperimenterIdDeserializerKey extends MessageCodeKey
* @param experimenterId experimenter / vendor ID
* @param objectClass class of created object
*/
- public ExperimenterIdDeserializerKey(short version,
- long experimenterId, Class objectClass) {
+ public ExperimenterIdDeserializerKey(final short version, final long experimenterId,
+ final Class objectClass) {
super(version, EncodeConstants.EXPERIMENTER_VALUE, objectClass);
this.experimenterId = experimenterId;
}
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdMeterSubTypeSerializerKey.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdMeterSubTypeSerializerKey.java
new file mode 100755
index 00000000..f568a028
--- /dev/null
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdMeterSubTypeSerializerKey.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016 ZTE, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.api.keys;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterMeterBandSubType;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+
+/**
+ * Created by hyy on 2016/9/8.
+ */
+public class ExperimenterIdMeterSubTypeSerializerKey extends ExperimenterIdSerializerKey {
+
+ private Class extends ExperimenterMeterBandSubType> meterSubType;
+
+ /**
+ * @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 objectClass, Class extends ExperimenterMeterBandSubType> meterSubType) {
+ super(msgVersion, experimenterId, objectClass);
+ this.meterSubType = meterSubType;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((meterSubType == null) ? 0 : meterSubType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ExperimenterIdMeterSubTypeSerializerKey other = (ExperimenterIdMeterSubTypeSerializerKey) obj;
+ if (meterSubType == null) {
+ if (other.meterSubType != null) {
+ return false;
+ }
+ } else if (!meterSubType.equals(other.meterSubType)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdTypeDeserializerKey.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdTypeDeserializerKey.java
index cb88b1ad..c956feb0 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdTypeDeserializerKey.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/ExperimenterIdTypeDeserializerKey.java
@@ -18,14 +18,15 @@ public class ExperimenterIdTypeDeserializerKey extends ExperimenterIdDeserialize
private long type;
/**
- * @param msgVersion protocol wire version
+ * @param type of target experimenter object
+ * @param version protocol wire version
* @param experimenterId experimenter / vendor ID
* @param type data type according to vendor implementation
* @param objectClass class of object to be serialized
*/
- public ExperimenterIdTypeDeserializerKey(short msgVersion,
- long experimenterId, long type, Class objectClass) {
- super(msgVersion, experimenterId, objectClass);
+ public ExperimenterIdTypeDeserializerKey(final short version, final long experimenterId,
+ final long type, Class objectClass) {
+ super(version, experimenterId, objectClass);
this.type = type;
}
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MessageCodeKey.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MessageCodeKey.java
index 6597c19a..566b3623 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MessageCodeKey.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/MessageCodeKey.java
@@ -28,6 +28,14 @@ public MessageCodeKey(short version, int value, Class> clazz) {
this.clazz = clazz;
}
+ public int getMsgType() {
+ return this.msgType;
+ }
+
+ public Class> getClazz() {
+ return this.clazz;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeToClassKey.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/TypeToClassKey.java
similarity index 95%
rename from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeToClassKey.java
rename to openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/TypeToClassKey.java
index 0f6b9caf..71eed094 100644
--- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/TypeToClassKey.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/keys/TypeToClassKey.java
@@ -5,7 +5,7 @@
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.openflowjava.protocol.impl.util;
+package org.opendaylight.openflowjava.protocol.api.keys;
/**
* @author michal.polkorab
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/EncodeConstants.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/EncodeConstants.java
index 82a09282..58d6ccd4 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/EncodeConstants.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/EncodeConstants.java
@@ -9,7 +9,7 @@
package org.opendaylight.openflowjava.protocol.api.util;
/**
- * Stores common constants
+ * Stores common constants.
* @author michal.polkorab
*/
public abstract class EncodeConstants {
@@ -20,6 +20,14 @@ public abstract class EncodeConstants {
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 */
@@ -52,11 +60,14 @@ public abstract class EncodeConstants {
/** 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;
- /** OF v1.3 lenght of experimenter_ids - see Multipart TableFeatures (properties) message */
- public static final byte EXPERIMENTER_IDS_LENGTH = 8;
+
+ /** 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
diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java
index 3768f2f5..e47b70d6 100644
--- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java
+++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java
@@ -8,9 +8,8 @@
package org.opendaylight.openflowjava.protocol.api.util;
/**
- * Stores oxm_match constants
+ * Stores oxm_match constants.
* @author michal.polkorab
- *
*/
public abstract class OxmMatchConstants {
diff --git a/openflow-protocol-api/src/main/yang/openflow-approved-extensions.yang b/openflow-protocol-api/src/main/yang/openflow-approved-extensions.yang
new file mode 100644
index 00000000..29a20351
--- /dev/null
+++ b/openflow-protocol-api/src/main/yang/openflow-approved-extensions.yang
@@ -0,0 +1,32 @@
+module openflow-approved-extensions {
+ namespace "urn:opendaylight:openflow:approved:extensions";
+ prefix "ofext";
+
+ import yang-ext {prefix ext;}
+ import openflow-extensible-match {prefix oxm;}
+ import openflow-augments {prefix aug;}
+
+ revision "2016-08-02" {
+ description "Openflow approved extensions definition";
+ }
+
+ //ONF Approved OpenFlow Extensions
+ // Extension 109 - TCP FLAGS
+ identity tcp_flags {
+ base oxm:match-field;
+ description "TCP flags from the TCP header";
+ }
+
+ augment "/oxm:oxm-container/oxm:match-entry-value/aug:experimenter-id-case" {
+ ext:augment-identifier "tcp-flags-container";
+ container tcp-flags {
+ leaf flags {
+ type uint16;
+ }
+ leaf mask {
+ type binary;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/openflow-protocol-api/src/main/yang/openflow-augments.yang b/openflow-protocol-api/src/main/yang/openflow-augments.yang
old mode 100644
new mode 100755
index e5be7e56..4a60c37e
--- a/openflow-protocol-api/src/main/yang/openflow-augments.yang
+++ b/openflow-protocol-api/src/main/yang/openflow-augments.yang
@@ -127,5 +127,10 @@
leaf experimenter {
type oft:experimenter-id;
}
+ leaf sub-type {
+ type identityref {
+ base oft:experimenter-meter-band-sub-type;
+ }
+ }
}
}
diff --git a/openflow-protocol-api/src/main/yang/openflow-types.yang b/openflow-protocol-api/src/main/yang/openflow-types.yang
old mode 100644
new mode 100755
index 251a845e..7d11bafa
--- a/openflow-protocol-api/src/main/yang/openflow-types.yang
+++ b/openflow-protocol-api/src/main/yang/openflow-types.yang
@@ -206,6 +206,10 @@
description "Base identity for action types";
}
+ identity experimenter-meter-band-sub-type {
+ description "The base identity for vendor's meter bands.";
+ }
+
typedef metadata {
type binary;
}
diff --git a/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/connection/TlsConfigurationImplTest.java b/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/connection/TlsConfigurationImplTest.java
index f71d2302..be52a188 100644
--- a/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/connection/TlsConfigurationImplTest.java
+++ b/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/connection/TlsConfigurationImplTest.java
@@ -10,10 +10,14 @@
import static org.junit.Assert.*;
+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
*
@@ -25,8 +29,9 @@ public class TlsConfigurationImplTest {
*/
@Test
public void test() {
+ List 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);
+ "user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH, cipherSuites);
assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());
assertEquals("Wrong truststore location", "user/dir", config.getTlsTruststore());
assertEquals("Wrong keystore type", KeystoreType.PKCS12, config.getTlsKeystoreType());
@@ -36,5 +41,6 @@ public void test() {
assertEquals("Wrong certificate password", "opendaylight", config.getCertificatePassword());
assertEquals("Wrong keystore password", "opendaylight", config.getKeystorePassword());
assertEquals("Wrong truststore password", "opendaylight", config.getTruststorePassword());
+ assertEquals("Wrong cipher suites", cipherSuites, config.getCipherSuites());
}
}
\ No newline at end of file
diff --git a/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/KeysTest.java b/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/KeysTest.java
index c23d4b3c..d2aefedb 100644
--- a/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/KeysTest.java
+++ b/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/KeysTest.java
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.openflowjava.protocol.api.keys;
import org.junit.Assert;
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/TypeToClassKeyTest.java b/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/TypeToClassKeyTest.java
similarity index 90%
rename from openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/TypeToClassKeyTest.java
rename to openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/TypeToClassKeyTest.java
index a9ebcf43..8b6192d3 100644
--- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/TypeToClassKeyTest.java
+++ b/openflow-protocol-api/src/test/java/org/opendaylight/openflowjava/protocol/api/keys/TypeToClassKeyTest.java
@@ -6,12 +6,11 @@
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.openflowjava.protocol.impl.deserialization;
+package org.opendaylight.openflowjava.protocol.api.keys;
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;
/**
*
* @author madamjak
diff --git a/openflow-protocol-impl/pom.xml b/openflow-protocol-impl/pom.xml
index fae2c30b..62c2ddd3 100644
--- a/openflow-protocol-impl/pom.xml
+++ b/openflow-protocol-impl/pom.xml
@@ -3,12 +3,14 @@
org.opendaylight.openflowjava
openflowjava-parent
- 0.7.0-SNAPSHOT
+ 0.10.0-SNAPSHOT
../parent
openflow-protocol-impl
bundle
- Openflow Protocol Library - IMPL
+
+ ODL :: openflowjava :: ${project.artifactId}
https://wiki.opendaylight.org/view/Openflow_Protocol_Library:Main
HEAD
@@ -52,12 +54,12 @@
- org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+ org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl
${salGeneratorPath}
- org.opendaylight.yangtools.yang.unified.doc.generator.maven.DocumentationGeneratorImpl
+ org.opendaylight.mdsal.binding.yang.unified.doc.generator.maven.DocumentationGeneratorImpl
${project.build.directory}/site/models
@@ -74,7 +76,7 @@
org.opendaylight.mdsal
maven-sal-api-gen-plugin
- ${yangtools.version}
+ ${mdsal.model.version}
jar
@@ -144,11 +146,17 @@
org.mockito
- mockito-all
+ mockito-core
org.opendaylight.controller
config-api
+
+ io.netty
+ netty-transport-native-epoll
+
+ linux-x86_64
+
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ChannelInitializerFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ChannelInitializerFactory.java
index 042d4640..414f2c25 100644
--- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ChannelInitializerFactory.java
+++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ChannelInitializerFactory.java
@@ -24,17 +24,19 @@ public class ChannelInitializerFactory {
private SerializationFactory serializationFactory;
private TlsConfiguration tlsConfig;
private SwitchConnectionHandler switchConnectionHandler;
+ private boolean useBarrier;
/**
* @return PublishingChannelInitializer that initializes new channels
*/
public TcpChannelInitializer createPublishingChannelInitializer() {
- TcpChannelInitializer initializer = new TcpChannelInitializer();
+ final TcpChannelInitializer initializer = new TcpChannelInitializer();
initializer.setSwitchIdleTimeout(switchIdleTimeOut);
initializer.setDeserializationFactory(deserializationFactory);
initializer.setSerializationFactory(serializationFactory);
initializer.setTlsConfiguration(tlsConfig);
initializer.setSwitchConnectionHandler(switchConnectionHandler);
+ initializer.setUseBarrier(useBarrier);
return initializer;
}
@@ -42,7 +44,7 @@ public TcpChannelInitializer createPublishingChannelInitializer() {
* @return PublishingChannelInitializer that initializes new channels
*/
public UdpChannelInitializer createUdpChannelInitializer() {
- UdpChannelInitializer initializer = new UdpChannelInitializer();
+ final UdpChannelInitializer initializer = new UdpChannelInitializer();
initializer.setSwitchIdleTimeout(switchIdleTimeOut);
initializer.setDeserializationFactory(deserializationFactory);
initializer.setSerializationFactory(serializationFactory);
@@ -53,35 +55,42 @@ public UdpChannelInitializer createUdpChannelInitializer() {
/**
* @param switchIdleTimeOut
*/
- public void setSwitchIdleTimeout(long switchIdleTimeOut) {
+ public void setSwitchIdleTimeout(final long switchIdleTimeOut) {
this.switchIdleTimeOut = switchIdleTimeOut;
}
/**
* @param deserializationFactory
*/
- public void setDeserializationFactory(DeserializationFactory deserializationFactory) {
+ public void setDeserializationFactory(final DeserializationFactory deserializationFactory) {
this.deserializationFactory = deserializationFactory;
}
/**
* @param serializationFactory
*/
- public void setSerializationFactory(SerializationFactory serializationFactory) {
+ public void setSerializationFactory(final SerializationFactory serializationFactory) {
this.serializationFactory = serializationFactory;
}
/**
* @param tlsConfig
*/
- public void setTlsConfig(TlsConfiguration tlsConfig) {
+ public void setTlsConfig(final TlsConfiguration tlsConfig) {
this.tlsConfig = tlsConfig;
}
/**
* @param switchConnectionHandler
*/
- public void setSwitchConnectionHandler(SwitchConnectionHandler switchConnectionHandler) {
+ public void setSwitchConnectionHandler(final SwitchConnectionHandler switchConnectionHandler) {
this.switchConnectionHandler = switchConnectionHandler;
}
+
+ /**
+ * @param useBarrier
+ */
+ public void setUseBarrier(final boolean useBarrier) {
+ this.useBarrier = useBarrier;
+ }
}
\ No newline at end of file
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java
index 4959edaa..1e95c65c 100644
--- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java
+++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.openflowjava.protocol.impl.core;
/**
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java
index e0a013c1..b0fee5c3 100644
--- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java
+++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java
@@ -8,9 +8,9 @@
package org.opendaylight.openflowjava.protocol.impl.core;
+import com.google.common.base.Preconditions;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
-
import org.opendaylight.openflowjava.protocol.impl.core.connection.ConnectionAdapterImpl;
import org.opendaylight.openflowjava.protocol.impl.core.connection.MessageConsumer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder;
@@ -18,8 +18,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Preconditions;
-
/**
* Holds reference to {@link ConnectionAdapterImpl} and passes messages for further processing.
* Also informs on switch disconnection.
@@ -27,17 +25,16 @@
*/
public class DelegatingInboundHandler extends ChannelInboundHandlerAdapter {
- private static final Logger LOGGER = LoggerFactory.getLogger(DelegatingInboundHandler.class);
-
+ private static final Logger LOG = LoggerFactory.getLogger(DelegatingInboundHandler.class);
private final MessageConsumer consumer;
private boolean inactiveMessageSent = false;
/**
- * Constructs class + creates and sets MessageConsumer
+ * Constructs class + creates and sets MessageConsumer.
* @param connectionAdapter reference for adapter communicating with upper layers outside library
*/
public DelegatingInboundHandler(final MessageConsumer connectionAdapter) {
- LOGGER.trace("Creating DelegatingInboundHandler");
+ LOG.trace("Creating DelegatingInboundHandler");
consumer = Preconditions.checkNotNull(connectionAdapter);
}
@@ -48,7 +45,7 @@ public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
@Override
public void channelInactive(final ChannelHandlerContext ctx) {
- LOGGER.debug("Channel inactive");
+ LOG.debug("Channel inactive");
if (!inactiveMessageSent) {
DisconnectEventBuilder builder = new DisconnectEventBuilder();
builder.setInfo("Channel inactive");
@@ -59,7 +56,7 @@ public void channelInactive(final ChannelHandlerContext ctx) {
@Override
public void channelUnregistered(final ChannelHandlerContext ctx) {
- LOGGER.debug("Channel unregistered");
+ LOG.debug("Channel unregistered");
if (!inactiveMessageSent) {
DisconnectEventBuilder builder = new DisconnectEventBuilder();
builder.setInfo("Channel unregistered");
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java
index 9b6e863d..5f408e6c 100644
--- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java
+++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java
@@ -23,7 +23,7 @@
*/
public class IdleHandler extends ReadTimeoutHandler {
- private static final Logger LOGGER = LoggerFactory.getLogger(IdleHandler.class);
+ private static final Logger LOG = LoggerFactory.getLogger(IdleHandler.class);
private boolean first = true;
/**
@@ -43,7 +43,7 @@ public void channelRead(final ChannelHandlerContext ctx, final Object msg) throw
@Override
protected void readTimedOut(final ChannelHandlerContext ctx) throws Exception {
if (first) {
- LOGGER.debug("Switch idle");
+ LOG.debug("Switch idle");
SwitchIdleEventBuilder builder = new SwitchIdleEventBuilder();
builder.setInfo("Switch idle");
ctx.fireChannelRead(builder.build());
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java
index 3a083eea..261beb9c 100644
--- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java
+++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java
@@ -23,27 +23,27 @@
*/
public class OFDatagramPacketDecoder extends SimpleChannelInboundHandler{
- private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketDecoder.class);
+ private static final Logger LOG = LoggerFactory.getLogger(OFDatagramPacketDecoder.class);
private DeserializationFactory deserializationFactory;
@Override
public void channelRead0(final ChannelHandlerContext ctx, final VersionMessageUdpWrapper msg)
throws Exception {
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("UdpVersionMessageWrapper received");
- LOGGER.debug("<< {}", ByteBufUtils.byteBufToHexString(msg.getMessageBuffer()));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("UdpVersionMessageWrapper received");
+ LOG.debug("<< {}", ByteBufUtils.byteBufToHexString(msg.getMessageBuffer()));
}
try {
final DataObject dataObject = deserializationFactory.deserialize(msg.getMessageBuffer(),msg.getVersion());
if (dataObject == null) {
- LOGGER.warn("Translated POJO is null");
+ LOG.warn("Translated POJO is null");
} else {
MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.getAddress());
consumer.consume(dataObject);
}
} catch(Exception e) {
- LOGGER.warn("Message deserialization failed", e);
+ LOG.warn("Message deserialization failed", e);
// TODO: delegate exception to allow easier deserialization
// debugging / deserialization problem awareness
} finally {
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java
index 73a7a00e..8b1faef3 100644
--- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java
+++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java
@@ -28,19 +28,19 @@
*/
public class OFDatagramPacketEncoder extends MessageToMessageEncoder {
- private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketEncoder.class);
+ private static final Logger LOG = LoggerFactory.getLogger(OFDatagramPacketEncoder.class);
private SerializationFactory serializationFactory;
@Override
protected void encode(ChannelHandlerContext ctx,
UdpMessageListenerWrapper wrapper, List