Default experimenters moved to separate bundle + unit tests 42/6742/5
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Wed, 30 Apr 2014 15:56:11 +0000 (17:56 +0200)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Fri, 4 Jul 2014 08:48:47 +0000 (10:48 +0200)
(ConfigSubsystem migration will be added later)

Change-Id: Ia6477919fa56347d1e28fd329949b2fb4b852b55
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
60 files changed:
openflow-protocol-api/src/main/yang/openflow-augments.yang
openflow-protocol-ext/pom.xml [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/DefaultExperimenterDeserializerInitializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DefaultExperimenterDeserializerInitializer.java with 55% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10StatsReplyVendorDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorActionDeserializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/experimenters/ExperimenterActionDeserializer.java with 80% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorMessageDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterActionDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterErrorMessageDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterInstructionDeserializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/experimenters/OF13ExperimenterInstructionDeserializer.java with 81% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterMessageDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13MultipartReplyExperimenterDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13QueueGetConfigReplyExperimenterDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13TableFeaturesExperimenterDeserializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/DefaultExperimenterInitializer.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10StatsRequestVendorSerializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF10StatsRequestVendorSerializer.java with 57% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorActionSerializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF10VendorActionSerializer.java with 79% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorInputMessageFactory.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF10VendorInputMessageFactory.java with 65% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterActionSerializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF13ExperimenterActionSerializer.java with 77% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInputMessageFactory.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF13ExperimenterInputMessageFactory.java with 63% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInstructionSerializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF13ExperimenterInstructionSerializer.java with 78% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MeterBandExperimenterSerializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF13MeterBandExperimenterSerializer.java with 57% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MultipartExperimenterSerializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF13MultipartExperimenterSerializer.java with 56% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13TableFeatExpSerializer.java [moved from openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/experimenters/OF13TableFeatExpSerializer.java with 63% similarity]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/util/ExtBufferUtils.java [new file with mode: 0644]
openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/util/ExtConstants.java [new file with mode: 0644]
openflow-protocol-ext/src/main/resources/log4j.xml [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10StatsReplyVendorDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorActionDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorMessageDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterActionDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterErrorMessageDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterInstructionDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterMessageDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13MultipartReplyExperimenterDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13QueueGetConfigReplyExperimenterDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13TableFeaturesExperimenterDeserializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10StatsRequestVendorSerializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorActionSerializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorInputMessageFactoryTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterActionSerializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInputMessageFactoryTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInstructionSerializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MeterBandExperimenterSerializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MultipartExperimenterSerializerTest.java [new file with mode: 0644]
openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13TableFeatExpSerializerTest.java [new file with mode: 0644]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializerRegistryImpl.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ErrorMessageFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/QueueGetConfigReplyMessageFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/DefaultExperimenterInitializer.java [deleted file]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializerRegistryImpl.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/MeterModInputMessageFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/MultipartRequestInputFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10StatsRequestInputFactoryTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10VendorInputMessageFactoryTest.java [deleted file]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF13ExperimenterInputMessageFactoryTest.java [deleted file]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/multipart/TableFeaturesTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsSerializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13ActionsSerializerTest.java
pom.xml

index 4f274d4ccf6714dd0d84806f95e6fbd87e8049f9..ed6d01d15c23d1735544821bbeefd2fc2b110abd 100644 (file)
          leaf experimenter {\r
              type uint32;\r
          }\r
+         leaf data {\r
+             type binary; \r
+         }\r
      }\r
 \r
 }
\ No newline at end of file
diff --git a/openflow-protocol-ext/pom.xml b/openflow-protocol-ext/pom.xml
new file mode 100644 (file)
index 0000000..171aa3f
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.opendaylight.openflowjava</groupId>
+        <artifactId>openflow-protocol-parent</artifactId>
+        <version>0.5-SNAPSHOT</version>
+    </parent>
+    <groupId>org.opendaylight.openflowjava</groupId>
+    <artifactId>openflow-protocol-ext</artifactId>
+    <version>0.5-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Openflow Protocol Library - EXT</name>
+    <url>http://maven.apache.org</url>
+    <scm>
+        <url>https://wiki.opendaylight.org/view/Openflow_Protocol_Library:Main</url>
+        <tag>HEAD</tag>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>openflow-protocol-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>openflow-protocol-spi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-buffer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${slf4j.version}</version>
+        </dependency>
+    </dependencies>
+</project>
@@ -6,13 +6,11 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters.ExperimenterActionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters.OF13ExperimenterInstructionDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
 \r
@@ -29,14 +27,14 @@ public class DefaultExperimenterDeserializerInitializer {
     public static void registerDeserializers(DeserializerRegistry registry) {\r
         // register OF v1.0 default experimenter deserializers\r
         // - default action deserializer\r
-        registry.registerDeserializer(new MessageCodeKey(EncodeConstants.OF10_VERSION_ID,\r
-                EncodeConstants.EXPERIMENTER_VALUE, Action.class), new ExperimenterActionDeserializer());\r
+        registry.registerDeserializer(new MessageCodeKey(ExtConstants.OF10_VERSION_ID,\r
+                ExtConstants.EXPERIMENTER_VALUE, Action.class), new OF13ExperimenterActionDeserializer());\r
         // register OF v1.3 default experimenter deserializers\r
         // - default action deserializer\r
-        registry.registerDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,\r
-                EncodeConstants.EXPERIMENTER_VALUE, Action.class), new ExperimenterActionDeserializer());\r
+        registry.registerDeserializer(new MessageCodeKey(ExtConstants.OF13_VERSION_ID,\r
+                ExtConstants.EXPERIMENTER_VALUE, Action.class), new OF13ExperimenterActionDeserializer());\r
         // - default instruction deserializer\r
-        registry.registerDeserializer(new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,\r
-                EncodeConstants.EXPERIMENTER_VALUE, Instruction.class), new OF13ExperimenterInstructionDeserializer());\r
+        registry.registerDeserializer(new MessageCodeKey(ExtConstants.OF13_VERSION_ID,\r
+                ExtConstants.EXPERIMENTER_VALUE, Instruction.class), new OF13ExperimenterInstructionDeserializer());\r
     }\r
 }\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10StatsReplyVendorDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10StatsReplyVendorDeserializer.java
new file mode 100644 (file)
index 0000000..f244744
--- /dev/null
@@ -0,0 +1,35 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10StatsReplyVendorDeserializer implements OFDeserializer<MultipartReplyExperimenter> {\r
+\r
+    @Override\r
+    public MultipartReplyExperimenter deserialize(ByteBuf message) {\r
+        MultipartReplyExperimenterBuilder builder = new MultipartReplyExperimenterBuilder();\r
+        builder.setExperimenter(message.readUnsignedInt());\r
+        if (message.readableBytes() > 0) {\r
+            byte[] data = new byte[message.readableBytes()];\r
+            message.readBytes(data);\r
+            builder.setData(data);\r
+        }\r
+        return builder.build();\r
+    }\r
+\r
+}\r
@@ -6,13 +6,13 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
@@ -23,15 +23,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
  * @author michal.polkorab\r
  *\r
  */\r
-public class ExperimenterActionDeserializer implements OFDeserializer<Action>,\r
+public class OF10VendorActionDeserializer implements OFDeserializer<Action>,\r
         HeaderDeserializer<Action> {\r
 \r
     @Override\r
     public Action deserializeHeader(ByteBuf input) {\r
         ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
         builder.setType(Experimenter.class);\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
         ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
         expBuilder.setExperimenter(input.readUnsignedInt());\r
         builder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
@@ -41,11 +41,11 @@ public class ExperimenterActionDeserializer implements OFDeserializer<Action>,
     @Override\r
     public Action deserialize(ByteBuf input) {\r
         ActionBuilder builder = new ActionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
         builder.setType(Experimenter.class);\r
         int length = input.readUnsignedShort();\r
         // subtract experimenter header length\r
-        length -= EncodeConstants.EXPERIMENTER_IDS_LENGTH;\r
+        length -= ExtConstants.EXPERIMENTER_IDS_LENGTH;\r
         ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
         expBuilder.setExperimenter(input.readUnsignedInt());\r
         if (length > 0) {\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorMessageDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorMessageDeserializer.java
new file mode 100644 (file)
index 0000000..493b35a
--- /dev/null
@@ -0,0 +1,38 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorMessageDeserializer implements OFDeserializer<ExperimenterMessage> {\r
+\r
+    @Override\r
+    public ExperimenterMessage deserialize(ByteBuf message) {\r
+        ExperimenterMessageBuilder builder = new ExperimenterMessageBuilder();\r
+        builder.setVersion((short) ExtConstants.OF10_VERSION_ID);\r
+        builder.setXid(message.readUnsignedInt());\r
+        builder.setExperimenter(message.readUnsignedInt());\r
+        if (message.readableBytes() > 0) {\r
+            byte[] data = new byte[message.readableBytes()];\r
+            message.readBytes(data);\r
+            builder.setData(data);\r
+        }\r
+        return builder.build();\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterActionDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterActionDeserializer.java
new file mode 100644 (file)
index 0000000..0da1c33
--- /dev/null
@@ -0,0 +1,60 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterActionDeserializer implements OFDeserializer<Action>,\r
+        HeaderDeserializer<Action> {\r
+\r
+    @Override\r
+    public Action deserializeHeader(ByteBuf input) {\r
+        ActionBuilder builder = new ActionBuilder();\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        builder.setType(Experimenter.class);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(input.readUnsignedInt());\r
+        builder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        return builder.build();\r
+    }\r
+\r
+    @Override\r
+    public Action deserialize(ByteBuf input) {\r
+        ActionBuilder builder = new ActionBuilder();\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        builder.setType(Experimenter.class);\r
+        int length = input.readUnsignedShort();\r
+        // subtract experimenter header length\r
+        length -= ExtConstants.EXPERIMENTER_IDS_LENGTH;\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(input.readUnsignedInt());\r
+        if (length > 0) {\r
+            byte[] data = new byte[length];\r
+            input.readBytes(data);\r
+            expBuilder.setData(data);\r
+        }\r
+        builder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        return builder.build();\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterErrorMessageDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterErrorMessageDeserializer.java
new file mode 100644 (file)
index 0000000..2239d11
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterError;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterErrorBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterErrorMessageDeserializer implements OFDeserializer<ExperimenterError> {\r
+\r
+    @Override\r
+    public ExperimenterError deserialize(ByteBuf message) {\r
+        ExperimenterErrorBuilder expBuilder = new ExperimenterErrorBuilder();\r
+        expBuilder.setExpType(message.readUnsignedShort());\r
+        expBuilder.setExperimenter(message.readUnsignedInt());\r
+        if (message.readableBytes() > 0) {\r
+            byte[] data = new byte[message.readableBytes()];\r
+            message.readBytes(data);\r
+            expBuilder.setData(data);\r
+        }\r
+        return expBuilder.build();\r
+    }\r
+\r
+}\r
@@ -6,13 +6,13 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.deserialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;\r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstructionBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
@@ -29,20 +29,21 @@ public class OF13ExperimenterInstructionDeserializer implements OFDeserializer<I
     @Override\r
     public Instruction deserializeHeader(ByteBuf input) {\r
         InstructionBuilder builder = new InstructionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
         builder.setType(Experimenter.class);\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
         ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
         expBuilder.setExperimenter(input.readUnsignedInt());\r
+        builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
         return builder.build();\r
     }\r
 \r
     @Override\r
     public Instruction deserialize(ByteBuf input) {\r
         InstructionBuilder builder = new InstructionBuilder();\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
         builder.setType(Experimenter.class);\r
-        input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r
+        input.skipBytes(ExtConstants.SIZE_OF_SHORT_IN_BYTES);\r
         ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
         expBuilder.setExperimenter(input.readUnsignedInt());\r
         if (input.readableBytes() > 0) {\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterMessageDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterMessageDeserializer.java
new file mode 100644 (file)
index 0000000..43b0356
--- /dev/null
@@ -0,0 +1,39 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterMessageDeserializer implements OFDeserializer<ExperimenterMessage> {\r
+\r
+    @Override\r
+    public ExperimenterMessage deserialize(ByteBuf message) {\r
+        ExperimenterMessageBuilder builder = new ExperimenterMessageBuilder();\r
+        builder.setVersion((short) ExtConstants.OF13_VERSION_ID);\r
+        builder.setXid(message.readUnsignedInt());\r
+        builder.setExperimenter(message.readUnsignedInt());\r
+        builder.setExpType(message.readUnsignedInt());\r
+        if (message.readableBytes() > 0) {\r
+            byte[] data = new byte[message.readableBytes()];\r
+            message.readBytes(data);\r
+            builder.setData(data);\r
+        }\r
+        return builder.build();\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13MultipartReplyExperimenterDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13MultipartReplyExperimenterDeserializer.java
new file mode 100644 (file)
index 0000000..138bb70
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartReplyExperimenterDeserializer implements OFDeserializer<MultipartReplyExperimenter> {\r
+\r
+    @Override\r
+    public MultipartReplyExperimenter deserialize(ByteBuf message) {\r
+        MultipartReplyExperimenterBuilder builder = new MultipartReplyExperimenterBuilder();\r
+        builder.setExperimenter(message.readUnsignedInt());\r
+        builder.setExpType(message.readUnsignedInt());\r
+        if (message.readableBytes() > 0) {\r
+            byte[] data = new byte[message.readableBytes()];\r
+            message.readBytes(data);\r
+            builder.setData(data);\r
+        }\r
+        return builder.build();\r
+    }\r
+\r
+}
\ No newline at end of file
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13QueueGetConfigReplyExperimenterDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13QueueGetConfigReplyExperimenterDeserializer.java
new file mode 100644 (file)
index 0000000..87bcff0
--- /dev/null
@@ -0,0 +1,53 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueuePropertyBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13QueueGetConfigReplyExperimenterDeserializer \r
+        implements OFDeserializer<QueueProperty> {\r
+\r
+    private static final int PADDING_IN_QUEUE_PROPERTY_HEADER = 4;\r
+    private static final int PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY = 4;\r
+\r
+    @Override\r
+    public QueueProperty deserialize(ByteBuf input) {\r
+        QueuePropertyBuilder builder = new QueuePropertyBuilder();\r
+        QueueProperties property = QueueProperties.forValue(input.readUnsignedShort());\r
+        builder.setProperty(property);\r
+        int length = input.readUnsignedShort();\r
+        input.skipBytes(PADDING_IN_QUEUE_PROPERTY_HEADER);\r
+        ExperimenterQueuePropertyBuilder expBuilder = new ExperimenterQueuePropertyBuilder();\r
+        expBuilder.setExperimenter(input.readUnsignedInt());\r
+        input.skipBytes(PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY);\r
+        // extract experimenter_data length\r
+        length = length - 2 * ExtConstants.SIZE_OF_SHORT_IN_BYTES - PADDING_IN_QUEUE_PROPERTY_HEADER\r
+                - ExtConstants.SIZE_OF_INT_IN_BYTES - PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY;\r
+        if (length > 0) {\r
+            byte[] data = new byte[length];\r
+            input.readBytes(data);\r
+            expBuilder.setData(data);\r
+        }\r
+        builder.addAugmentation(ExperimenterQueueProperty.class, expBuilder.build());\r
+        return builder.build();\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13TableFeaturesExperimenterDeserializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13TableFeaturesExperimenterDeserializer.java
new file mode 100644 (file)
index 0000000..ef9a811
--- /dev/null
@@ -0,0 +1,49 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13TableFeaturesExperimenterDeserializer\r
+        implements OFDeserializer<TableFeatureProperties>{\r
+\r
+    @Override\r
+    public TableFeatureProperties deserialize(ByteBuf input) {\r
+        TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+        TableFeaturesPropType type = TableFeaturesPropType.forValue(input.readUnsignedShort());\r
+        builder.setType(type);\r
+        int length = input.readUnsignedShort();\r
+        ExperimenterRelatedTableFeaturePropertyBuilder expBuilder =\r
+                new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+        expBuilder.setExperimenter(input.readUnsignedInt());\r
+        expBuilder.setExpType(input.readUnsignedInt());\r
+        // extract experimenter_data length\r
+        length = length - 2 * ExtConstants.SIZE_OF_SHORT_IN_BYTES - 2 * ExtConstants.SIZE_OF_INT_IN_BYTES;\r
+        if (length > 0) {\r
+            byte[] data = new byte[length];\r
+            input.readBytes(data);\r
+            expBuilder.setData(data);\r
+        }\r
+        builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());\r
+        return builder.build();\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/DefaultExperimenterInitializer.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/serialization/DefaultExperimenterInitializer.java
new file mode 100644 (file)
index 0000000..a3509fa
--- /dev/null
@@ -0,0 +1,68 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.EnhancedMessageTypeKey;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class DefaultExperimenterInitializer {\r
+\r
+    /**\r
+     * Registers message serializers into provided registry\r
+     * @param registry registry to be initialized with message serializers\r
+     */\r
+    public static void registerDefaultExperimenterSerializers(SerializerRegistry registry) {\r
+        // register OF v1.0 default experimenter serializers\r
+        short version = ExtConstants.OF10_VERSION_ID;\r
+        // - default vendor (experimenter) message serializer\r
+        registry.registerSerializer(new MessageTypeKey<>(version, ExperimenterInput.class),\r
+                new OF10VendorInputMessageFactory());\r
+        // - default vendor (experimenter) action serializer\r
+        registry.registerSerializer(new EnhancedMessageTypeKey<>(version, Action.class,\r
+                Experimenter.class), new OF10VendorActionSerializer());\r
+        // - default vendor stats (experimenter multipart) serializer\r
+        registry.registerSerializer(new MessageTypeKey<>(version, MultipartRequestExperimenter.class),\r
+                new OF10StatsRequestVendorSerializer());\r
+\r
+        // register OF v1.3 default experimenter serializers\r
+        version = ExtConstants.OF13_VERSION_ID;\r
+        // - default experimenter message serializer\r
+        registry.registerSerializer(new MessageTypeKey<>(version, ExperimenterInput.class),\r
+                new OF13ExperimenterInputMessageFactory());\r
+        // - default experimenter action serializer\r
+        registry.registerSerializer(new EnhancedMessageTypeKey<>(version, Action.class,\r
+                Experimenter.class), new OF13ExperimenterActionSerializer());\r
+        // - default vendor stats (experimenter multipart) serializer\r
+        registry.registerSerializer(new MessageTypeKey<>(version, MultipartRequestExperimenter.class),\r
+                new OF13MultipartExperimenterSerializer());\r
+        // - default experimenter instruction serializer\r
+        registry.registerSerializer(new EnhancedMessageTypeKey<>(version, Instruction.class,\r
+                org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common\r
+                .instruction.rev130731.Experimenter.class), new OF13ExperimenterInstructionSerializer());\r
+        // - default experimenter message serializer\r
+        registry.registerSerializer(new MessageTypeKey<>(version, TableFeatureProperties.class),\r
+                new OF13TableFeatExpSerializer());\r
+        // - default experimenter message serializer\r
+        registry.registerSerializer(new MessageTypeKey<>(version, MeterBandExperimenter.class),\r
+                new OF13MeterBandExperimenterSerializer());\r
+    }\r
+}\r
@@ -1,18 +1,22 @@
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
 \r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
 public class OF10StatsRequestVendorSerializer implements OFSerializer<MultipartRequestExperimenter>{\r
 \r
-       @Override\r
-       public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
-               outBuffer.writeInt(input.getExperimenter().intValue());\r
+    @Override\r
+    public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
+        outBuffer.writeInt(input.getExperimenter().intValue());\r
         if (input.getData() != null) {\r
-               outBuffer.writeBytes(input.getData());\r
+            outBuffer.writeBytes(input.getData());\r
         }\r
-       }\r
+    }\r
 \r
 }\r
@@ -6,23 +6,27 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
 \r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
 public class OF10VendorActionSerializer implements OFSerializer<Action> {\r
 \r
     @Override\r
     public void serialize(Action action, ByteBuf outBuffer) {\r
         int startIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
+        outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
         int lengthIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+        outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
         ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
         outBuffer.writeInt(experimenter.getExperimenter().intValue());\r
         byte[] data = experimenter.getData();\r
@@ -6,13 +6,13 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
 \r
 /**\r
@@ -22,16 +22,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 public class OF10VendorInputMessageFactory implements OFSerializer<ExperimenterInput> {\r
 \r
     private static final byte MESSAGE_TYPE = 4;\r
-    \r
-       @Override\r
-       public void serialize(ExperimenterInput input, ByteBuf outBuffer) {\r
-               ByteBufUtils.writeOFHeader(MESSAGE_TYPE, input, outBuffer, EncodeConstants.EMPTY_LENGTH);\r
+\r
+    @Override\r
+    public void serialize(ExperimenterInput input, ByteBuf outBuffer) {\r
+        ExtBufferUtils.writeOFHeader(MESSAGE_TYPE, input, outBuffer, ExtConstants.EMPTY_LENGTH);\r
         outBuffer.writeInt(input.getExperimenter().intValue());\r
         byte[] data = input.getData();\r
         if (data != null) {\r
             outBuffer.writeBytes(data);\r
         }\r
-        ByteBufUtils.updateOFHeaderLength(outBuffer);\r
-       }\r
-    \r
+        ExtBufferUtils.updateOFHeaderLength(outBuffer);\r
+    }\r
+\r
 }
\ No newline at end of file
@@ -6,25 +6,29 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
 \r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
 public class OF13ExperimenterActionSerializer implements OFSerializer<Action>,\r
         HeaderSerializer<Action> {\r
 \r
     @Override\r
     public void serialize(Action action, ByteBuf outBuffer) {\r
         int actionStartIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
+        outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
         int actionLengthIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+        outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
         ExperimenterAction expAction = action.getAugmentation(ExperimenterAction.class);\r
         outBuffer.writeInt(expAction.getExperimenter().intValue());\r
         if (expAction.getData() != null) {\r
@@ -35,8 +39,8 @@ public class OF13ExperimenterActionSerializer implements OFSerializer<Action>,
 \r
     @Override\r
     public void serializeHeader(Action action, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
-        outBuffer.writeShort(EncodeConstants.EXPERIMENTER_IDS_LENGTH);\r
+        outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        outBuffer.writeShort(ExtConstants.EXPERIMENTER_IDS_LENGTH);\r
         ExperimenterAction expAction = action.getAugmentation(ExperimenterAction.class);\r
         outBuffer.writeInt(expAction.getExperimenter().intValue());\r
     }\r
@@ -6,13 +6,13 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
 \r
 /**\r
@@ -24,17 +24,17 @@ public class OF13ExperimenterInputMessageFactory implements OFSerializer<Experim
 \r
     /** Code type of Experimenter message */\r
     public static final byte MESSAGE_TYPE = 4;\r
-    \r
-       @Override\r
-       public void serialize(ExperimenterInput message, ByteBuf outBuffer) {\r
-               ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH);\r
-               outBuffer.writeInt(message.getExperimenter().intValue());\r
+\r
+    @Override\r
+    public void serialize(ExperimenterInput message, ByteBuf outBuffer) {\r
+        ExtBufferUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, ExtConstants.EMPTY_LENGTH);\r
+        outBuffer.writeInt(message.getExperimenter().intValue());\r
         outBuffer.writeInt(message.getExpType().intValue());\r
         byte[] data = message.getData();\r
         if (data != null) {\r
             outBuffer.writeBytes(data);\r
         }\r
-        ByteBufUtils.updateOFHeaderLength(outBuffer);\r
-       }\r
-    \r
+        ExtBufferUtils.updateOFHeaderLength(outBuffer);\r
+    }\r
+\r
 }
\ No newline at end of file
@@ -6,13 +6,13 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;\r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
 \r
@@ -25,8 +25,8 @@ public class OF13ExperimenterInstructionSerializer implements OFSerializer<Instr
 \r
     @Override\r
     public void serializeHeader(Instruction instruction, ByteBuf outBuffer) {\r
-        outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
-        outBuffer.writeShort(EncodeConstants.EXPERIMENTER_IDS_LENGTH);\r
+        outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        outBuffer.writeShort(ExtConstants.EXPERIMENTER_IDS_LENGTH);\r
         outBuffer.writeInt(instruction\r
                 .getAugmentation(ExperimenterInstruction.class).getExperimenter().intValue());\r
     }\r
@@ -34,9 +34,9 @@ public class OF13ExperimenterInstructionSerializer implements OFSerializer<Instr
     @Override\r
     public void serialize(Instruction instruction, ByteBuf outBuffer) {\r
         int startIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);\r
+        outBuffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
         int lengthIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+        outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
         ExperimenterInstruction experimenter =\r
                 instruction.getAugmentation(ExperimenterInstruction.class);\r
         outBuffer.writeInt(experimenter.getExperimenter().intValue());\r
@@ -6,28 +6,31 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
 \r
-public class OF13MeterBandExperimenterSerializer\r
-               implements OFSerializer<MeterBandExperimenter> {\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MeterBandExperimenterSerializer implements OFSerializer<MeterBandExperimenter> {\r
 \r
-       @Override\r
-       public void serialize(MeterBandExperimenter meterBand, ByteBuf outBuffer) {\r
-               int startIndex = outBuffer.writerIndex();\r
-               outBuffer.writeShort(meterBand.getType().getIntValue());\r
-               int lengthIndex = outBuffer.writerIndex();\r
-        outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+    @Override\r
+    public void serialize(MeterBandExperimenter meterBand, ByteBuf outBuffer) {\r
+        int startIndex = outBuffer.writerIndex();\r
+        outBuffer.writeShort(meterBand.getType().getIntValue());\r
+        int lengthIndex = outBuffer.writerIndex();\r
+        outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
         outBuffer.writeInt(meterBand.getRate().intValue());\r
         outBuffer.writeInt(meterBand.getBurstSize().intValue());\r
         outBuffer.writeInt(meterBand.getExperimenter().intValue());\r
         if (meterBand.getData() != null) {\r
-               outBuffer.writeBytes(meterBand.getData());\r
+            outBuffer.writeBytes(meterBand.getData());\r
         }\r
         outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);\r
        }\r
@@ -6,23 +6,26 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
 \r
-public class OF13MultipartExperimenterSerializer \r
-               implements OFSerializer<MultipartRequestExperimenter> {\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartExperimenterSerializer implements OFSerializer<MultipartRequestExperimenter> {\r
 \r
-       @Override\r
-       public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
-               outBuffer.writeInt(input.getExperimenter().intValue());\r
-               outBuffer.writeInt(input.getExpType().intValue());\r
+    @Override\r
+    public void serialize(MultipartRequestExperimenter input, ByteBuf outBuffer) {\r
+        outBuffer.writeInt(input.getExperimenter().intValue());\r
+        outBuffer.writeInt(input.getExpType().intValue());\r
         if (input.getData() != null) {\r
-               outBuffer.writeBytes(input.getData());\r
+            outBuffer.writeBytes(input.getData());\r
         }\r
-       }\r
+    }\r
 \r
 }\r
@@ -6,32 +6,36 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
  */\r
 \r
-package org.opendaylight.openflowjava.protocol.impl.serialization.experimenters;\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.util.ByteBufUtils;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
 \r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
 public class OF13TableFeatExpSerializer implements OFSerializer<TableFeatureProperties> {\r
 \r
     private static final int EXPERIMENTER_CODE = 65534; // 0xFFFE\r
     private static final int EXPERIMENTER_MISS_CODE = 65535; // 0xFFFF\r
     \r
-       @Override\r
-       public void serialize(TableFeatureProperties property, ByteBuf outBuffer) {\r
-               int startIndex = outBuffer.writerIndex();\r
-               if (property.getType().equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)) {\r
-                       outBuffer.writeShort(EXPERIMENTER_CODE);\r
-               } else {\r
-                       outBuffer.writeShort(EXPERIMENTER_MISS_CODE);\r
-               }\r
-               int lengthIndex = outBuffer.writerIndex();\r
-               outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);\r
+    @Override\r
+    public void serialize(TableFeatureProperties property, ByteBuf outBuffer) {\r
+        int startIndex = outBuffer.writerIndex();\r
+        if (property.getType().equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)) {\r
+            outBuffer.writeShort(EXPERIMENTER_CODE);\r
+        } else {\r
+            outBuffer.writeShort(EXPERIMENTER_MISS_CODE);\r
+        }\r
+        int lengthIndex = outBuffer.writerIndex();\r
+        outBuffer.writeShort(ExtConstants.EMPTY_LENGTH);\r
         ExperimenterRelatedTableFeatureProperty exp = property.\r
                 getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
         outBuffer.writeInt(exp.getExperimenter().intValue());\r
@@ -40,12 +44,12 @@ public class OF13TableFeatExpSerializer implements OFSerializer<TableFeatureProp
         if (data != null) {\r
             outBuffer.writeBytes(data);\r
         }\r
-        int paddingRemainder = (outBuffer.writerIndex() - startIndex) % EncodeConstants.PADDING;\r
+        int paddingRemainder = (outBuffer.writerIndex() - startIndex) % ExtConstants.PADDING;\r
         if (paddingRemainder != 0) {\r
-               int padding = EncodeConstants.PADDING - paddingRemainder;\r
-            ByteBufUtils.padBuffer(padding, outBuffer);\r
+            int padding = ExtConstants.PADDING - paddingRemainder;\r
+            ExtBufferUtils.padBuffer(padding, outBuffer);\r
         }\r
         outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);\r
-       }\r
+    }\r
 \r
 }\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/util/ExtBufferUtils.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/util/ExtBufferUtils.java
new file mode 100644 (file)
index 0000000..1bae5d9
--- /dev/null
@@ -0,0 +1,53 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.util;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExtBufferUtils {\r
+\r
+    /**\r
+     * Create OF header\r
+     * @param msgType message code\r
+     * @param message POJO\r
+     * @param out writing buffer\r
+     * @param length ofheader length\r
+     */\r
+    public static <E extends OfHeader> void writeOFHeader(byte msgType, E message, ByteBuf out, int length) { \r
+        out.writeByte(message.getVersion());\r
+        out.writeByte(msgType);\r
+        out.writeShort(length);\r
+        out.writeInt(message.getXid().intValue());\r
+    }\r
+\r
+    /**\r
+     * Write length standard OF header\r
+     * @param out writing buffer\r
+     */\r
+    public static void updateOFHeaderLength(ByteBuf out) { \r
+        out.setShort(ExtConstants.OFHEADER_LENGTH_INDEX, out.readableBytes());\r
+    }\r
+\r
+    /**\r
+     * Fills specified ByteBuf with 0 (zeros) of desired length, used for padding\r
+     * @param length\r
+     * @param out ByteBuf to be padded\r
+     */\r
+    public static void padBuffer(int length, ByteBuf out) {\r
+        for (int i = 0; i < length; i++) {\r
+            out.writeByte(0);\r
+        }\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/util/ExtConstants.java b/openflow-protocol-ext/src/main/java/org/opendaylight/openflowjava/protocol/ext/util/ExtConstants.java
new file mode 100644 (file)
index 0000000..80c384f
--- /dev/null
@@ -0,0 +1,43 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.util;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExtConstants {\r
+\r
+    /** Default OF padding (in bytes) */\r
+    public static final byte PADDING = 8;\r
+    /** OpenFlow v1.0 wire protocol number */\r
+    public static final byte OF10_VERSION_ID = 0x01;\r
+    /** OpenFlow v1.0 wire protocol number */\r
+    public static final byte OF13_VERSION_ID = 0x04;\r
+    /** Index of length in Openflow header */\r
+    public static final int OFHEADER_LENGTH_INDEX = 2;\r
+    /** Zero length - used when the length is updated later */\r
+    public static final int EMPTY_LENGTH = 0;\r
+\r
+    /** Length of long in bytes */\r
+    public static final byte SIZE_OF_LONG_IN_BYTES = Long.SIZE / Byte.SIZE;\r
+    /** Length of int in bytes */\r
+    public static final byte SIZE_OF_INT_IN_BYTES = Integer.SIZE / Byte.SIZE;\r
+    /** Length of short in bytes */\r
+    public static final byte SIZE_OF_SHORT_IN_BYTES = Short.SIZE / Byte.SIZE;\r
+    /** Length of byte in bytes */\r
+    public static final byte SIZE_OF_BYTE_IN_BYTES = Byte.SIZE / Byte.SIZE;\r
+    /** Length of 3 bytes */\r
+    public static final byte SIZE_OF_3_BYTES = 3;\r
+\r
+    /** Common experimenter value */\r
+    public static final int EXPERIMENTER_VALUE = 0xFFFF;\r
+    /** OF v1.3 lenght of experimenter_ids - see Multipart TableFeatures (properties) message */\r
+    public static final byte EXPERIMENTER_IDS_LENGTH = 8;\r
+}\r
diff --git a/openflow-protocol-ext/src/main/resources/log4j.xml b/openflow-protocol-ext/src/main/resources/log4j.xml
new file mode 100644 (file)
index 0000000..a51c5b5
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">\r
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">\r
+\r
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">\r
+        <layout class="org.apache.log4j.PatternLayout">\r
+            <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />\r
+        </layout>\r
+    </appender>\r
+\r
+    <logger name="org.opendaylight.openflowjava.protocol.ext" additivity="false">\r
+        <level value="DEBUG" />\r
+        <appender-ref ref="console" />\r
+    </logger>\r
+\r
+    <root>\r
+        <priority value="INFO" />\r
+        <appender-ref ref="console" />\r
+    </root>\r
+</log4j:configuration>\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10StatsReplyVendorDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10StatsReplyVendorDeserializerTest.java
new file mode 100644 (file)
index 0000000..8979b7d
--- /dev/null
@@ -0,0 +1,59 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10StatsReplyVendorDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF10StatsReplyVendorDeserializer} for correct translation into POJO\r
+     * @throws Exception\r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(42);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 3, 2, 1, 0};\r
+        buffer.writeBytes(data);\r
+\r
+        OF10StatsReplyVendorDeserializer deserializer =\r
+                new OF10StatsReplyVendorDeserializer();\r
+        MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 42, message.getExperimenter().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF10StatsReplyVendorDeserializer} for correct translation into POJO\r
+     * @throws Exception\r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(42);\r
+\r
+        OF10StatsReplyVendorDeserializer deserializer =\r
+                new OF10StatsReplyVendorDeserializer();\r
+        MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 42, message.getExperimenter().intValue());\r
+        Assert.assertNull("Unexpected data", message.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorActionDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorActionDeserializerTest.java
new file mode 100644 (file)
index 0000000..46f4a41
--- /dev/null
@@ -0,0 +1,114 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorActionDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(16);\r
+        buffer.writeInt(42);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+        buffer.writeBytes(data);\r
+\r
+        OF10VendorActionDeserializer deserializer =\r
+                new OF10VendorActionDeserializer();\r
+        Action action = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+\r
+        OF10VendorActionDeserializer deserializer =\r
+                new OF10VendorActionDeserializer();\r
+        Action action = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeader() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+\r
+        OF10VendorActionDeserializer deserializer =\r
+                new OF10VendorActionDeserializer();\r
+        Action action = deserializer.deserializeHeader(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeaderWithData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+        buffer.writeBytes(data);\r
+\r
+        OF10VendorActionDeserializer deserializer =\r
+                new OF10VendorActionDeserializer();\r
+        Action action = deserializer.deserializeHeader(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorMessageDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF10VendorMessageDeserializerTest.java
new file mode 100644 (file)
index 0000000..76514bd
--- /dev/null
@@ -0,0 +1,65 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorMessageDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF10VendorMessageDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(12345);\r
+        buffer.writeInt(98765);\r
+        byte[] data = new byte[]{5, 6, 7, 8};\r
+        buffer.writeBytes(data);\r
+\r
+        OF10VendorMessageDeserializer deserializer =\r
+                new OF10VendorMessageDeserializer();\r
+        ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong version", 1, message.getVersion().shortValue());\r
+        Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+        Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF10VendorMessageDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(12345);\r
+        buffer.writeInt(98765);\r
+\r
+        OF10VendorMessageDeserializer deserializer =\r
+                new OF10VendorMessageDeserializer();\r
+        ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong version", 1, message.getVersion().shortValue());\r
+        Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+        Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+        Assert.assertNull("Unexpected data", message.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterActionDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterActionDeserializerTest.java
new file mode 100644 (file)
index 0000000..4ea3bf3
--- /dev/null
@@ -0,0 +1,114 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterActionDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(16);\r
+        buffer.writeInt(42);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13ExperimenterActionDeserializer deserializer =\r
+                new OF13ExperimenterActionDeserializer();\r
+        Action action = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+\r
+        OF13ExperimenterActionDeserializer deserializer =\r
+                new OF13ExperimenterActionDeserializer();\r
+        Action action = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeader() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+\r
+        OF13ExperimenterActionDeserializer deserializer =\r
+                new OF13ExperimenterActionDeserializer();\r
+        Action action = deserializer.deserializeHeader(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeaderWithData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13ExperimenterActionDeserializer deserializer =\r
+                new OF13ExperimenterActionDeserializer();\r
+        Action action = deserializer.deserializeHeader(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, action.getType());\r
+        ExperimenterAction experimenter = action.getAugmentation(ExperimenterAction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterErrorMessageDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterErrorMessageDeserializerTest.java
new file mode 100644 (file)
index 0000000..e37f62e
--- /dev/null
@@ -0,0 +1,63 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterError;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterErrorMessageDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterErrorMessageDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(35000);\r
+        buffer.writeInt(70000);\r
+        byte[] data = new byte[]{5, 5, 5, 6, 7, 8, 9, 10};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13ExperimenterErrorMessageDeserializer deserializer =\r
+                new OF13ExperimenterErrorMessageDeserializer();\r
+        ExperimenterError message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong exp-type", 35000, message.getExpType().intValue());\r
+        Assert.assertEquals("Wrong experimenter", 70000, message.getExperimenter().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterErrorMessageDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(35000);\r
+        buffer.writeInt(70000);\r
+\r
+        OF13ExperimenterErrorMessageDeserializer deserializer =\r
+                new OF13ExperimenterErrorMessageDeserializer();\r
+        ExperimenterError message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong exp-type", 35000, message.getExpType().intValue());\r
+        Assert.assertEquals("Wrong experimenter", 70000, message.getExperimenter().intValue());\r
+        Assert.assertNull("Unexpected data", message.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterInstructionDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterInstructionDeserializerTest.java
new file mode 100644 (file)
index 0000000..bd9f8db
--- /dev/null
@@ -0,0 +1,114 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterInstructionDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13ExperimenterInstructionDeserializer deserializer =\r
+                new OF13ExperimenterInstructionDeserializer();\r
+        Instruction instruction = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+        ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+\r
+        OF13ExperimenterInstructionDeserializer deserializer =\r
+                new OF13ExperimenterInstructionDeserializer();\r
+        Instruction instruction = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+        ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeader() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+\r
+        OF13ExperimenterInstructionDeserializer deserializer =\r
+                new OF13ExperimenterInstructionDeserializer();\r
+        Instruction instruction = deserializer.deserializeHeader(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+        ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeaderWithData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(8);\r
+        buffer.writeInt(42);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 0, 0, 0};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13ExperimenterInstructionDeserializer deserializer =\r
+                new OF13ExperimenterInstructionDeserializer();\r
+        Instruction instruction = deserializer.deserializeHeader(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", Experimenter.class, instruction.getType());\r
+        ExperimenterInstruction experimenter = instruction.getAugmentation(ExperimenterInstruction.class);\r
+        Assert.assertEquals("Wrong experimenter", 42, experimenter.getExperimenter().intValue());\r
+        Assert.assertNull("Data not null", experimenter.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterMessageDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13ExperimenterMessageDeserializerTest.java
new file mode 100644 (file)
index 0000000..f5cc961
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterMessageDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterMessageDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(12345);\r
+        buffer.writeInt(98765);\r
+        buffer.writeInt(89123);\r
+        byte[] data = new byte[]{5, 6, 7, 8};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13ExperimenterMessageDeserializer deserializer =\r
+                new OF13ExperimenterMessageDeserializer();\r
+        ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong version", 4, message.getVersion().shortValue());\r
+        Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+        Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 89123, message.getExpType().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterMessageDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(12345);\r
+        buffer.writeInt(98765);\r
+        buffer.writeInt(89123);\r
+\r
+        OF13ExperimenterMessageDeserializer deserializer =\r
+                new OF13ExperimenterMessageDeserializer();\r
+        ExperimenterMessage message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong version", 4, message.getVersion().shortValue());\r
+        Assert.assertEquals("Wrong XID", 12345, message.getXid().intValue());\r
+        Assert.assertEquals("Wrong experimenter", 98765, message.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 89123, message.getExpType().intValue());\r
+        Assert.assertNull("Unexpected data", message.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13MultipartReplyExperimenterDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13MultipartReplyExperimenterDeserializerTest.java
new file mode 100644 (file)
index 0000000..ad36b54
--- /dev/null
@@ -0,0 +1,63 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.experimenter._case.MultipartReplyExperimenter;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartReplyExperimenterDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13MultipartReplyExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(456654);\r
+        buffer.writeInt(888222);\r
+        byte[] data = new byte[]{0, 0, 1, 1, 2, 2, 3, 3};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13MultipartReplyExperimenterDeserializer deserializer =\r
+                new OF13MultipartReplyExperimenterDeserializer();\r
+        MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 456654, message.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 888222, message.getExpType().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, message.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13MultipartReplyExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeInt(456654);\r
+        buffer.writeInt(888222);\r
+\r
+        OF13MultipartReplyExperimenterDeserializer deserializer =\r
+                new OF13MultipartReplyExperimenterDeserializer();\r
+        MultipartReplyExperimenter message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 456654, message.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 888222, message.getExpType().intValue());\r
+        Assert.assertNull("Unexpected data", message.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13QueueGetConfigReplyExperimenterDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13QueueGetConfigReplyExperimenterDeserializerTest.java
new file mode 100644 (file)
index 0000000..b11d466
--- /dev/null
@@ -0,0 +1,75 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtBufferUtils;\r
+import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueueProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13QueueGetConfigReplyExperimenterDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13QueueGetConfigReplyExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(24);\r
+        ExtBufferUtils.padBuffer(4, buffer);\r
+        buffer.writeInt(128);\r
+        ExtBufferUtils.padBuffer(4, buffer);\r
+        byte[] data = new byte[]{0, 0, 1, 1, 2, 2, 3, 3};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13QueueGetConfigReplyExperimenterDeserializer deserializer =\r
+                new OF13QueueGetConfigReplyExperimenterDeserializer();\r
+        QueueProperty message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong property", QueueProperties.OFPQTEXPERIMENTER, message.getProperty());\r
+        ExperimenterQueueProperty exp = message.getAugmentation(ExperimenterQueueProperty.class);\r
+        Assert.assertEquals("Wrong experimenter", 128, exp.getExperimenter().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, exp.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13QueueGetConfigReplyExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(ExtConstants.EXPERIMENTER_VALUE);\r
+        buffer.writeShort(16);\r
+        ExtBufferUtils.padBuffer(4, buffer);\r
+        buffer.writeInt(128);\r
+        ExtBufferUtils.padBuffer(4, buffer);\r
+\r
+        OF13QueueGetConfigReplyExperimenterDeserializer deserializer =\r
+                new OF13QueueGetConfigReplyExperimenterDeserializer();\r
+        QueueProperty message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong property", QueueProperties.OFPQTEXPERIMENTER, message.getProperty());\r
+        ExperimenterQueueProperty exp = message.getAugmentation(ExperimenterQueueProperty.class);\r
+        Assert.assertEquals("Wrong experimenter", 128, exp.getExperimenter().intValue());\r
+        Assert.assertNull("Unexpected data", exp.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13TableFeaturesExperimenterDeserializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/deserialization/OF13TableFeaturesExperimenterDeserializerTest.java
new file mode 100644 (file)
index 0000000..600a36f
--- /dev/null
@@ -0,0 +1,125 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13TableFeaturesExperimenterDeserializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenter() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(65534);\r
+        buffer.writeShort(16);\r
+        buffer.writeInt(256);\r
+        buffer.writeInt(546);\r
+        byte[] data = new byte[]{1, 2, 3, 4};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13TableFeaturesExperimenterDeserializer deserializer =\r
+                new OF13TableFeaturesExperimenterDeserializer();\r
+        TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTER, message.getType());\r
+        ExperimenterRelatedTableFeatureProperty property =\r
+                message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+        Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, property.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenterWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(65534);\r
+        buffer.writeShort(12);\r
+        buffer.writeInt(256);\r
+        buffer.writeInt(546);\r
+\r
+        OF13TableFeaturesExperimenterDeserializer deserializer =\r
+                new OF13TableFeaturesExperimenterDeserializer();\r
+        TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTER, message.getType());\r
+        ExperimenterRelatedTableFeatureProperty property =\r
+                message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+        Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+        Assert.assertNull("Unexpected data", property.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenterMiss() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(65535);\r
+        buffer.writeShort(16);\r
+        buffer.writeInt(256);\r
+        buffer.writeInt(546);\r
+        byte[] data = new byte[]{1, 2, 3, 4};\r
+        buffer.writeBytes(data);\r
+\r
+        OF13TableFeaturesExperimenterDeserializer deserializer =\r
+                new OF13TableFeaturesExperimenterDeserializer();\r
+        TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS, message.getType());\r
+        ExperimenterRelatedTableFeatureProperty property =\r
+                message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+        Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+        Assert.assertArrayEquals("Wrong data", data, property.getData());\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeaturesExperimenterDeserializer} for correct translation into POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenterMissWithoutData() {\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        buffer.writeShort(65535);\r
+        buffer.writeShort(12);\r
+        buffer.writeInt(256);\r
+        buffer.writeInt(546);\r
+\r
+        OF13TableFeaturesExperimenterDeserializer deserializer =\r
+                new OF13TableFeaturesExperimenterDeserializer();\r
+        TableFeatureProperties message = deserializer.deserialize(buffer);\r
+\r
+        Assert.assertEquals("Wrong type", TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS, message.getType());\r
+        ExperimenterRelatedTableFeatureProperty property =\r
+                message.getAugmentation(ExperimenterRelatedTableFeatureProperty.class);\r
+        Assert.assertEquals("Wrong experimenter", 256, property.getExperimenter().intValue());\r
+        Assert.assertEquals("Wrong exp-type", 546, property.getExpType().intValue());\r
+        Assert.assertNull("Unexpected data", property.getData());\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10StatsRequestVendorSerializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10StatsRequestVendorSerializerTest.java
new file mode 100644 (file)
index 0000000..e5fd1f6
--- /dev/null
@@ -0,0 +1,65 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10StatsRequestVendorSerializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+        expBuilder.setExperimenter(42L);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};\r
+        expBuilder.setData(data);\r
+        MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10StatsRequestVendorSerializer serializer = new OF10StatsRequestVendorSerializer();\r
+        serializer.serialize(message, buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+        byte[] expData = new byte[8];\r
+        buffer.readBytes(expData);\r
+        Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+        expBuilder.setExperimenter(42L);\r
+        MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10StatsRequestVendorSerializer serializer = new OF10StatsRequestVendorSerializer();\r
+        serializer.serialize(message, buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorActionSerializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorActionSerializerTest.java
new file mode 100644 (file)
index 0000000..bdb06aa
--- /dev/null
@@ -0,0 +1,79 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorActionSerializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF10VendorActionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testVendorActionWithData() {\r
+        ActionBuilder actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Experimenter.class);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(82L);\r
+        byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
+        expBuilder.setData(expData);\r
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        Action action = actionBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10VendorActionSerializer serializer = new OF10VendorActionSerializer();\r
+        serializer.serialize(action, buffer);\r
+        \r
+        Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 82, buffer.readUnsignedInt());\r
+        byte[] tmp = new byte[8];\r
+        buffer.readBytes(tmp);\r
+        Assert.assertArrayEquals("Wrong data", expData, tmp);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF10VendorActionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testVendorActionWithoutData() {\r
+        ActionBuilder actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Experimenter.class);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(102L);\r
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        Action action = actionBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10VendorActionSerializer serializer = new OF10VendorActionSerializer();\r
+        serializer.serialize(action, buffer);\r
+\r
+        Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 102, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorInputMessageFactoryTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF10VendorInputMessageFactoryTest.java
new file mode 100644 (file)
index 0000000..2d9e82f
--- /dev/null
@@ -0,0 +1,77 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10VendorInputMessageFactoryTest {\r
+\r
+    /**\r
+     * Testing of {@link OF10VendorInputMessageFactory} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() throws Exception {\r
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+        builder.setVersion((short) 1);\r
+        builder.setXid(1024L);\r
+        builder.setExperimenter(0x0001020304L);\r
+        byte[] data = new byte[]{5, 6, 7, 8};\r
+        builder.setData(data);\r
+        ExperimenterInput message = builder.build();\r
+        \r
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+        vendorFactory.serialize(message, out);\r
+        \r
+        Assert.assertEquals("Wrong version", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong length", 16, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong xid", 1024, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+        byte[] expData = new byte[4];\r
+        out.readBytes(expData);\r
+        Assert.assertArrayEquals("Wrong data", data, expData);\r
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF10VendorInputMessageFactory} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() throws Exception {\r
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+        builder.setVersion((short) 1);\r
+        builder.setXid(1024L);\r
+        builder.setExperimenter(0x0001020304L);\r
+        ExperimenterInput message = builder.build();\r
+        \r
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+        vendorFactory.serialize(message, out);\r
+        \r
+        Assert.assertEquals("Wrong version", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong length", 12, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong xid", 1024, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+    }\r
+}
\ No newline at end of file
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterActionSerializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterActionSerializerTest.java
new file mode 100644 (file)
index 0000000..2eaf92b
--- /dev/null
@@ -0,0 +1,126 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterActionSerializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testVendorActionWithData() {\r
+        ActionBuilder actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Experimenter.class);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(82L);\r
+        byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
+        expBuilder.setData(expData);\r
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        Action action = actionBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+        serializer.serialize(action, buffer);\r
+        \r
+        Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 82, buffer.readUnsignedInt());\r
+        byte[] tmp = new byte[8];\r
+        buffer.readBytes(tmp);\r
+        Assert.assertArrayEquals("Wrong data", expData, tmp);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testVendorActionWithoutData() {\r
+        ActionBuilder actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Experimenter.class);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(102L);\r
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        Action action = actionBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+        serializer.serialize(action, buffer);\r
+\r
+        Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 102, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeaderWithData() {\r
+        ActionBuilder actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Experimenter.class);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(82L);\r
+        byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
+        expBuilder.setData(expData);\r
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        Action action = actionBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+        serializer.serializeHeader(action, buffer);\r
+        \r
+        Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 82, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterActionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeaderWithoutData() {\r
+        ActionBuilder actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Experimenter.class);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(102L);\r
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        Action action = actionBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterActionSerializer serializer = new OF13ExperimenterActionSerializer();\r
+        serializer.serializeHeader(action, buffer);\r
+\r
+        Assert.assertEquals("Wrong action type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 102, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInputMessageFactoryTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInputMessageFactoryTest.java
new file mode 100644 (file)
index 0000000..1a14b9d
--- /dev/null
@@ -0,0 +1,77 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterInputMessageFactoryTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInputMessageFactory} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() throws Exception {\r
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+        builder.setVersion((short) 4);\r
+        builder.setXid(888L);\r
+        builder.setExperimenter(0x0001020304L);\r
+        byte[] data = new byte[]{5, 6, 7, 8};\r
+        builder.setData(data);\r
+        ExperimenterInput message = builder.build();\r
+        \r
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+        vendorFactory.serialize(message, out);\r
+        \r
+        Assert.assertEquals("Wrong version", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong length", 16, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong xid", 888, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+        byte[] expData = new byte[4];\r
+        out.readBytes(expData);\r
+        Assert.assertArrayEquals("Wrong data", data, expData);\r
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInputMessageFactory} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() throws Exception {\r
+        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
+        builder.setVersion((short) 4);\r
+        builder.setXid(888L);\r
+        builder.setExperimenter(0x0001020304L);\r
+        ExperimenterInput message = builder.build();\r
+        \r
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10VendorInputMessageFactory vendorFactory = new OF10VendorInputMessageFactory();\r
+        vendorFactory.serialize(message, out);\r
+        \r
+        Assert.assertEquals("Wrong version", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong type", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong length", 12, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong xid", 888, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", out.readableBytes() == 0);\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInstructionSerializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13ExperimenterInstructionSerializerTest.java
new file mode 100644 (file)
index 0000000..177ef63
--- /dev/null
@@ -0,0 +1,126 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterInstructionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13ExperimenterInstructionSerializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        InstructionBuilder builder = new InstructionBuilder();\r
+        builder.setType(Experimenter.class);\r
+        ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+        expBuilder.setExperimenter(142L);\r
+        byte[] data = new byte[]{1, 2, 3, 4, 5, 6, 7, 8};\r
+        expBuilder.setData(data);\r
+        builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+        Instruction instruction = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+        serializer.serialize(instruction, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+        byte[] expData = new byte[8];\r
+        buffer.readBytes(expData);\r
+        Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        InstructionBuilder builder = new InstructionBuilder();\r
+        builder.setType(Experimenter.class);\r
+        ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+        expBuilder.setExperimenter(142L);\r
+        builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+        Instruction instruction = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+        serializer.serialize(instruction, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 8, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeader() {\r
+        InstructionBuilder builder = new InstructionBuilder();\r
+        builder.setType(Experimenter.class);\r
+        ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+        expBuilder.setExperimenter(142L);\r
+        byte[] data = new byte[]{1, 2, 3, 4, 5, 6, 7, 8};\r
+        expBuilder.setData(data);\r
+        builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+        Instruction instruction = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+        serializer.serializeHeader(instruction, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 8, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13ExperimenterInstructionSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testHeaderWithoutData() {\r
+        InstructionBuilder builder = new InstructionBuilder();\r
+        builder.setType(Experimenter.class);\r
+        ExperimenterInstructionBuilder expBuilder = new ExperimenterInstructionBuilder();\r
+        expBuilder.setExperimenter(142L);\r
+        builder.addAugmentation(ExperimenterInstruction.class, expBuilder.build());\r
+        Instruction instruction = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13ExperimenterInstructionSerializer serializer = new OF13ExperimenterInstructionSerializer();\r
+        serializer.serializeHeader(instruction, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 8, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 142, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MeterBandExperimenterSerializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MeterBandExperimenterSerializerTest.java
new file mode 100644 (file)
index 0000000..624a653
--- /dev/null
@@ -0,0 +1,51 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MeterBandExperimenterSerializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13MeterBandExperimenterSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        MeterBandExperimenterBuilder builder = new MeterBandExperimenterBuilder();\r
+        builder.setType(MeterBandType.OFPMBTEXPERIMENTER);\r
+        builder.setRate(128L);\r
+        builder.setBurstSize(256L);\r
+        builder.setExperimenter(512L);\r
+        MeterBandExperimenter band = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13MeterBandExperimenterSerializer serializer = new OF13MeterBandExperimenterSerializer();\r
+        serializer.serialize(band, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong type", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong type", 128, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong type", 256, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong type", 512, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MultipartExperimenterSerializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13MultipartExperimenterSerializerTest.java
new file mode 100644 (file)
index 0000000..216e5c7
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13MultipartExperimenterSerializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void test() {\r
+        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+        expBuilder.setExperimenter(42L);\r
+        expBuilder.setExpType(84L);\r
+        byte[] data = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};\r
+        expBuilder.setData(data);\r
+        MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13MultipartExperimenterSerializer serializer = new OF13MultipartExperimenterSerializer();\r
+        serializer.serialize(message, buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong exp-type", 84, buffer.readUnsignedInt());\r
+        byte[] expData = new byte[8];\r
+        buffer.readBytes(expData);\r
+        Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF10StatsRequestVendorSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testWithoutData() {\r
+        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
+        expBuilder.setExperimenter(42L);\r
+        expBuilder.setExpType(84L);\r
+        MultipartRequestExperimenter message = expBuilder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13MultipartExperimenterSerializer serializer = new OF13MultipartExperimenterSerializer();\r
+        serializer.serialize(message, buffer);\r
+\r
+        Assert.assertEquals("Wrong experimenter", 42, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong exp-type", 84, buffer.readUnsignedInt());\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+}\r
diff --git a/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13TableFeatExpSerializerTest.java b/openflow-protocol-ext/src/test/java/org/opendaylight/openflowjava/protocol/ext/serialization/OF13TableFeatExpSerializerTest.java
new file mode 100644 (file)
index 0000000..b6f89c5
--- /dev/null
@@ -0,0 +1,147 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.openflowjava.protocol.ext.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF13TableFeatExpSerializerTest {\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenter() {\r
+        TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+        builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
+        ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+                new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+        propBuilder.setExperimenter(891L);\r
+        propBuilder.setExpType(6546L);\r
+        byte[] data = new byte[]{0, 1, 2, 3};\r
+        propBuilder.setData(data);\r
+        builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+                propBuilder.build());\r
+        TableFeatureProperties property = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+        serializer.serialize(property, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65534, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 891, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong exp-type", 6546, buffer.readUnsignedInt());\r
+        byte[] expData = new byte[4];\r
+        buffer.readBytes(expData);\r
+        Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenterWithoutData() {\r
+        TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+        builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
+        ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+                new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+        propBuilder.setExperimenter(891L);\r
+        propBuilder.setExpType(6546L);\r
+        builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+                propBuilder.build());\r
+        TableFeatureProperties property = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+        serializer.serialize(property, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65534, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 891, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong exp-type", 6546, buffer.readUnsignedInt());\r
+        buffer.skipBytes(4);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenterMiss() {\r
+        TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+        builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
+        ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+                new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+        propBuilder.setExperimenter(8L);\r
+        propBuilder.setExpType(6L);\r
+        byte[] data = new byte[]{4, 5, 6, 7};\r
+        propBuilder.setData(data);\r
+        builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+                propBuilder.build());\r
+        TableFeatureProperties property = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+        serializer.serialize(property, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 8, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong exp-type", 6, buffer.readUnsignedInt());\r
+        byte[] expData = new byte[4];\r
+        buffer.readBytes(expData);\r
+        Assert.assertArrayEquals("Wrong experimenter data", data, expData);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+\r
+    /**\r
+     * Testing of {@link OF13TableFeatExpSerializer} for correct translation from POJO\r
+     * @throws Exception \r
+     */\r
+    @Test\r
+    public void testExperimenterMissWithoutData() {\r
+        TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();\r
+        builder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
+        ExperimenterRelatedTableFeaturePropertyBuilder propBuilder =\r
+                new ExperimenterRelatedTableFeaturePropertyBuilder();\r
+        propBuilder.setExperimenter(8L);\r
+        propBuilder.setExpType(6L);\r
+        builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class,\r
+                propBuilder.build());\r
+        TableFeatureProperties property = builder.build();\r
+\r
+        ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF13TableFeatExpSerializer serializer = new OF13TableFeatExpSerializer();\r
+        serializer.serialize(property, buffer);\r
+\r
+        Assert.assertEquals("Wrong type", 65535, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 16, buffer.readUnsignedShort());\r
+        Assert.assertEquals("Wrong experimenter", 8, buffer.readUnsignedInt());\r
+        Assert.assertEquals("Wrong exp-type", 6, buffer.readUnsignedInt());\r
+        buffer.skipBytes(4);\r
+        Assert.assertTrue("Unexpected data", buffer.readableBytes() == 0);\r
+    }\r
+}\r
index ff618542084b5853720a9b05630894c594114ac2..f7f8b6fba9682cefdfbfeb61aa712ce3947d8888 100644 (file)
@@ -50,8 +50,6 @@ public class DeserializerRegistryImpl implements DeserializerRegistry {
         ActionDeserializerInitializer.registerDeserializers(this);
         // register instruction deserializers
         InstructionDeserializerInitializer.registerDeserializers(this);
-        // register default experimenter deserializers
-        DefaultExperimenterDeserializerInitializer.registerDeserializers(this);
     }
 
     @Override
index 5a049c51e06485cddabeac96d615da3d4c3d880d..45b25abaae2017ec248cfa7178045b196261e331 100644 (file)
@@ -10,10 +10,12 @@ package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
 
 import io.netty.buffer.ByteBuf;
 
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterError;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterErrorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.BadActionCode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.BadInstructionCode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.BadMatchCode;
@@ -37,10 +39,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author michal.polkorab
  * @author timotej.kubas
  */
-public class ErrorMessageFactory implements OFDeserializer<ErrorMessage> {
+public class ErrorMessageFactory implements OFDeserializer<ErrorMessage>,
+        DeserializerRegistryInjector {
 
     private static final String UNKNOWN_CODE = "UNKNOWN_CODE";
     private static final String UNKNOWN_TYPE = "UNKNOWN_TYPE";
+    private DeserializerRegistry registry;
 
     @Override
     public ErrorMessage deserialize(ByteBuf rawMessage) {
@@ -49,10 +53,18 @@ public class ErrorMessageFactory implements OFDeserializer<ErrorMessage> {
         builder.setXid(rawMessage.readUnsignedInt());
         int type = rawMessage.readUnsignedShort();
         ErrorType errorType = ErrorType.forValue(type);
-        decodeType(builder, errorType, type);
-        decodeCode(rawMessage, builder, errorType);
-        if (rawMessage.readableBytes() > 0) {
-            builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array());
+        if (ErrorType.EXPERIMENTER.equals(errorType)) {
+            builder.setType(errorType.getIntValue());
+            OFDeserializer<ExperimenterError> deserializer = registry.getDeserializer(new MessageCodeKey(
+                    EncodeConstants.OF13_VERSION_ID, EncodeConstants.EXPERIMENTER_VALUE, ErrorMessage.class));
+            ExperimenterError error = deserializer.deserialize(rawMessage);
+            builder.addAugmentation(ExperimenterError.class, error);
+        } else {
+            decodeType(builder, errorType, type);
+            decodeCode(rawMessage, builder, errorType);
+            if (rawMessage.readableBytes() > 0) {
+                builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array());
+            }
         }
         return builder.build();
     }
@@ -212,12 +224,6 @@ public class ErrorMessageFactory implements OFDeserializer<ErrorMessage> {
                 }
                 break;
             }
-            case EXPERIMENTER:
-                ExperimenterErrorBuilder expBuilder = new ExperimenterErrorBuilder();
-                expBuilder.setExpType(code);
-                expBuilder.setExperimenter(rawMessage.readUnsignedInt());
-                builder.addAugmentation(ExperimenterError.class, expBuilder.build());
-                break;
             default:
                 setUnknownCode(builder, code);
                 break;
@@ -237,4 +243,9 @@ public class ErrorMessageFactory implements OFDeserializer<ErrorMessage> {
         builder.setCodeString(codeString);
     }
 
+    @Override
+    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+        this.registry = deserializerRegistry;
+    }
+
 }
index cf3e2d741cc0359473f9005424a6f578a8aef120..98192092cdb8497ef00ef2c5044b0c7f56d447e1 100644 (file)
@@ -26,8 +26,6 @@ import org.opendaylight.openflowjava.protocol.impl.util.ListDeserializer;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
@@ -432,14 +430,15 @@ public class MultipartReplyMessageFactory implements OFDeserializer<MultipartRep
                 builder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
             } else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER)
                     || type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS)) {
-                ExperimenterRelatedTableFeaturePropertyBuilder expBuilder = new ExperimenterRelatedTableFeaturePropertyBuilder();
-                expBuilder.setExperimenter(input.readUnsignedInt());
-                expBuilder.setExpType(input.readUnsignedInt());
-                OFDeserializer<ExperimenterRelatedTableFeatureProperty> propDeserializer = registry.getDeserializer(
+                // return index to property start, so that the experimenter properties are deserialized
+                // correctly - as whole ofp_table_feature_prop_experimenter property
+                input.readerIndex(input.readerIndex() - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+                OFDeserializer<TableFeatureProperties> propDeserializer = registry.getDeserializer(
                         new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,
-                                type.getIntValue(), ExperimenterRelatedTableFeatureProperty.class));
-                ExperimenterRelatedTableFeatureProperty expProp = propDeserializer.deserialize(input);
-                builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expProp);
+                                type.getIntValue(), TableFeatureProperties.class));
+                TableFeatureProperties expProp = propDeserializer.deserialize(input);
+                properties.add(expProp);
+                continue;
             }
             if (paddingRemainder != 0) {
                 input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
index 26110ec499f38d4c8e7da164548190563b4ad9f6..ab05b53c9acbc47bed3aee4aa12be78a171d88aa 100644 (file)
@@ -13,9 +13,11 @@ import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey;
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterQueuePropertyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.RateQueueProperty;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.RateQueuePropertyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
@@ -33,14 +35,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author timotej.kubas
  * @author michal.polkorab
  */
-public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueueConfigOutput> {
+public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueueConfigOutput>,
+        DeserializerRegistryInjector {
 
     private static final byte PADDING_IN_QUEUE_GET_CONFIG_REPLY_HEADER = 4;
     private static final byte PADDING_IN_PACKET_QUEUE_HEADER = 6;
     private static final byte PADDING_IN_QUEUE_PROPERTY_HEADER = 4;
     private static final int PADDING_IN_RATE_QUEUE_PROPERTY = 6;
-    private static final int PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY = 4;
     private static final byte PACKET_QUEUE_LENGTH = 16;
+    private static final byte QUEUE_PROP_HEADER_SIZE = 8;
+    private DeserializerRegistry registry;
 
     @Override
     public GetQueueConfigOutput deserialize(ByteBuf rawMessage) {
@@ -53,7 +57,7 @@ public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueu
         return builder.build();
     }
     
-    private static List<Queues> createQueuesList(ByteBuf input){
+    private List<Queues> createQueuesList(ByteBuf input){
         List<Queues> queuesList = new ArrayList<>();
         while (input.readableBytes() > 0) {
             QueuesBuilder queueBuilder = new QueuesBuilder();
@@ -67,7 +71,7 @@ public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueu
         return queuesList;
     }
     
-    private static List<QueueProperty> createPropertiesList(ByteBuf input, int length){
+    private List<QueueProperty> createPropertiesList(ByteBuf input, int length){
         int propertiesLength = length;
         List<QueueProperty> propertiesList = new ArrayList<>();
         while (propertiesLength > 0) {
@@ -83,16 +87,26 @@ public class QueueGetConfigReplyMessageFactory implements OFDeserializer<GetQueu
                 propertiesBuilder.addAugmentation(RateQueueProperty.class, rateBuilder.build());
                 input.skipBytes(PADDING_IN_RATE_QUEUE_PROPERTY);
             } else if (property.equals(QueueProperties.OFPQTEXPERIMENTER)) {
-                ExperimenterQueuePropertyBuilder expBuilder = new ExperimenterQueuePropertyBuilder();
-                expBuilder.setExperimenter(input.readUnsignedInt());
-                input.skipBytes(PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY);
-                expBuilder.setData(input.readBytes(currentPropertyLength
-                        - EncodeConstants.SIZE_OF_INT_IN_BYTES - PADDING_IN_EXPERIMENTER_QUEUE_PROPERTY).array());
-                propertiesBuilder.addAugmentation(RateQueueProperty.class, expBuilder.build());
+                // return index to property start, so that the experimenter properties are deserialized
+                // correctly - as whole ofp_queue_prop_experimenter property
+                input.readerIndex(input.readerIndex() - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES
+                        - PADDING_IN_QUEUE_PROPERTY_HEADER);
+                OFDeserializer<QueueProperty> deserializer = registry.getDeserializer(
+                        new MessageCodeKey(EncodeConstants.OF13_VERSION_ID,
+                                EncodeConstants.EXPERIMENTER_VALUE, QueueProperty.class));
+                QueueProperty expProp = deserializer.deserialize(input.slice(input.readerIndex(),
+                        currentPropertyLength - QUEUE_PROP_HEADER_SIZE));
+                propertiesList.add(expProp);
+                continue;
             }
             propertiesList.add(propertiesBuilder.build());
         }
         return propertiesList;
     }
 
+    @Override
+    public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+        this.registry = deserializerRegistry;
+    }
+
 }
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/DefaultExperimenterInitializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/DefaultExperimenterInitializer.java
deleted file mode 100644 (file)
index 5aaa458..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization;\r
-\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF10StatsRequestVendorSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF10VendorInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13ExperimenterActionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13ExperimenterInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13ExperimenterInstructionSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13MeterBandExperimenterSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13MultipartExperimenterSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF13TableFeatExpSerializer;\r
-import org.opendaylight.openflowjava.protocol.impl.util.CommonMessageRegistryHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.util.EnhancedKeyRegistryHelper;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class DefaultExperimenterInitializer {\r
-\r
-    /**\r
-     * Registers message serializers into provided registry\r
-     * @param serializerRegistry registry to be initialized with message serializers\r
-     */\r
-    public static void registerDefaultExperimenterSerializers(SerializerRegistry serializerRegistry) {\r
-        // register OF v1.0 default experimenter serializers\r
-        short version = EncodeConstants.OF10_VERSION_ID;\r
-        CommonMessageRegistryHelper helper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
-        helper.registerSerializer(ExperimenterInput.class, new OF10VendorInputMessageFactory());\r
-        EnhancedKeyRegistryHelper<Action> actionHelper = new EnhancedKeyRegistryHelper<>(\r
-                EncodeConstants.OF10_VERSION_ID, Action.class, serializerRegistry);\r
-        actionHelper.registerSerializer(Experimenter.class, new OF13ExperimenterActionSerializer());\r
-        helper.registerSerializer(MultipartRequestExperimenter.class, new OF10StatsRequestVendorSerializer());\r
-        // register OF v1.3 default experimenter serializers\r
-        version = EncodeConstants.OF13_VERSION_ID;\r
-        helper = new CommonMessageRegistryHelper(version, serializerRegistry);\r
-        helper.registerSerializer(ExperimenterInput.class, new OF13ExperimenterInputMessageFactory());\r
-        helper.registerSerializer(MultipartRequestExperimenter.class, new OF13MultipartExperimenterSerializer());\r
-        helper.registerSerializer(TableFeatureProperties.class, new OF13TableFeatExpSerializer());\r
-        helper.registerSerializer(MeterBandExperimenter.class, new OF13MeterBandExperimenterSerializer());\r
-        actionHelper = new EnhancedKeyRegistryHelper<>(\r
-                EncodeConstants.OF13_VERSION_ID, Action.class, serializerRegistry);\r
-        actionHelper.registerSerializer(Experimenter.class, new OF13ExperimenterActionSerializer());\r
-        EnhancedKeyRegistryHelper<Instruction> insHelper = new EnhancedKeyRegistryHelper<>(\r
-                EncodeConstants.OF13_VERSION_ID, Instruction.class, serializerRegistry);\r
-        insHelper.registerSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight\r
-                .openflow.common.instruction.rev130731.Experimenter.class,\r
-                new OF13ExperimenterInstructionSerializer());\r
-    }\r
-}\r
index 4f36b054a14c87fe48f80d6fd20d6e6a6239bb6d..3d8e3a625e29ad8bec481cc0bc69e489b38bc741 100644 (file)
@@ -50,8 +50,6 @@ public class SerializerRegistryImpl implements SerializerRegistry {
         ActionsInitializer.registerActionSerializers(this);
         // instruction serializers
         InstructionsInitializer.registerInstructionSerializers(this);
-        // default vendor / experimenter serializers
-        DefaultExperimenterInitializer.registerDefaultExperimenterSerializers(this);
     }
 
     /**
index 11068f3f802aa1063796b39e7e811f6be7b01852..718f134b24d2615e592056e6af81e5279f89b7dc 100644 (file)
@@ -32,10 +32,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.drop._case.MeterBandDropBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.Bands;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.BandsBuilder;
 
@@ -76,7 +74,7 @@ public class MeterModInputMessageFactoryTest {
         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
         meterModFactory.serialize(message, out);
         
-        BufferHelper.checkHeaderV13(out, (byte) 29, 64);
+        BufferHelper.checkHeaderV13(out, (byte) 29, 48);
         Assert.assertEquals("Wrong meterModCommand", message.getCommand().getIntValue(), out.readUnsignedShort());
         Assert.assertEquals("Wrong meterFlags", message.getFlags(), decodeMeterModFlags(out.readShort()));
         Assert.assertEquals("Wrong meterId", message.getMeterId().getValue().intValue(), out.readUnsignedInt());
@@ -109,14 +107,6 @@ public class MeterModInputMessageFactoryTest {
         dscpRemarkBand.setPrecLevel((short) 3);
         dscpCaseBuilder.setMeterBandDscpRemark(dscpRemarkBand.build());
         bandsList.add(bandsBuilder.setMeterBand(dscpCaseBuilder.build()).build());
-        MeterBandExperimenterCaseBuilder expCaseBuilder = new MeterBandExperimenterCaseBuilder();
-        MeterBandExperimenterBuilder experimenterBand = new MeterBandExperimenterBuilder();
-        experimenterBand.setType(MeterBandType.OFPMBTEXPERIMENTER);
-        experimenterBand.setRate(1L);
-        experimenterBand.setBurstSize(2L);
-        experimenterBand.setExperimenter(4L);
-        expCaseBuilder.setMeterBandExperimenter(experimenterBand.build());
-        bandsList.add(bandsBuilder.setMeterBand(expCaseBuilder.build()).build());
         return bandsList;
     }
     
@@ -142,15 +132,6 @@ public class MeterModInputMessageFactoryTest {
         input.skipBytes(3);
         dscpCaseBuilder.setMeterBandDscpRemark(dscpRemarkBand.build());
         bandsList.add(bandsBuilder.setMeterBand(dscpCaseBuilder.build()).build());
-        MeterBandExperimenterCaseBuilder expCaseBuilder = new MeterBandExperimenterCaseBuilder();
-        MeterBandExperimenterBuilder experimenterBand = new MeterBandExperimenterBuilder();
-        experimenterBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
-        input.skipBytes(Short.SIZE/Byte.SIZE);
-        experimenterBand.setRate(input.readUnsignedInt());
-        experimenterBand.setBurstSize(input.readUnsignedInt());
-        experimenterBand.setExperimenter(input.readUnsignedInt());
-        expCaseBuilder.setMeterBandExperimenter(experimenterBand.build());
-        bandsList.add(bandsBuilder.setMeterBand(expCaseBuilder.build()).build());
         return bandsList;
     }
     
index 4227330b5d2da7d4df0a7cd58729b93b1bfb839c..1c34f365223c22c66ec6941e71b857aace88c9ca 100644 (file)
@@ -32,7 +32,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCase;
@@ -47,7 +46,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
@@ -453,69 +451,4 @@ public class MultipartRequestInputFactoryTest {
         return caseBuilder.build();
     }
 
-    /**
-     * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization
-     * @throws Exception
-     */
-    @Test
-    public void testExperimenter() throws Exception {
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
-        builder.setType(MultipartType.OFPMPEXPERIMENTER);
-        builder.setFlags(new MultipartRequestFlags(false));
-        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
-        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
-        expBuilder.setExperimenter(56L);
-        expBuilder.setExpType(148L);
-        byte[] expData = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};
-        expBuilder.setData(expData);
-        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
-        builder.setMultipartRequestBody(caseBuilder.build());
-        MultipartRequestInput message = builder.build();
-        
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
-        multipartFactory.serialize(message, out);
-        
-        BufferHelper.checkHeaderV10(out, (byte) 18, 32);
-        Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
-        out.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
-        Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());
-        Assert.assertEquals("Wrong exp-type", 148, out.readUnsignedInt());
-        byte[] temp = new byte[8];
-        out.readBytes(temp);
-        Assert.assertArrayEquals("Wrong data", expData, temp);
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);
-    }
-
-    /**
-     * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization
-     * @throws Exception
-     */
-    @Test
-    public void testExperimenterWithoutData() throws Exception {
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
-        builder.setType(MultipartType.OFPMPEXPERIMENTER);
-        builder.setFlags(new MultipartRequestFlags(false));
-        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();
-        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();
-        expBuilder.setExperimenter(56L);
-        expBuilder.setExpType(152L);
-        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());
-        builder.setMultipartRequestBody(caseBuilder.build());
-        MultipartRequestInput message = builder.build();
-        
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
-        multipartFactory.serialize(message, out);
-        
-        BufferHelper.checkHeaderV10(out, (byte) 18, 24);
-        Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
-        out.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
-        Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());
-        Assert.assertEquals("Wrong exp-type", 152, out.readUnsignedInt());
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);
-    }
-
 }
index 737aceccd7b0ef7e7774637745e50e6bde080bf3..5909067e512a02510d39501a88ed6b301e9d9926 100644 (file)
@@ -29,13 +29,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.desc._case.MultipartRequestDescBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;\r
@@ -302,63 +300,4 @@ public class OF10StatsRequestInputFactoryTest {
         Assert.assertEquals("Wrong queue-id", 16, out.readUnsignedInt());\r
         Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
     }\r
-    \r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testExperimenter() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
-        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
-        expBuilder.setExperimenter(56L);\r
-        byte[] expData = new byte[]{0, 1, 2, 3, 4, 5, 6, 7};\r
-        expBuilder.setData(expData);\r
-        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 24);\r
-        Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());\r
-        byte[] temp = new byte[8];\r
-        out.readBytes(temp);\r
-        Assert.assertArrayEquals("Wrong data", expData, temp);\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-\r
-    /**\r
-     * Testing OF10StatsRequestInputFactory (Vendor) for correct serialization\r
-     * @throws Exception\r
-     */\r
-    @Test\r
-    public void testExperimenterWithoutData() throws Exception {\r
-        MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setType(MultipartType.OFPMPEXPERIMENTER);\r
-        builder.setFlags(new MultipartRequestFlags(false));\r
-        MultipartRequestExperimenterCaseBuilder caseBuilder = new MultipartRequestExperimenterCaseBuilder();\r
-        MultipartRequestExperimenterBuilder expBuilder = new MultipartRequestExperimenterBuilder();\r
-        expBuilder.setExperimenter(56L);\r
-        caseBuilder.setMultipartRequestExperimenter(expBuilder.build());\r
-        builder.setMultipartRequestBody(caseBuilder.build());\r
-        MultipartRequestInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        multipartFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 16, 16);\r
-        Assert.assertEquals("Wrong type", 0xFFFF, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 56, out.readUnsignedInt());\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
 }\r
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10VendorInputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10VendorInputMessageFactoryTest.java
deleted file mode 100644 (file)
index 022b334..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.experimenters.OF10VendorInputMessageFactory;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF10VendorInputMessageFactoryTest {\r
-\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<ExperimenterInput> vendorFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        vendorFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, ExperimenterInput.class));\r
-    }\r
-\r
-\r
-    /**\r
-     * Testing of {@link OF10VendorInputMessageFactory} for correct translation from POJO\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);\r
-        builder.setExperimenter(0x0001020304L);\r
-        builder.setData(new byte[] {0x01, 0x02, 0x03, 0x04});\r
-        ExperimenterInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        vendorFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV10(out, (byte) 4, 16);\r
-        Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
-        byte[] data = new byte[4];\r
-        out.readBytes(data);\r
-        Assert.assertArrayEquals("Wrong data", message.getData(), data);\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF13ExperimenterInputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF13ExperimenterInputMessageFactoryTest.java
deleted file mode 100644 (file)
index 362f95a..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*\r
- * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.UnpooledByteBufAllocator;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * @author timotej.kubas\r
- */\r
-public class OF13ExperimenterInputMessageFactoryTest {\r
-\r
-    private static final byte EXPERIMENTER_REQUEST_MESSAGE_CODE_TYPE = 4;\r
-    private SerializerRegistry registry;\r
-    private OFSerializer<ExperimenterInput> expFactory;\r
-\r
-    /**\r
-     * Initializes serializer registry and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-        expFactory = registry.getSerializer(\r
-                new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, ExperimenterInput.class));\r
-    }\r
-\r
-    /**\r
-     * Testing of {@link ExperimenterInputMessageFactory} for correct translation from POJO\r
-     * @throws Exception \r
-     */\r
-    @Test\r
-    public void test() throws Exception {\r
-        ExperimenterInputBuilder builder = new ExperimenterInputBuilder();\r
-        BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);\r
-        builder.setExperimenter(0x0001020304L);\r
-        builder.setExpType(0x0001020304L);\r
-        byte[] expData = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};\r
-        builder.setData(expData);\r
-        ExperimenterInput message = builder.build();\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        expFactory.serialize(message, out);\r
-        \r
-        BufferHelper.checkHeaderV13(out, EXPERIMENTER_REQUEST_MESSAGE_CODE_TYPE, 24);\r
-        Assert.assertEquals("Wrong experimenter", 0x0001020304L, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong expType", 0x0001020304L, out.readUnsignedInt());\r
-        byte[] tmp = new byte[8];\r
-        out.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong data", expData, tmp);\r
-    }\r
-    \r
-}
\ No newline at end of file
index 12cb72443e0645881e83e2929f9aa4187b2cbcba..347ca63326d2f1b42acfa4707aac568faa786550 100644 (file)
@@ -26,8 +26,6 @@ import org.opendaylight.openflowjava.protocol.impl.serialization.factories.Multi
 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
 import org.opendaylight.openflowjava.util.ByteBufUtils;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;\r
@@ -204,27 +202,6 @@ public class TableFeaturesTest {
         oxmBuilder.setMatchEntries(entries);\r
         propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());\r
         properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTER);\r
-        ExperimenterRelatedTableFeaturePropertyBuilder expBuilder =\r
-                       new ExperimenterRelatedTableFeaturePropertyBuilder();\r
-        expBuilder.setExperimenter(1024L);\r
-        expBuilder.setExpType(2048L);\r
-        byte[] expData = new byte[]{0, 1, 2};\r
-        expBuilder.setData(expData);\r
-        propBuilder.addAugmentation(\r
-                       ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());\r
-        properties.add(propBuilder.build());\r
-        propBuilder = new TableFeaturePropertiesBuilder();\r
-        propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);\r
-        expBuilder = new ExperimenterRelatedTableFeaturePropertyBuilder();\r
-        expBuilder.setExperimenter(4098L);\r
-        expBuilder.setExpType(8152L);\r
-        byte[] expData2 = new byte[]{3, 4, 6, 7, 8, 9};\r
-        expBuilder.setData(expData2);\r
-        propBuilder.addAugmentation(\r
-                       ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());\r
-        properties.add(propBuilder.build());\r
         tableFeaturesBuilder.setTableFeatureProperties(properties);\r
         tableFeaturesList.add(tableFeaturesBuilder.build());\r
         featuresBuilder.setTableFeatures(tableFeaturesList);\r
@@ -235,7 +212,7 @@ public class TableFeaturesTest {
         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
         multipartFactory.serialize(message, out);\r
 \r
-        BufferHelper.checkHeaderV13(out, (byte) 18, 272);\r
+        BufferHelper.checkHeaderV13(out, (byte) 18, 232);\r
         Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());\r
         Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());\r
         out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);\r
@@ -282,7 +259,7 @@ public class TableFeaturesTest {
         Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
         Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
         Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong length", 136, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong length", 96, out.readUnsignedShort());\r
         Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());\r
         out.skipBytes(5);\r
         Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",\r
@@ -315,22 +292,6 @@ public class TableFeaturesTest {
         Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());\r
         Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());\r
         out.skipBytes(4);\r
-        Assert.assertEquals("Wrong property type", 0xFFFE, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 1024, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong exp-type", 2048, out.readUnsignedInt());\r
-        byte[] tmp = new byte[3];\r
-        out.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong experimenter data", expData, tmp);\r
-        out.skipBytes(1);\r
-        Assert.assertEquals("Wrong property type", 0xFFFF, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 4098, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong exp-type", 8152, out.readUnsignedInt());\r
-        byte[] tmp2 = new byte[6];\r
-        out.readBytes(tmp2);\r
-        Assert.assertArrayEquals("Wrong experimenter data", expData2, tmp2);\r
-        out.skipBytes(6);\r
         Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
     }\r
 \r
index eba0d98b974a5c34423be4a74a6fa1c215a0ad52..533bfa40278571ae8cd3282eabcb5495471eca44 100644 (file)
@@ -24,8 +24,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
@@ -41,7 +39,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
@@ -155,20 +152,6 @@ public class OF10ActionsSerializerTest {
         queueBuilder.setQueueId(400L);\r
         actionBuilder.addAugmentation(QueueIdAction.class, queueBuilder.build());\r
         actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Experimenter.class);\r
-        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
-        expBuilder.setExperimenter(82L);\r
-        byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
-        expBuilder.setData(expData);\r
-        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Experimenter.class);\r
-        expBuilder = new ExperimenterActionBuilder();\r
-        expBuilder.setExperimenter(102L);\r
-        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
-        actions.add(actionBuilder.build());\r
         \r
         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
         ListSerializer.serializeList(actions, EnhancedTypeKeyMakerFactory\r
@@ -230,15 +213,6 @@ public class OF10ActionsSerializerTest {
         Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());\r
         out.skipBytes(6);\r
         Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 82, out.readUnsignedInt());\r
-        byte[] tmp = new byte[8];\r
-        out.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong data", expData, tmp);\r
-        Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 102, out.readUnsignedInt());\r
         Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);\r
     }\r
     \r
index b450ccdcf962f7f0b957b583fa3f8ff99cd3b0bb..76784c9258fc9bb3236bd488c28c2dceb7817bab 100644 (file)
@@ -21,8 +21,6 @@ import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
@@ -43,7 +41,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev1
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;\r
@@ -178,20 +175,6 @@ public class OF13ActionsSerializerTest {
         actionBuilder = new ActionBuilder();\r
         actionBuilder.setType(PopPbb.class);\r
         actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Experimenter.class);\r
-        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
-        expBuilder.setExperimenter(82L);\r
-        byte[] expData = new byte[]{0, 0, 0, 0, 0, 0, 0, 1};\r
-        expBuilder.setData(expData);\r
-        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Experimenter.class);\r
-        expBuilder = new ExperimenterActionBuilder();\r
-        expBuilder.setExperimenter(102L);\r
-        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
-        actions.add(actionBuilder.build());\r
         \r
         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
         ListSerializer.serializeList(actions, EnhancedTypeKeyMakerFactory\r
@@ -257,15 +240,6 @@ public class OF13ActionsSerializerTest {
         Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());\r
         Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
         out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 82, out.readUnsignedInt());\r
-        byte[] tmp = new byte[8];\r
-        out.readBytes(tmp);\r
-        Assert.assertArrayEquals("Wrong data", expData, tmp);\r
-        Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong experimenter", 102, out.readUnsignedInt());\r
         Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
     }\r
 \r
diff --git a/pom.xml b/pom.xml
index 05862144ad642beae14dbdf9da94a93532640508..b691ee2e728c0391be00a13fd1e0b06492244314 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -13,6 +13,7 @@
         <module>openflow-protocol-it</module>
         <module>feature</module>
         <module>simple-client</module>
+        <module>openflow-protocol-ext</module>
     </modules>
     <scm>
         <connection>scm:git:ssh://git.opendaylight.org:29418/openflowjava.git</connection>