Refactor protocol buffer to split models into different packages
Change-Id: I26152ba227ebe9afd871c6e501ccca17c49e1e4e
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;
}