Change GetConfigReq/Res and SetConfig factories to version assignable
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / MessageDeserializerInitializer.java
index 0e6720247913a774eb5e1c26936645663e19c077..d924bc1f0da05c09320c08091aa9c0a03077c0b9 100644 (file)
@@ -21,12 +21,9 @@ import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.Get
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.MultipartReplyMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10BarrierReplyMessageFactory;
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoReplyMessageFactory;
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10EchoRequestMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10ErrorMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FeaturesReplyMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10FlowRemovedMessageFactory;
-import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10GetConfigReplyMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10HelloMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PacketInMessageFactory;
 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.OF10PortStatusMessageFactory;
@@ -55,8 +52,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
 
 /**
+ * Util class for init registration of deserializers.
  * @author michal.polkorab
- *
  */
 public final class MessageDeserializerInitializer {
 
@@ -65,22 +62,21 @@ public final class MessageDeserializerInitializer {
     }
 
     /**
-     * Registers message deserializers
-     *
-     * @param registry
-     *            registry to be filled with deserializers
+     * Registers message deserializers.
+     * @param registry registry to be filled with deserializers
      */
-    public static void registerMessageDeserializers(DeserializerRegistry registry) {
+    public static void registerMessageDeserializers(final DeserializerRegistry registry) {
+        SimpleDeserializerRegistryHelper helper;
+
         // register OF v1.0 message deserializers
-        SimpleDeserializerRegistryHelper helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID,
-                registry);
+        helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF10_VERSION_ID, registry);
         helper.registerDeserializer(0, null, HelloMessage.class, new OF10HelloMessageFactory());
         helper.registerDeserializer(1, null, ErrorMessage.class, new OF10ErrorMessageFactory());
-        helper.registerDeserializer(2, null, EchoRequestMessage.class, new OF10EchoRequestMessageFactory());
-        helper.registerDeserializer(3, null, EchoOutput.class, new OF10EchoReplyMessageFactory());
+        helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());
+        helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());
         helper.registerDeserializer(4, null, ExperimenterMessage.class, new VendorMessageFactory());
         helper.registerDeserializer(6, null, GetFeaturesOutput.class, new OF10FeaturesReplyMessageFactory());
-        helper.registerDeserializer(8, null, GetConfigOutput.class, new OF10GetConfigReplyMessageFactory());
+        helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());
         helper.registerDeserializer(10, null, PacketInMessage.class, new OF10PacketInMessageFactory());
         helper.registerDeserializer(11, null, FlowRemovedMessage.class, new OF10FlowRemovedMessageFactory());
         helper.registerDeserializer(12, null, PortStatusMessage.class, new OF10PortStatusMessageFactory());
@@ -88,7 +84,7 @@ public final class MessageDeserializerInitializer {
         helper.registerDeserializer(19, null, BarrierOutput.class, new OF10BarrierReplyMessageFactory());
         helper.registerDeserializer(21, null, GetQueueConfigOutput.class, new OF10QueueGetConfigReplyMessageFactory());
 
-        // register Of v1.3 message deserializers
+        // register OF v1.3 message deserializers
         helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID, registry);
         helper.registerDeserializer(0, null, HelloMessage.class, new HelloMessageFactory());
         helper.registerDeserializer(1, null, ErrorMessage.class, new ErrorMessageFactory());
@@ -105,5 +101,19 @@ public final class MessageDeserializerInitializer {
         helper.registerDeserializer(23, null, GetQueueConfigOutput.class, new QueueGetConfigReplyMessageFactory());
         helper.registerDeserializer(25, null, RoleRequestOutput.class, new RoleReplyMessageFactory());
         helper.registerDeserializer(27, null, GetAsyncOutput.class, new GetAsyncReplyMessageFactory());
+
+        // register OF v1.4 message deserializers
+        helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF14_VERSION_ID, registry);
+        helper.registerDeserializer(0, null, HelloMessage.class, new HelloMessageFactory());
+        helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());
+        helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());
+        helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());
+
+        // register OF v1.5 message deserializers
+        helper = new SimpleDeserializerRegistryHelper(EncodeConstants.OF15_VERSION_ID, registry);
+        helper.registerDeserializer(0, null, HelloMessage.class, new HelloMessageFactory());
+        helper.registerDeserializer(2, null, EchoRequestMessage.class, new EchoRequestMessageFactory());
+        helper.registerDeserializer(3, null, EchoOutput.class, new EchoReplyMessageFactory());
+        helper.registerDeserializer(8, null, GetConfigOutput.class, new GetConfigReplyMessageFactory());
     }
 }