netty4 OpenFlow southbound

- separate I/O thread and message dispatch threads

Change-Id: I11a10a47de451a9e3063b62f9450be19c3a9dae7
diff --git a/protocols/openflow/ctl/pom.xml b/protocols/openflow/ctl/pom.xml
index 7dcd69d..baccf7c 100644
--- a/protocols/openflow/ctl/pom.xml
+++ b/protocols/openflow/ctl/pom.xml
@@ -20,29 +20,56 @@
 
     <parent>
         <groupId>org.onosproject</groupId>
-        <artifactId>onos-of</artifactId>
+        <artifactId>onos-protocols-openflow</artifactId>
         <version>1.11.0-SNAPSHOT</version>
     </parent>
 
-    <artifactId>onos-of-ctl</artifactId>
+    <artifactId>onos-protocols-openflow-ctl</artifactId>
     <packaging>bundle</packaging>
 
     <description>ONOS OpenFlow controller subsystem API</description>
 
     <dependencies>
+
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-common</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+            <version>${netty4.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport-native-epoll</artifactId>
+            <version>${netty4.version}</version>
+            <classifier>linux-x86_64</classifier>
+        </dependency>
+<!--
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport-native-kqueue</artifactId>
+            <version>${netty4.version}</version>
+        </dependency>
+ -->
         <dependency>
             <groupId>org.onosproject</groupId>
-            <artifactId>onos-of-api</artifactId>
+            <artifactId>onos-protocols-openflow-api</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.onosproject</groupId>
             <artifactId>openflowj</artifactId>
         </dependency>
         <dependency>
-            <groupId>io.netty</groupId>
-            <artifactId>netty</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.scr.annotations</artifactId>
         </dependency>
@@ -68,6 +95,38 @@
                 <groupId>org.onosproject</groupId>
                 <artifactId>onos-maven-plugin</artifactId>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+
+                <!--
+                    Netty native code related utils seems to assume,
+                    Native related loading uses same class loader(~=bundle)
+                    Embed inline required slice of netty-common and native-transport
+                 -->
+                <configuration>
+                    <instructions combine.children="append">
+                        <DynamicImport-Package>*</DynamicImport-Package>
+                        <Embed-Dependency>
+                            netty-transport-native-epoll;inline=true,
+                            *;artifactId=netty-common;inline=io/netty/util/internal/*,
+                        </Embed-Dependency>
+                        <Embed-Transitive>false</Embed-Transitive>
+                        <Bundle-NativeCode>
+                            META-INF/native/libnetty-transport-native-epoll.so;osname=linux;processor=x86_64,
+                            *
+                        </Bundle-NativeCode>
+                        <Import-Package>
+                        sun.misc;resolution:=optional,
+                        org.apache.commons.logging;resolution:=optional,
+                        org.apache.logging.log4j;resolution:=optional,
+                        *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+
         </plugins>
     </build>