Renamed packages to org.opendaylight.openflowjava.protocol.impl.* 69/1169/1
authormichal.polkorab <michal.polkorab@pantheon.sk>
Thu, 12 Sep 2013 16:56:31 +0000 (09:56 -0700)
committermichal.polkorab <michal.polkorab@pantheon.sk>
Thu, 12 Sep 2013 17:00:16 +0000 (10:00 -0700)
Renamed class names to match cammelCase

Signed-off-by: michal.polkorab <michal.polkorab@pantheon.sk>
46 files changed:
openflow-protocol-impl/pom.xml
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OF13Codec.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/Of13Codec.java with 87% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoder.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/OfFrameDecoder.java with 87% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/OfVersionDetector.java with 86% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializer.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/PublishingChannelInitializer.java with 83% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactory.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/SslContextFactory.java with 97% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslKeyStore.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/SslKeyStore.java with 94% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactory.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/SslTrustManagerFactory.java with 97% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandler.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/TcpHandler.java with 98% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TlsDetector.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/TlsDetector.java with 92% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DecoderTable.java [new file with mode: 0644]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializationFactory.java [new file with mode: 0644]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MessageTypeCodeKey.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/MessageTypeCodeKey.java with 91% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/OFDeserializer.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/OfDeserializer.java with 80% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactory.java [new file with mode: 0644]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoReplyMessageFactory.java [moved from openflow-protocol-impl/src/main/java/org/openflow/deserialization/factories/EchoReplyMessageFactory.java with 82% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoRequestMessageFactory.java [moved from openflow-protocol-impl/src/main/java/org/openflow/deserialization/factories/EchoRequestMessageFactory.java with 81% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactory.java [new file with mode: 0644]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/FeaturesReplyMessageFactory.java [moved from openflow-protocol-impl/src/main/java/org/openflow/deserialization/factories/FeaturesReplyMessageFactory.java with 86% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/HelloMessageFactory.java [moved from openflow-protocol-impl/src/main/java/org/openflow/deserialization/factories/HelloMessageFactory.java with 79% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/EncoderTable.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/EncoderTable.java with 68% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MessageTypeKey.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/MessageTypeKey.java with 92% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/OFSerializer.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/OfSerializer.java with 79% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializationFactory.java [new file with mode: 0644]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactory.java [moved from openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/factories/HelloInputMessageFactory.java with 72% similarity]
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ByteBufUtils.java [moved from openflow-protocol-impl/src/main/java/org/openflow/util/ByteBufUtils.java with 88% similarity]
openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/DecoderTable.java [deleted file]
openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/DeserializationFactory.java [deleted file]
openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/SerializationFactory.java [deleted file]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/clients/SimpleClient.java with 98% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/clients/SimpleClientHandler.java with 89% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientInitializer.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/clients/SimpleClientInitializer.java with 89% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DummyDecoder.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/DummyDecoder.java with 88% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoderTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/OFFrameDecoderTest.java with 81% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetectorTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/OFVersionDetectorTest.java with 77% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandlerTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/TCPHandlerTest.java with 94% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/TlsDetectorTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/TLSDetectorTest.java with 77% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactoryTest.java [new file with mode: 0644]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoReplyMessageFactoryTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/deserialization/factories/EchoReplyMessageFactoryTest.java with 84% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoRequestMessageFactoryTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/deserialization/factories/EchoRequestMessageFactoryTest.java with 83% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java [new file with mode: 0644]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/FeaturesReplyMessageFactoryTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/deserialization/factories/FeaturesReplyMessageFactoryTest.java with 84% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/HelloMessageFactoryTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/deserialization/factories/HelloMessageFactoryTest.java with 78% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/serialization/factories/HelloInputMessageFactoryTest.java with 75% similarity]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/BufferHelper.java [moved from openflow-protocol-impl/src/test/java/org/openflow/lib/util/BufferHelper.java with 88% similarity]
openflow-protocol-impl/src/test/resources/org/opendaylight/openflowjava/protocol/impl/core/OFBinaryMessageInput.txt [moved from openflow-protocol-impl/src/test/resources/org/openflow/lib/OFBinaryMessageInput.txt with 100% similarity]

index 659cc64118ccbc96cddb3c6c2d99bbce0a7996ec..ec4e1c4da57420439e21742d0f7acd33f2df385b 100644 (file)
@@ -43,7 +43,6 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.10</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
similarity index 87%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/Of13Codec.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OF13Codec.java
index 1867eeeb1f6820853cc915ea4e46c06e39f2f0ef..4e92ad0602ad76819baf368998b7abff4f78ccc5 100644 (file)
@@ -1,12 +1,12 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib;\r
+package org.opendaylight.openflowjava.protocol.impl.core;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 import io.netty.channel.ChannelHandlerContext;\r
 import io.netty.channel.ChannelInboundHandlerAdapter;\r
 \r
-import org.openflow.lib.deserialization.DeserializationFactory;\r
-import org.openflow.util.ByteBufUtils;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
@@ -16,16 +16,16 @@ import org.slf4j.LoggerFactory;
  *\r
  * @author michal.polkorab\r
  */\r
-public class Of13Codec extends ChannelInboundHandlerAdapter {\r
+public class OF13Codec extends ChannelInboundHandlerAdapter {\r
 \r
     // TODO - fix with enum in API\r
     private static final int MESSAGE_TYPES = 29;\r
-    private static final Logger LOGGER = LoggerFactory.getLogger(Of13Codec.class);\r
+    private static final Logger LOGGER = LoggerFactory.getLogger(OF13Codec.class);\r
 \r
     /**\r
      * Constructor of class\r
      */\r
-    public Of13Codec() {\r
+    public OF13Codec() {\r
         LOGGER.info("Creating OF 1.3 Codec");\r
         \r
     }\r
@@ -104,6 +104,6 @@ public class Of13Codec extends ChannelInboundHandlerAdapter {
     }\r
 \r
     private static boolean checkOFHeader(short type, int length) {\r
-        return !((type > MESSAGE_TYPES) || (length < OfFrameDecoder.LENGTH_OF_HEADER));\r
+        return !((type > MESSAGE_TYPES) || (length < OFFrameDecoder.LENGTH_OF_HEADER));\r
     }\r
 }\r
similarity index 87%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/OfFrameDecoder.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoder.java
index 668925bb041606a12888c60985970f1f41865bf8..650fe3b51f906ff0317493795481ee57b8126a24 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
 
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
@@ -10,24 +10,24 @@ import java.util.List;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.openflow.lib.TcpHandler.COMPONENT_NAMES;
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;
 
 /**
  * Class for decoding incoming messages into message frames.
  *
  * @author michal.polkorab
  */
-public class OfFrameDecoder extends ByteToMessageDecoder {
+public class OFFrameDecoder extends ByteToMessageDecoder {
 
     /** Length of OpenFlow 1.3 header */
     public static final byte LENGTH_OF_HEADER = 8;
     private static final byte LENGTH_INDEX_IN_HEADER = 2;
-    private static final Logger LOGGER = LoggerFactory.getLogger(OfFrameDecoder.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(OFFrameDecoder.class);
 
     /**
      * Constructor of class.
      */
-    public OfFrameDecoder() {
+    public OFFrameDecoder() {
         LOGGER.info("Creating OFFrameDecoder");
     }
 
@@ -66,7 +66,7 @@ public class OfFrameDecoder extends ByteToMessageDecoder {
     private static void enableOFVersionDetector(ChannelHandlerContext ctx) {
         if (ctx.pipeline().get(COMPONENT_NAMES.OF_VERSION_DETECTOR.name()) == null) {
             LOGGER.info("Adding OFVD");
-            ctx.pipeline().addLast(COMPONENT_NAMES.OF_VERSION_DETECTOR.name(), new OfVersionDetector());
+            ctx.pipeline().addLast(COMPONENT_NAMES.OF_VERSION_DETECTOR.name(), new OFVersionDetector());
         } else {
             LOGGER.debug("OFVD already in pipeline");
         }
similarity index 86%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/OfVersionDetector.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java
index fd126f6bf9b0bbe017be1be7a98eb6715a1cead3..8ad4526055fe1297608e8fec9822d0b55d1824c0 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
@@ -9,7 +9,7 @@ import java.util.List;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.openflow.lib.TcpHandler.COMPONENT_NAMES;
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;
 
 /**
  * Class that detects version of used OpenFlow Protocol and engages right OFCodec into
@@ -17,16 +17,16 @@ import org.openflow.lib.TcpHandler.COMPONENT_NAMES;
  *
  * @author michal.polkorab
  */
-public class OfVersionDetector extends ByteToMessageDecoder {
+public class OFVersionDetector extends ByteToMessageDecoder {
 
     /** Version number of OpenFlow 1.3 protocol */
     public static final byte OF13_VERSION_ID = 0x04;
-    private static final Logger LOGGER = LoggerFactory.getLogger(OfVersionDetector.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(OFVersionDetector.class);
 
     /**
      * Constructor of class.
      */
-    public OfVersionDetector() {
+    public OFVersionDetector() {
         LOGGER.info("Creating OFVersionDetector");
     }
 
@@ -59,7 +59,7 @@ public class OfVersionDetector extends ByteToMessageDecoder {
     private static void enableOF13Codec(ChannelHandlerContext chc) {
         if (chc.pipeline().get(COMPONENT_NAMES.OF_CODEC.name()) == null) {
             LOGGER.info("Engaging OF13Codec");
-            chc.pipeline().addLast(COMPONENT_NAMES.OF_CODEC.name(), new Of13Codec());
+            chc.pipeline().addLast(COMPONENT_NAMES.OF_CODEC.name(), new OF13Codec());
         } else {
             LOGGER.debug("OF13Codec already in pipeline");
         }
similarity index 83%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/PublishingChannelInitializer.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/PublishingChannelInitializer.java
index 9f166054a526bee90c5dadc85c7efc4e71bf34fb..0cf8a5bd6f54978d3831616eedec653fbf1bcec7 100644 (file)
@@ -1,4 +1,4 @@
-package org.openflow.lib;\r
+package org.opendaylight.openflowjava.protocol.impl.core;\r
 \r
 import io.netty.channel.Channel;\r
 import io.netty.channel.ChannelInitializer;\r
@@ -6,7 +6,7 @@ import io.netty.channel.group.DefaultChannelGroup;
 \r
 import java.util.Iterator;\r
 \r
-import org.openflow.lib.TcpHandler.COMPONENT_NAMES;\r
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;\r
 \r
 /**\r
  * @author michal.polkorab\r
similarity index 97%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/SslContextFactory.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactory.java
index cc61c3828873c113c6c5a896daf42a92122a7aca..ab27204370c24bd4e8b4014c63e56c920742a3fa 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import java.security.KeyStore;
 import java.security.Security;
similarity index 94%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/SslKeyStore.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslKeyStore.java
index 460921c05f421764473e88b9b1def1a04942f3e2..8d4e23744a0d7a31650a456468a726ace8753d84 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import java.io.InputStream;
 
similarity index 97%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/SslTrustManagerFactory.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslTrustManagerFactory.java
index e37c8edfce5e261590baca5a0cc0fcd68d47f0fd..36e1fdaf1ce36541d9ccd920b5df4011c33a31bb 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import javax.net.ssl.ManagerFactoryParameters;
 import javax.net.ssl.TrustManager;
similarity index 98%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/TcpHandler.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandler.java
index bc7d985b0f41d758d68e4687df91b080c23d9682..5d342fdecff5daa416c151621193a9765ca1ab33 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.channel.ChannelFuture;
similarity index 92%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/TlsDetector.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TlsDetector.java
index cfd5025cdff928b5d3b1b51345a7994d3fbea3ae..2640626be6917d7f2f7f6beef57912af95593103 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
@@ -13,8 +13,8 @@ import javax.net.ssl.SSLEngine;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.openflow.lib.TcpHandler.COMPONENT_NAMES;
-import org.openflow.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;
+import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
 
 /**
  * Class for detecting TLS encrypted connection. If TLS encrypted connection is detected,
@@ -68,7 +68,7 @@ public class TlsDetector extends ByteToMessageDecoder {
         ChannelPipeline p = ctx.channel().pipeline();
         if (p.get(COMPONENT_NAMES.OF_FRAME_DECODER.name()) == null) {
             LOGGER.debug("Engaging OFFrameDecoder");
-            p.addLast(COMPONENT_NAMES.OF_FRAME_DECODER.name(), new OfFrameDecoder());
+            p.addLast(COMPONENT_NAMES.OF_FRAME_DECODER.name(), new OFFrameDecoder());
         } else {
             LOGGER.debug("OFFD already in pipeline");
         }
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DecoderTable.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DecoderTable.java
new file mode 100644 (file)
index 0000000..364f7f3
--- /dev/null
@@ -0,0 +1,97 @@
+/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import org.opendaylight.openflowjava.protocol.impl.core.OFVersionDetector;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.BarrierReplyMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoReplyMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ExperimenterMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FeaturesReplyMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ * \r
+ *  <pre>         \r
+ *  Type   Message\r
+ *   0: HELLO\r
+ *   1: ERROR\r
+ *   2: ECHO_REQUEST\r
+ *   3: ECHO_REPLY\r
+ *   4: EXPERIMENTER\r
+ *   5: FEATURES_REQUEST\r
+ *   6: FEATURES_REPLY\r
+ *   7: GET_CONFIG_REQUEST\r
+ *   8: GET_CONFIG_REPLY\r
+ *   9: SET_CONFIG\r
+ *   10: PACKET_IN\r
+ *   11: FLOW_REMOVED\r
+ *   12: PORT_STATUS\r
+ *   13: PACKET_OUT\r
+ *   14: FLOW_MOD\r
+ *   15: GROUP_MOD\r
+ *   16: PORT_MOD\r
+ *   17: TABLE_MOD\r
+ *   18: MULTIPART_REQUEST\r
+ *   19: MULTIPART_REPLY\r
+ *   20: BARRIER_REQUEST\r
+ *   21: BARRIER_REPLY\r
+ *   22: QUEUE_GET_CONFIG_REQUEST\r
+ *   23: QUEUE_GET_CONFIG_REPLY\r
+ *   24: ROLE_REQUEST\r
+ *   25: ROLE_REPLY    \r
+ *   26: GET_ASYNC_REQUEST\r
+ *   27: GET_ASYNC_REPLY\r
+ *   28: SET_ASYNC\r
+ *   29: METER_MOD\r
+ *   </pre>\r
+ */\r
+public class DecoderTable {\r
+    \r
+    private static final short OF13 = OFVersionDetector.OF13_VERSION_ID;\r
+    private Map<MessageTypeCodeKey, OFDeserializer<?>> table;\r
+    private static DecoderTable instance;\r
+    \r
+    \r
+    private DecoderTable() {\r
+        // do nothing\r
+    }\r
+    \r
+    /**\r
+     * @return singleton instance\r
+     */\r
+    public static DecoderTable getInstance() {\r
+        if (instance == null) {\r
+            synchronized (DecoderTable.class) {\r
+                instance = new DecoderTable();\r
+                instance.init();\r
+            }\r
+        }\r
+        return instance;\r
+    }\r
+    \r
+    /**\r
+     * Decoder table provisioning\r
+     */\r
+    public void init() {\r
+        table = new HashMap<>();\r
+        table.put(new MessageTypeCodeKey(OF13, (short) 0), HelloMessageFactory.getInstance());\r
+        table.put(new MessageTypeCodeKey(OF13, (short) 2), EchoRequestMessageFactory.getInstance());\r
+        table.put(new MessageTypeCodeKey(OF13, (short) 3), EchoReplyMessageFactory.getInstance());\r
+        table.put(new MessageTypeCodeKey(OF13, (short) 4), ExperimenterMessageFactory.getInstance());\r
+        table.put(new MessageTypeCodeKey(OF13, (short) 6), FeaturesReplyMessageFactory.getInstance());\r
+        table.put(new MessageTypeCodeKey(OF13, (short) 21), BarrierReplyMessageFactory.getInstance());\r
+    }\r
+    \r
+    /**\r
+     * @param msgTypeKey\r
+     * @return decoder for given message types\r
+     */\r
+    public OFDeserializer<?> getDecoder(MessageTypeCodeKey msgTypeKey) {\r
+        return table.get(msgTypeKey);\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializationFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializationFactory.java
new file mode 100644 (file)
index 0000000..a126e6a
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.yangtools.yang.binding.DataObject;\r
+\r
+/**\r
+ *\r
+ * @author michal.polkorab\r
+ */\r
+public abstract class DeserializationFactory {\r
+\r
+    /**\r
+     * Transforms ByteBuf into correct POJO message\r
+     * @param rawMessage \r
+     * @param version version decoded from OpenFlow protocol message\r
+     * @return correct POJO as DataObject\r
+     */\r
+    public static DataObject bufferToMessage(ByteBuf rawMessage, short version) {\r
+        DataObject dataObject = null;\r
+        short type = rawMessage.readUnsignedByte();\r
+        \r
+        // TODO - check if no change happened, so that skipping length would cause problems\r
+        rawMessage.skipBytes(Short.SIZE / Byte.SIZE);\r
+\r
+        MessageTypeCodeKey msgTypeCodeKey = new MessageTypeCodeKey(version, type);\r
+        OFDeserializer<?> decoder = DecoderTable.getInstance().getDecoder(msgTypeCodeKey);\r
+        dataObject = decoder.bufferToMessage(rawMessage, version);\r
+        return dataObject;\r
+    }\r
+}\r
similarity index 91%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/MessageTypeCodeKey.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MessageTypeCodeKey.java
index 843265d4fe4dcfb91c7e46c9f2e6b097d5ab2ec0..7adc8623fcb87465bee4e65433a7add398e25e69 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
 \r
 /**\r
  * @author michal.polkorab\r
similarity index 80%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/OfDeserializer.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/OFDeserializer.java
index 4eed289c013478fd4b742b3cdad5bee4fb5d8711..0ea40eece33ff327ae6761f2307f2dc9646b3ff5 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization;\r
 \r
 import org.opendaylight.yangtools.yang.binding.DataObject;\r
 \r
@@ -10,7 +10,7 @@ import io.netty.buffer.ByteBuf;
  *\r
  * @param <E> message code type\r
  */\r
-public interface OfDeserializer<E extends DataObject> {\r
+public interface OFDeserializer<E extends DataObject> {\r
 \r
     /**\r
      * Transforms byte message into POJO/DTO (of type E).\r
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactory.java
new file mode 100644 (file)
index 0000000..3ec3975
--- /dev/null
@@ -0,0 +1,41 @@
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ * @author timotej.kubas\r
+ * \r
+ */\r
+public class BarrierReplyMessageFactory implements\r
+        OFDeserializer<BarrierOutput> {\r
+\r
+    private static BarrierReplyMessageFactory instance;\r
+\r
+    private BarrierReplyMessageFactory() {\r
+        // do nothing, just singleton\r
+    }\r
+\r
+    /**\r
+     * @return singleton factory\r
+     */\r
+    public static BarrierReplyMessageFactory getInstance() {\r
+        if (instance == null) {\r
+            instance = new BarrierReplyMessageFactory();\r
+        }\r
+        return instance;\r
+    }\r
+\r
+    @Override\r
+    public BarrierOutput bufferToMessage(ByteBuf rawMessage, short version) {\r
+        BarrierOutputBuilder bob = new BarrierOutputBuilder();\r
+        bob.setVersion(version);\r
+        bob.setXid(rawMessage.readUnsignedInt());\r
+        return bob.build();\r
+    }\r
+\r
+}\r
@@ -1,17 +1,17 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutputBuilder;\r
-import org.openflow.lib.deserialization.OfDeserializer;\r
 \r
 /**\r
  * @author michal.polkorab\r
  *\r
  */\r
-public class EchoReplyMessageFactory implements OfDeserializer<EchoOutput> {\r
+public class EchoReplyMessageFactory implements OFDeserializer<EchoOutput> {\r
 \r
     private static EchoReplyMessageFactory instance;\r
 \r
@@ -1,17 +1,17 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder;\r
-import org.openflow.lib.deserialization.OfDeserializer;\r
 \r
 /**\r
  * @author michal.polkorab\r
  *\r
  */\r
-public class EchoRequestMessageFactory implements OfDeserializer<EchoRequestMessage>{\r
+public class EchoRequestMessageFactory implements OFDeserializer<EchoRequestMessage>{\r
 \r
     \r
     private static EchoRequestMessageFactory instance;\r
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactory.java
new file mode 100644 (file)
index 0000000..ea500b7
--- /dev/null
@@ -0,0 +1,46 @@
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\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
+ * \r
+ * @author michal.polkorab, \r
+ * @author timotej.kubas\r
+ *\r
+ */\r
+public class ExperimenterMessageFactory implements OFDeserializer<ExperimenterMessage>{\r
+\r
+    private static ExperimenterMessageFactory instance;\r
+    \r
+    private ExperimenterMessageFactory() {\r
+        //singleton\r
+    }\r
+    \r
+    \r
+    /**\r
+     * @return singleton factory\r
+     */\r
+    public static ExperimenterMessageFactory getInstance(){\r
+        if (instance == null){\r
+           instance = new ExperimenterMessageFactory(); \r
+        }\r
+        \r
+        return instance;\r
+    }\r
+\r
+    @Override\r
+    public ExperimenterMessage bufferToMessage(ByteBuf rawMessage, short version) {\r
+        ExperimenterMessageBuilder emb = new ExperimenterMessageBuilder();\r
+        emb.setVersion(version);\r
+        emb.setXid(rawMessage.readUnsignedInt());\r
+        emb.setExperimenter(rawMessage.readUnsignedInt());\r
+        emb.setExpType(rawMessage.readUnsignedInt());\r
+        return emb.build();\r
+    }\r
+    \r
+    \r
+}\r
@@ -1,19 +1,19 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import java.math.BigInteger;\r
 \r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;\r
-import org.openflow.lib.deserialization.OfDeserializer;\r
 \r
 /**\r
  * @author michal.polkorab\r
  *\r
  */\r
-public class FeaturesReplyMessageFactory implements OfDeserializer<GetFeaturesOutput>{\r
+public class FeaturesReplyMessageFactory implements OFDeserializer<GetFeaturesOutput>{\r
     \r
     private static final byte PADDING_IN_FEATURES_REPLY_HEADER = 2;\r
     \r
@@ -1,17 +1,17 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder;\r
-import org.openflow.lib.deserialization.OfDeserializer;\r
 \r
 /**\r
  * @author michal.polkorab\r
  *\r
  */\r
-public class HelloMessageFactory implements OfDeserializer<HelloMessage> {\r
+public class HelloMessageFactory implements OFDeserializer<HelloMessage> {\r
 \r
     private static HelloMessageFactory instance;\r
     \r
similarity index 68%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/EncoderTable.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/EncoderTable.java
index a29e51e4096906788fda78e9f87b8a6e6365f420..e196d8786adbc4806425944a42d6438c6ff0eccf 100644 (file)
@@ -1,13 +1,13 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.serialization;\r
+package org.opendaylight.openflowjava.protocol.impl.serialization;\r
 \r
 import java.util.HashMap;\r
 import java.util.Map;\r
 \r
+import org.opendaylight.openflowjava.protocol.impl.core.OFVersionDetector;\r
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.HelloInputMessageFactory;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
 import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.openflow.lib.OfVersionDetector;\r
-import org.openflow.lib.serialization.factories.HelloInputMessageFactory;\r
 \r
 /**\r
  * @author michal.polkorab\r
@@ -15,9 +15,9 @@ import org.openflow.lib.serialization.factories.HelloInputMessageFactory;
  */\r
 public class EncoderTable {\r
     \r
-    private static final short OF13 = OfVersionDetector.OF13_VERSION_ID;\r
+    private static final short OF13 = OFVersionDetector.OF13_VERSION_ID;\r
     private static EncoderTable instance;\r
-    private Map<MessageTypeKey<?>, OfSerializer<?>> table;\r
+    private Map<MessageTypeKey<?>, OFSerializer<?>> table;\r
     \r
 \r
     private EncoderTable() {\r
@@ -50,8 +50,8 @@ public class EncoderTable {
      * @return encoder for current type of message (msgTypeKey)\r
      */\r
     @SuppressWarnings("unchecked")\r
-    public <E extends DataObject> OfSerializer<E> getEncoder(MessageTypeKey<E> msgTypeKey) {\r
-        return (OfSerializer<E>) table.get(msgTypeKey);\r
+    public <E extends DataObject> OFSerializer<E> getEncoder(MessageTypeKey<E> msgTypeKey) {\r
+        return (OFSerializer<E>) table.get(msgTypeKey);\r
     }\r
 \r
 }\r
similarity index 92%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/MessageTypeKey.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MessageTypeKey.java
index d8000efcd742e166bed30b10f014c2ebdf388ee5..1741d0273c89004b2ee1bcc924fd2b1ab0502b12 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.serialization;\r
+package org.opendaylight.openflowjava.protocol.impl.serialization;\r
 \r
 import org.opendaylight.yangtools.yang.binding.DataObject;\r
 \r
similarity index 79%
rename from openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/OfSerializer.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/OFSerializer.java
index 434c6635105b258e3fb52bbb9437753290ca39e1..b8d16c53486742f0f77bde0675debb8f5b8aeb22 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.serialization;\r
+package org.opendaylight.openflowjava.protocol.impl.serialization;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
@@ -10,7 +10,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
  *\r
  * @param <E> message type\r
  */\r
-public interface OfSerializer <E extends DataObject> {\r
+public interface OFSerializer <E extends DataObject> {\r
 \r
     /**\r
      * Transforms POJO/DTO into byte message (ByteBuf).\r
diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializationFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializationFactory.java
new file mode 100644 (file)
index 0000000..a7bffe5
--- /dev/null
@@ -0,0 +1,26 @@
+/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
+package org.opendaylight.openflowjava.protocol.impl.serialization;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.opendaylight.yangtools.yang.binding.DataObject;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class SerializationFactory {\r
+\r
+    /**\r
+     * Transforms POJO message into ByteBuf\r
+     * @param version version used for encoding received message\r
+     * @param out ByteBuf for storing and sending transformed message\r
+     * @param message POJO message\r
+     */\r
+    public static <E extends DataObject> void messageToBuffer(short version, ByteBuf out, E message) {\r
+        @SuppressWarnings("unchecked")\r
+        MessageTypeKey<E> msgTypeKey = new MessageTypeKey<E>(version, (Class<E>) message.getClass());\r
+        OFSerializer<E> encoder = EncoderTable.getInstance().getEncoder(msgTypeKey);\r
+        encoder.messageToBuffer(version, out, message);\r
+    }\r
+}\r
@@ -1,17 +1,17 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.serialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
+import org.opendaylight.openflowjava.protocol.impl.core.OFFrameDecoder;\r
+import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
-import org.openflow.lib.OfFrameDecoder;\r
-import org.openflow.lib.serialization.OfSerializer;\r
 \r
 /**\r
  * @author michal.polkorab\r
  *\r
  */\r
-public class HelloInputMessageFactory implements OfSerializer<HelloInput>{\r
+public class HelloInputMessageFactory implements OFSerializer<HelloInput>{\r
 \r
     /** Code type of HelloMessage */\r
     public static final byte MESSAGE_TYPE = 0;\r
@@ -35,7 +35,7 @@ public class HelloInputMessageFactory implements OfSerializer<HelloInput>{
     public void messageToBuffer(short version, ByteBuf out, HelloInput message) {\r
         out.writeByte(message.getVersion());\r
         out.writeByte(MESSAGE_TYPE);\r
-        out.writeShort(OfFrameDecoder.LENGTH_OF_HEADER);\r
+        out.writeShort(OFFrameDecoder.LENGTH_OF_HEADER);\r
         out.writeInt(message.getXid().intValue());\r
         // TODO - fill list of elements into ByteBuf, check length too\r
     }\r
similarity index 88%
rename from openflow-protocol-impl/src/main/java/org/openflow/util/ByteBufUtils.java
rename to openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/ByteBufUtils.java
index c4f7a962e85a543f2c85d267492588599c85f7e9..b5e01e7917d4348731cc67132cced284f8c9c8d6 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
 \r
-package org.openflow.util;\r
+package org.opendaylight.openflowjava.protocol.impl.util;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
diff --git a/openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/DecoderTable.java b/openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/DecoderTable.java
deleted file mode 100644 (file)
index 4f5fd07..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.openflow.deserialization.factories.EchoReplyMessageFactory;\r
-import org.openflow.deserialization.factories.EchoRequestMessageFactory;\r
-import org.openflow.deserialization.factories.FeaturesReplyMessageFactory;\r
-import org.openflow.deserialization.factories.HelloMessageFactory;\r
-import org.openflow.lib.OfVersionDetector;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class DecoderTable {\r
-    \r
-    private static final short OF13 = OfVersionDetector.OF13_VERSION_ID;\r
-    private Map<MessageTypeCodeKey, OfDeserializer<?>> table;\r
-    private static DecoderTable instance;\r
-    \r
-    \r
-    private DecoderTable() {\r
-        // do nothing\r
-    }\r
-    \r
-    /**\r
-     * @return singleton instance\r
-     */\r
-    public static DecoderTable getInstance() {\r
-        if (instance == null) {\r
-            synchronized (DecoderTable.class) {\r
-                instance = new DecoderTable();\r
-                instance.init();\r
-            }\r
-        }\r
-        return instance;\r
-    }\r
-    \r
-    /**\r
-     * Decoder table provisioning\r
-     */\r
-    public void init() {\r
-        table = new HashMap<>();\r
-        table.put(new MessageTypeCodeKey(OF13, (short) 0), HelloMessageFactory.getInstance());\r
-        table.put(new MessageTypeCodeKey(OF13, (short) 2), EchoRequestMessageFactory.getInstance());\r
-        table.put(new MessageTypeCodeKey(OF13, (short) 3), EchoReplyMessageFactory.getInstance());\r
-        table.put(new MessageTypeCodeKey(OF13, (short) 6), FeaturesReplyMessageFactory.getInstance());\r
-    }\r
-    \r
-    /**\r
-     * @param msgTypeKey\r
-     * @return decoder for given message types\r
-     */\r
-    public OfDeserializer<?> getDecoder(MessageTypeCodeKey msgTypeKey) {\r
-        return table.get(msgTypeKey);\r
-    }\r
-\r
-}\r
diff --git a/openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/DeserializationFactory.java b/openflow-protocol-impl/src/main/java/org/openflow/lib/deserialization/DeserializationFactory.java
deleted file mode 100644 (file)
index 8ffc08b..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- *\r
- * @author michal.polkorab\r
- */\r
-public abstract class DeserializationFactory {\r
-\r
-    /**\r
-     * Transforms ByteBuf into correct POJO message\r
-     * @param rawMessage \r
-     * @param version version decoded from OpenFlow protocol message\r
-     * @return correct POJO as DataObject\r
-     */\r
-    public static DataObject bufferToMessage(ByteBuf rawMessage, short version) {\r
-        DataObject dataObject = null;\r
-        short type = rawMessage.readUnsignedByte();\r
-        \r
-        // TODO - check if no change happened, so that skipping length would cause problems\r
-        rawMessage.skipBytes(Short.SIZE / Byte.SIZE);\r
-\r
-        MessageTypeCodeKey msgTypeCodeKey = new MessageTypeCodeKey(version, type);\r
-        OfDeserializer<?> decoder = DecoderTable.getInstance().getDecoder(msgTypeCodeKey);\r
-        dataObject = decoder.bufferToMessage(rawMessage, version);\r
-        /* \r
-           Type   Message\r
-            0: HELLO\r
-            1: ERROR\r
-            2: ECHO_REQUEST\r
-            3: ECHO_REPLY\r
-            4: EXPERIMENTER\r
-            5: FEATURES_REQUEST\r
-            6: FEATURES_REPLY\r
-            7: GET_CONFIG_REQUEST\r
-            8: GET_CONFIG_REPLY\r
-            9: SET_CONFIG\r
-            10: PACKET_IN\r
-            11: FLOW_REMOVED\r
-            12: PORT_STATUS\r
-            13: PACKET_OUT\r
-            14: FLOW_MOD\r
-            15: GROUP_MOD\r
-            16: PORT_MOD\r
-            17: TABLE_MOD\r
-            18: MULTIPART_REQUEST\r
-            19: MULTIPART_REPLY\r
-            20: BARRIER_REQUEST\r
-            21: BARRIER_REPLY\r
-            22: QUEUE_GET_CONFIG_REQUEST\r
-            23: QUEUE_GET_CONFIG_REPLY\r
-            24: ROLE_REQUEST\r
-            25: ROLE_REPLY    \r
-            26: GET_ASYNC_REQUEST\r
-            27: GET_ASYNC_REPLY\r
-            28: SET_ASYNC\r
-            29: METER_MOD\r
-        */\r
-        return dataObject;\r
-    }\r
-}\r
diff --git a/openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/SerializationFactory.java b/openflow-protocol-impl/src/main/java/org/openflow/lib/serialization/SerializationFactory.java
deleted file mode 100644 (file)
index d7214a2..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.serialization;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class SerializationFactory {\r
-\r
-    /**\r
-     * Transforms POJO message into ByteBuf\r
-     * @param version version used for encoding received message\r
-     * @param out ByteBuf for storing and sending transformed message\r
-     * @param message POJO message\r
-     */\r
-    public static <E extends DataObject> void messageToBuffer(short version, ByteBuf out, E message) {\r
-        @SuppressWarnings("unchecked")\r
-        MessageTypeKey<E> msgTypeKey = new MessageTypeKey<E>(version, (Class<E>) message.getClass());\r
-        OfSerializer<E> encoder = EncoderTable.getInstance().getEncoder(msgTypeKey);\r
-        encoder.messageToBuffer(version, out, message);\r
-        /* \r
-           Type   Message\r
-            0: HELLO\r
-            1: ERROR\r
-            2: ECHO_REQUEST\r
-            3: ECHO_REPLY\r
-            4: EXPERIMENTER\r
-            5: FEATURES_REQUEST\r
-            6: FEATURES_REPLY\r
-            7: GET_CONFIG_REQUEST\r
-            8: GET_CONFIG_REPLY\r
-            9: SET_CONFIG\r
-            10: PACKET_IN\r
-            11: FLOW_REMOVED\r
-            12: PORT_STATUS\r
-            13: PACKET_OUT\r
-            14: FLOW_MOD\r
-            15: GROUP_MOD\r
-            16: PORT_MOD\r
-            17: TABLE_MOD\r
-            18: MULTIPART_REQUEST\r
-            19: MULTIPART_REPLY\r
-            20: BARRIER_REQUEST\r
-            21: BARRIER_REPLY\r
-            22: QUEUE_GET_CONFIG_REQUEST\r
-            23: QUEUE_GET_CONFIG_REPLY\r
-            24: ROLE_REQUEST\r
-            25: ROLE_REPLY    \r
-            26: GET_ASYNC_REQUEST\r
-            27: GET_ASYNC_REPLY\r
-            28: SET_ASYNC\r
-            29: METER_MOD\r
-        */\r
-    }\r
-}\r
similarity index 98%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/clients/SimpleClient.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java
index ca2c680c8fe0013c7cc1f4d56380e244bf06238b..a731895755fb08de7b924853d3fa3f77121b58a2 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib.clients;
+package org.opendaylight.openflowjava.protocol.impl.clients;
 
 import io.netty.bootstrap.Bootstrap;
 import io.netty.buffer.ByteBuf;
similarity index 89%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/clients/SimpleClientHandler.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java
index 69d5275dedaf509b29df0f7f3b2522c34e5f80f9..fa2dbf96a144cf7075faa1a239cbbd959a299738 100644 (file)
@@ -1,12 +1,12 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
 \r
-package org.openflow.lib.clients;\r
+package org.opendaylight.openflowjava.protocol.impl.clients;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 import io.netty.channel.ChannelHandlerContext;\r
 import io.netty.channel.ChannelInboundHandlerAdapter;\r
 \r
-import org.openflow.util.ByteBufUtils;\r
+import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
similarity index 89%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/clients/SimpleClientInitializer.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientInitializer.java
index 9d121e584fe909e5a46d15d82f07143679e2febe..cf6f01ddb296103d486118a6e194728f59184ee3 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
 
-package org.openflow.lib.clients;
+package org.opendaylight.openflowjava.protocol.impl.clients;
 
 import io.netty.channel.ChannelInitializer;
 import io.netty.channel.ChannelPipeline;
@@ -9,7 +9,7 @@ import io.netty.handler.ssl.SslHandler;
 
 import javax.net.ssl.SSLEngine;
 
-import org.openflow.lib.SslContextFactory;
+import org.opendaylight.openflowjava.protocol.impl.core.SslContextFactory;
 
 import com.google.common.util.concurrent.SettableFuture;
 
similarity index 88%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/DummyDecoder.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DummyDecoder.java
index 1e3dcef37e6a161883ab1f3a4d5086a2a5219e7c..73d5c235c0d6493cfb915e276f20258439ea640d 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib;\r
+package org.opendaylight.openflowjava.protocol.impl.core;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 import io.netty.channel.ChannelHandlerContext;\r
similarity index 81%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/OFFrameDecoderTest.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoderTest.java
index 9b82c6cd7d052ad7c0d4c0aec19f5514a054f55e..6ad32adbd39470ae6de9723b8f12bd7a14c47df9 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib;\r
+package org.opendaylight.openflowjava.protocol.impl.core;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 import io.netty.channel.embedded.EmbeddedChannel;\r
@@ -7,10 +7,10 @@ import io.netty.channel.embedded.EmbeddedChannel;
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
-import org.openflow.lib.OfFrameDecoder;\r
+import org.opendaylight.openflowjava.protocol.impl.core.OFFrameDecoder;\r
 \r
 /**\r
- * Testing class of {@link OfFrameDecoder}\r
+ * Testing class of {@link OFFrameDecoder}\r
  * @author michal.polkorab\r
  */\r
 public class OFFrameDecoderTest {\r
@@ -22,11 +22,11 @@ public class OFFrameDecoderTest {
      */\r
     @Before\r
     public void setUp() {\r
-        embch = new EmbeddedChannel(new OfFrameDecoder());\r
+        embch = new EmbeddedChannel(new OFFrameDecoder());\r
     }\r
 \r
     /**\r
-     * Test of decoding {@link OfFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
+     * Test of decoding {@link OFFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
      * @throws Exception \r
      */\r
     @Test\r
@@ -41,7 +41,7 @@ public class OFFrameDecoderTest {
     }\r
 \r
     /**\r
-     * Test of decoding {@link OfFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
+     * Test of decoding {@link OFFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
      * @throws Exception \r
      */\r
     @Test\r
@@ -57,7 +57,7 @@ public class OFFrameDecoderTest {
     }\r
 \r
     /**\r
-     * Test of decoding {@link OfFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
+     * Test of decoding {@link OFFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
      * @throws Exception \r
      */\r
     @Test\r
@@ -72,7 +72,7 @@ public class OFFrameDecoderTest {
     }\r
 \r
     /**\r
-     * Test of decoding {@link OfFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
+     * Test of decoding {@link OFFrameDecoder#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)}\r
      * @throws Exception \r
      */\r
     @Test\r
similarity index 77%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/OFVersionDetectorTest.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetectorTest.java
index dcd822d4d8e7377088c932653d60553a2b99d3a8..8bf4907a60e193a3795fa7b3aac2bf2c175076c5 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib;\r
+package org.opendaylight.openflowjava.protocol.impl.core;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 import io.netty.channel.embedded.EmbeddedChannel;\r
@@ -7,8 +7,8 @@ import io.netty.channel.embedded.EmbeddedChannel;
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
-import org.openflow.lib.OfVersionDetector;\r
-import org.openflow.lib.TcpHandler.COMPONENT_NAMES;\r
+import org.opendaylight.openflowjava.protocol.impl.core.OFVersionDetector;\r
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;\r
 \r
 /**\r
  *\r
@@ -23,11 +23,11 @@ public class OFVersionDetectorTest {
      */\r
     @Before\r
     public void setUp() {\r
-        embch = new EmbeddedChannel(new OfVersionDetector());\r
+        embch = new EmbeddedChannel(new OFVersionDetector());\r
     }\r
 \r
     /**\r
-     * Test of decode {@link OfVersionDetector#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)\r
+     * Test of decode {@link OFVersionDetector#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)\r
      * }\r
      * @throws Exception \r
      */\r
@@ -44,7 +44,7 @@ public class OFVersionDetectorTest {
     }\r
     \r
     /**\r
-     * Test of decode {@link OfVersionDetector#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)\r
+     * Test of decode {@link OFVersionDetector#decode(io.netty.channel.ChannelHandlerContext, io.netty.buffer.ByteBuf, java.util.List)\r
      * }\r
      * @throws Exception \r
      */\r
similarity index 94%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/TCPHandlerTest.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandlerTest.java
index 03bc591536adb604e62a69b044d8e1b3c3ae0af8..47b2a33415b56564ccea9bfb0be73a071fc8fc63 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
-package org.openflow.lib;
+package org.opendaylight.openflowjava.protocol.impl.core;
 
 import io.netty.channel.Channel;
 import io.netty.util.concurrent.Future;
@@ -14,7 +14,9 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.openflow.lib.clients.SimpleClient;
+import org.opendaylight.openflowjava.protocol.impl.clients.SimpleClient;
+import org.opendaylight.openflowjava.protocol.impl.core.PublishingChannelInitializer;
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -22,13 +24,13 @@ import org.slf4j.LoggerFactory;
  * 
  * @author michal.polkorab
  */
-public class TCPHandlerTest {
+public class TcpHandlerTest {
 
     /** Name of file in which OpenFLow protocol messages are stored in binary format */
     private static final String OF_BINARY_MESSAGE_INPUT_TXT = "OFBinaryMessageInput.txt";
 
     protected static final Logger LOGGER = LoggerFactory
-            .getLogger(TCPHandlerTest.class);
+            .getLogger(TcpHandlerTest.class);
 
     private static final long CONNECTION_TIMEOUT = 2000;
 
similarity index 77%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/TLSDetectorTest.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/TlsDetectorTest.java
index c473aa84c6ed537e442b040f00a18a45a5f58e5b..1279ef6b08bb352940711c85fbf6e79f6b948333 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib;\r
+package org.opendaylight.openflowjava.protocol.impl.core;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 import io.netty.channel.embedded.EmbeddedChannel;\r
@@ -7,15 +7,15 @@ import io.netty.channel.embedded.EmbeddedChannel;
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
-import org.openflow.lib.TcpHandler;\r
-import org.openflow.lib.TlsDetector;\r
-import org.openflow.lib.TcpHandler.COMPONENT_NAMES;\r
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler;\r
+import org.opendaylight.openflowjava.protocol.impl.core.TlsDetector;\r
+import org.opendaylight.openflowjava.protocol.impl.core.TcpHandler.COMPONENT_NAMES;\r
 \r
 /**\r
  *\r
  * @author michal.polkorab\r
  */\r
-public class TLSDetectorTest {\r
+public class TlsDetectorTest {\r
     \r
     private EmbeddedChannel embch;\r
 \r
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/BarrierReplyMessageFactoryTest.java
new file mode 100644 (file)
index 0000000..bbd8af7
--- /dev/null
@@ -0,0 +1,29 @@
+/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.BarrierReplyMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class BarrierReplyMessageFactoryTest {\r
+\r
+    /**\r
+     * Testing of {@link BarrierReplyMessageFactory} for correct translation into POJO\r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf bb = BufferHelper.buildBuffer(new byte[0]);\r
+        BarrierOutput builtByFactory = BarrierReplyMessageFactory.getInstance().bufferToMessage(bb, HelloMessageFactoryTest.VERSION_YET_SUPPORTED);\r
+\r
+        Assert.assertTrue(builtByFactory.getVersion() == HelloMessageFactoryTest.VERSION_YET_SUPPORTED);\r
+        Assert.assertEquals(builtByFactory.getXid().longValue(), 16909060L);\r
+    }\r
+}\r
@@ -1,13 +1,13 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.junit.Assert;\r
 import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoReplyMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;\r
-import org.openflow.deserialization.factories.EchoReplyMessageFactory;\r
-import org.openflow.lib.util.BufferHelper;\r
 \r
 /**\r
  * @author michal.polkorab\r
@@ -1,13 +1,13 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.junit.Assert;\r
 import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.EchoRequestMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;\r
-import org.openflow.deserialization.factories.EchoRequestMessageFactory;\r
-import org.openflow.lib.util.BufferHelper;\r
 \r
 /**\r
  * @author michal.polkorab\r
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/ExperimenterMessageFactoryTest.java
new file mode 100644 (file)
index 0000000..4991a48
--- /dev/null
@@ -0,0 +1,33 @@
+/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ExperimenterMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class ExperimenterMessageFactoryTest {\r
+\r
+    /**\r
+     * Testing {@link ExperimenterMessageFactory} for correct translation into POJO\r
+     */\r
+    @Test\r
+    public void test() {\r
+        byte[] data = new byte[]{0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04};\r
+        ByteBuf bb = BufferHelper.buildBuffer(data);\r
+        ExperimenterMessage builtByFactory = ExperimenterMessageFactory.getInstance().bufferToMessage(bb, HelloMessageFactoryTest.VERSION_YET_SUPPORTED);\r
+\r
+        Assert.assertTrue(builtByFactory.getVersion() == HelloMessageFactoryTest.VERSION_YET_SUPPORTED);\r
+        Assert.assertEquals(builtByFactory.getXid().longValue(), 16909060L);\r
+        Assert.assertEquals(builtByFactory.getExperimenter().longValue(), 16909060L);\r
+        Assert.assertEquals(builtByFactory.getExpType().longValue(), 16909060L);\r
+    }\r
+\r
+}\r
@@ -1,13 +1,13 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.junit.Assert;\r
 import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.FeaturesReplyMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;\r
-import org.openflow.deserialization.factories.FeaturesReplyMessageFactory;\r
-import org.openflow.lib.util.BufferHelper;\r
 \r
 /**\r
  * @author michal.polkorab\r
@@ -1,13 +1,13 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.deserialization.factories;\r
+package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 \r
 import org.junit.Assert;\r
 import org.junit.Test;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;\r
+import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;\r
-import org.openflow.deserialization.factories.HelloMessageFactory;\r
-import org.openflow.lib.util.BufferHelper;\r
 \r
 /**\r
  * @author michal.polkorab\r
@@ -1,15 +1,16 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.serialization.factories;\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.Test;\r
+import org.opendaylight.openflowjava.protocol.impl.core.OFFrameDecoder;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;\r
+import org.opendaylight.openflowjava.protocol.impl.serialization.factories.HelloInputMessageFactory;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;\r
-import org.openflow.lib.OfFrameDecoder;\r
-import org.openflow.lib.deserialization.factories.HelloMessageFactoryTest;\r
 \r
 /**\r
  * @author michal.polkorab\r
@@ -34,7 +35,7 @@ public class HelloInputMessageFactoryTest {
         \r
         Assert.assertTrue(out.readByte() == HelloMessageFactoryTest.VERSION_YET_SUPPORTED);\r
         Assert.assertTrue(out.readByte() == HELLO_MESSAGE_CODE_TYPE);\r
-        Assert.assertTrue(out.readUnsignedShort() == OfFrameDecoder.LENGTH_OF_HEADER);\r
+        Assert.assertTrue(out.readUnsignedShort() == OFFrameDecoder.LENGTH_OF_HEADER);\r
         Assert.assertTrue(out.readUnsignedInt() == 16909060L);\r
     }\r
 \r
similarity index 88%
rename from openflow-protocol-impl/src/test/java/org/openflow/lib/util/BufferHelper.java
rename to openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/BufferHelper.java
index 2471d86c85ed9d0a85360801bb0849e5550de69b..d6f0fd0832632a55aee92c04a3fbecfbe0c62261 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
-package org.openflow.lib.util;\r
+package org.opendaylight.openflowjava.protocol.impl.util;\r
 \r
 import io.netty.buffer.ByteBuf;\r
 import io.netty.buffer.UnpooledByteBufAllocator;\r