Performacne improvements via adding a netty-based openflowj and openflow plugin;...
[controller.git] / third-party / openflowj_netty / src / main / java / org / openflow / vendor / nicira / OFNiciraVendorExtensions.java
diff --git a/third-party/openflowj_netty/src/main/java/org/openflow/vendor/nicira/OFNiciraVendorExtensions.java b/third-party/openflowj_netty/src/main/java/org/openflow/vendor/nicira/OFNiciraVendorExtensions.java
new file mode 100644 (file)
index 0000000..98f88b2
--- /dev/null
@@ -0,0 +1,30 @@
+package org.openflow.vendor.nicira;
+
+import org.openflow.protocol.vendor.OFBasicVendorDataType;
+import org.openflow.protocol.vendor.OFBasicVendorId;
+import org.openflow.protocol.vendor.OFVendorId;
+
+public class OFNiciraVendorExtensions {
+    private static boolean initialized = false;
+
+    public static synchronized void initialize() {
+        if (initialized)
+            return;
+
+        // Configure openflowj to be able to parse the role request/reply
+        // vendor messages.
+        OFBasicVendorId niciraVendorId =
+                new OFBasicVendorId(OFNiciraVendorData.NX_VENDOR_ID, 4);
+        OFVendorId.registerVendorId(niciraVendorId);
+        OFBasicVendorDataType roleRequestVendorData =
+                new OFBasicVendorDataType(OFRoleRequestVendorData.NXT_ROLE_REQUEST,
+                        OFRoleRequestVendorData.getInstantiable());
+        niciraVendorId.registerVendorDataType(roleRequestVendorData);
+        OFBasicVendorDataType roleReplyVendorData =
+                new OFBasicVendorDataType(OFRoleReplyVendorData.NXT_ROLE_REPLY,
+                        OFRoleReplyVendorData.getInstantiable());
+        niciraVendorId.registerVendorDataType(roleReplyVendorData);
+
+        initialized = true;
+    }
+}