Refactor protocol buffer to split models into different packages

Change-Id: I26152ba227ebe9afd871c6e501ccca17c49e1e4e
diff --git a/apps/kafka-integration/api/pom.xml b/apps/kafka-integration/api/pom.xml
index 9d92bf2..7eb49f9 100644
--- a/apps/kafka-integration/api/pom.xml
+++ b/apps/kafka-integration/api/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <artifactId>onos-kafka</artifactId>
         <groupId>org.onosproject</groupId>
-        <version>1.11-SNAPSHOT</version>
+        <version>1.11.0-SNAPSHOT</version>
     </parent>
 
     <artifactId>onos-app-kafka-api</artifactId>
diff --git a/apps/kafka-integration/app/pom.xml b/apps/kafka-integration/app/pom.xml
index ea1eaed..0cd5b4a 100644
--- a/apps/kafka-integration/app/pom.xml
+++ b/apps/kafka-integration/app/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onosproject</groupId>
         <artifactId>onos-kafka</artifactId>
-        <version>1.11-SNAPSHOT</version>
+        <version>1.11.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/apps/kafka-integration/core/pom.xml b/apps/kafka-integration/core/pom.xml
index 6b5380a..683e9c7 100644
--- a/apps/kafka-integration/core/pom.xml
+++ b/apps/kafka-integration/core/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.onosproject</groupId>
         <artifactId>onos-kafka</artifactId>
-        <version>1.11-SNAPSHOT</version>
+        <version>1.11.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/DeviceEventConverter.java b/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/DeviceEventConverter.java
index 696467b..c6652a3 100644
--- a/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/DeviceEventConverter.java
+++ b/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/DeviceEventConverter.java
@@ -18,11 +18,11 @@
 import com.google.protobuf.GeneratedMessageV3;
 
 import org.onosproject.event.Event;
+import org.onosproject.grpc.net.device.models.DeviceEnumsProto.DeviceEventTypeProto;
+import org.onosproject.grpc.net.device.models.DeviceEnumsProto.DeviceTypeProto;
+import org.onosproject.grpc.net.device.models.DeviceEventProto.DeviceNotificationProto;
+import org.onosproject.grpc.net.device.models.PortEnumsProto;
 import org.onosproject.grpc.net.models.DeviceProtoOuterClass.DeviceProto;
-import org.onosproject.grpc.net.models.DeviceEnums.DeviceType;
-import org.onosproject.grpc.net.models.DeviceEnums.DeviceEventType;
-import org.onosproject.grpc.net.models.DeviceEventProto.DeviceNotification;
-import org.onosproject.grpc.net.models.PortEnums.PortType;
 import org.onosproject.grpc.net.models.PortProtoOuterClass;
 import org.onosproject.net.device.DeviceEvent;
 import org.slf4j.Logger;
@@ -56,8 +56,8 @@
      * @return true if there is a match and false otherwise
      */
     private boolean deviceEventTypeSupported(DeviceEvent event) {
-        DeviceEventType[] deviceEvents = DeviceEventType.values();
-        for (DeviceEventType deviceEventType : deviceEvents) {
+        DeviceEventTypeProto[] deviceEvents = DeviceEventTypeProto.values();
+        for (DeviceEventTypeProto deviceEventType : deviceEvents) {
             if (deviceEventType.name().equals(event.type().name())) {
                 return true;
             }
@@ -66,9 +66,9 @@
         return false;
     }
 
-    private DeviceNotification buildDeviceProtoMessage(DeviceEvent deviceEvent) {
-        DeviceNotification.Builder notificationBuilder =
-                DeviceNotification.newBuilder();
+    private DeviceNotificationProto buildDeviceProtoMessage(DeviceEvent deviceEvent) {
+        DeviceNotificationProto.Builder notificationBuilder =
+                DeviceNotificationProto.newBuilder();
 
         DeviceProto deviceCore =
                 DeviceProto.newBuilder()
@@ -79,7 +79,7 @@
                         .setManufacturer(deviceEvent.subject().manufacturer())
                         .setSerialNumber(deviceEvent.subject().serialNumber())
                         .setSwVersion(deviceEvent.subject().swVersion())
-                        .setType(DeviceType
+                        .setType(DeviceTypeProto
                                          .valueOf(deviceEvent.subject().type().name()))
                         .build();
 
@@ -91,7 +91,7 @@
                             .setPortNumber(deviceEvent.port().number()
                                                    .toString())
                             .setPortSpeed(deviceEvent.port().portSpeed())
-                            .setType(PortType
+                            .setType(PortEnumsProto.PortTypeProto
                                              .valueOf(deviceEvent.port().type().name()))
                             .build();
 
@@ -110,10 +110,10 @@
      * @param event ONOS Device Event
      * @return generated Device Event Type
      */
-    private DeviceEventType getProtoType(DeviceEvent event) {
-        DeviceEventType protobufEventType = null;
-        DeviceEventType[] deviceEvents = DeviceEventType.values();
-        for (DeviceEventType deviceEventType : deviceEvents) {
+    private DeviceEventTypeProto getProtoType(DeviceEvent event) {
+        DeviceEventTypeProto protobufEventType = null;
+        DeviceEventTypeProto[] deviceEvents = DeviceEventTypeProto.values();
+        for (DeviceEventTypeProto deviceEventType : deviceEvents) {
             if (deviceEventType.name().equals(event.type().name())) {
                 protobufEventType = deviceEventType;
             }
diff --git a/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/LinkEventConverter.java b/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/LinkEventConverter.java
index c8d4bca..81bc90c 100644
--- a/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/LinkEventConverter.java
+++ b/apps/kafka-integration/core/src/main/java/org/onosproject/kafkaintegration/converter/LinkEventConverter.java
@@ -15,19 +15,18 @@
  */
 package org.onosproject.kafkaintegration.converter;
 
+import com.google.protobuf.GeneratedMessageV3;
 import org.onosproject.event.Event;
-import org.onosproject.grpc.net.models.ConnectPointProto.ConnectPoint;
+import org.onosproject.grpc.net.link.models.LinkEnumsProto.LinkEventTypeProto;
+import org.onosproject.grpc.net.link.models.LinkEnumsProto.LinkStateProto;
+import org.onosproject.grpc.net.link.models.LinkEnumsProto.LinkTypeProto;
+import org.onosproject.grpc.net.link.models.LinkEventProto.LinkNotificationProto;
+import org.onosproject.grpc.net.models.ConnectPointProtoOuterClass.ConnectPointProto;
 import org.onosproject.grpc.net.models.LinkProtoOuterClass.LinkProto;
-import org.onosproject.grpc.net.models.LinkEnums.LinkState;
-import org.onosproject.grpc.net.models.LinkEnums.LinkType;
-import org.onosproject.grpc.net.models.LinkEnums.LinkEventType;
-import org.onosproject.grpc.net.models.LinkEventProto.LinkNotification;
 import org.onosproject.net.link.LinkEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.protobuf.GeneratedMessageV3;
-
 /**
  * Converts for ONOS Link event message to protobuf format.
  */
@@ -50,8 +49,8 @@
     }
 
     private boolean linkEventTypeSupported(LinkEvent event) {
-        LinkEventType[] kafkaLinkEvents = LinkEventType.values();
-        for (LinkEventType linkEventType : kafkaLinkEvents) {
+        LinkEventTypeProto[] kafkaLinkEvents = LinkEventTypeProto.values();
+        for (LinkEventTypeProto linkEventType : kafkaLinkEvents) {
             if (linkEventType.name().equals(event.type().name())) {
                 return true;
             }
@@ -59,19 +58,19 @@
         return false;
     }
 
-    private LinkNotification buildDeviceProtoMessage(LinkEvent linkEvent) {
-        LinkNotification notification = LinkNotification.newBuilder()
+    private LinkNotificationProto buildDeviceProtoMessage(LinkEvent linkEvent) {
+        LinkNotificationProto notification = LinkNotificationProto.newBuilder()
                 .setLinkEventType(getProtoType(linkEvent))
                 .setLink(LinkProto.newBuilder()
-                                 .setState(LinkState
+                                 .setState(LinkStateProto.ACTIVE
                                                    .valueOf(linkEvent.subject().state().name()))
-                                 .setType(LinkType.valueOf(linkEvent.subject().type().name()))
-                                 .setDst(ConnectPoint.newBuilder()
+                                 .setType(LinkTypeProto.valueOf(linkEvent.subject().type().name()))
+                                 .setDst(ConnectPointProto.newBuilder()
                                                  .setDeviceId(linkEvent.subject().dst()
                                                                       .deviceId().toString())
                                                  .setPortNumber(linkEvent.subject().dst().port()
                                                                         .toString()))
-                                 .setSrc(ConnectPoint.newBuilder()
+                                 .setSrc(ConnectPointProto.newBuilder()
                                                  .setDeviceId(linkEvent.subject().src()
                                                                       .deviceId().toString())
                                                  .setPortNumber(linkEvent.subject().src().port()
@@ -88,10 +87,10 @@
      * @param event ONOS Device Event
      * @return Kafka Device Event Type
      */
-    private LinkEventType getProtoType(LinkEvent event) {
-        LinkEventType generatedEventType = null;
-        LinkEventType[] kafkaEvents = LinkEventType.values();
-        for (LinkEventType linkEventType : kafkaEvents) {
+    private LinkEventTypeProto getProtoType(LinkEvent event) {
+        LinkEventTypeProto generatedEventType = null;
+        LinkEventTypeProto[] kafkaEvents = LinkEventTypeProto.values();
+        for (LinkEventTypeProto linkEventType : kafkaEvents) {
             if (linkEventType.name().equals(event.type().name())) {
                 generatedEventType = linkEventType;
             }
diff --git a/apps/kafka-integration/pom.xml b/apps/kafka-integration/pom.xml
index 6adcf23..ffc91ee 100644
--- a/apps/kafka-integration/pom.xml
+++ b/apps/kafka-integration/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onosproject</groupId>
         <artifactId>onos-apps</artifactId>
-        <version>1.11-SNAPSHOT</version>
+        <version>1.11.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
diff --git a/apps/kafka-integration/web/pom.xml b/apps/kafka-integration/web/pom.xml
index 6243a2a..996fa6fe 100644
--- a/apps/kafka-integration/web/pom.xml
+++ b/apps/kafka-integration/web/pom.xml
@@ -20,7 +20,7 @@
     <parent>
         <groupId>org.onosproject</groupId>
         <artifactId>onos-kafka</artifactId>
-        <version>1.11-SNAPSHOT</version>
+        <version>1.11.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -52,7 +52,7 @@
 
         <dependency>
             <groupId>org.onosproject</groupId>
-            <artifactId>onos-incubator-protobuf</artifactId>
+            <artifactId>onos-incubator-protobuf-models</artifactId>
             <version>${project.version}</version>
         </dependency>
 
diff --git a/apps/pom.xml b/apps/pom.xml
index ad946b9..5f0052b 100644
--- a/apps/pom.xml
+++ b/apps/pom.xml
@@ -48,7 +48,7 @@
         <module>flowspec-api</module>
         <module>test</module>
         <module>segmentrouting</module>
-        <!-- <module>kafka-integration</module> -->
+        <module>kafka-integration</module>
         <module>pcep-api</module>
         <module>iptopology-api</module>
         <module>pce</module>