Refactoring file structure for protobufs.
Change-Id: I50daf100d54750f97158304d87813e67861b1422
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 40c6561..696467b 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,12 +18,12 @@
import com.google.protobuf.GeneratedMessageV3;
import org.onosproject.event.Event;
-import org.onosproject.grpc.net.Device.DeviceCore;
-import org.onosproject.grpc.net.Device.DeviceType;
-import org.onosproject.grpc.net.DeviceEvent.DeviceEventType;
-import org.onosproject.grpc.net.DeviceEvent.DeviceNotification;
-import org.onosproject.grpc.net.Port.PortCore;
-import org.onosproject.grpc.net.Port.PortType;
+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;
import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@
if (!deviceEventTypeSupported(deviceEvent)) {
log.error("Unsupported Onos Device Event {}. There is no matching"
- + "proto Device Event type", deviceEvent.type().toString());
+ + "proto Device Event type", deviceEvent.type().toString());
return null;
}
@@ -70,8 +70,8 @@
DeviceNotification.Builder notificationBuilder =
DeviceNotification.newBuilder();
- DeviceCore deviceCore =
- DeviceCore.newBuilder()
+ DeviceProto deviceCore =
+ DeviceProto.newBuilder()
.setChassisId(deviceEvent.subject().chassisId().id()
.toString())
.setDeviceId(deviceEvent.subject().id().toString())
@@ -83,10 +83,10 @@
.valueOf(deviceEvent.subject().type().name()))
.build();
- PortCore portCore = null;
+ PortProtoOuterClass.PortProto portProto = null;
if (deviceEvent.port() != null) {
- portCore =
- PortCore.newBuilder()
+ portProto =
+ PortProtoOuterClass.PortProto.newBuilder()
.setIsEnabled(deviceEvent.port().isEnabled())
.setPortNumber(deviceEvent.port().number()
.toString())
@@ -95,7 +95,7 @@
.valueOf(deviceEvent.port().type().name()))
.build();
- notificationBuilder.setPort(portCore);
+ notificationBuilder.setPort(portProto);
}
notificationBuilder.setDeviceEventType(getProtoType(deviceEvent))
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 fe18f42..c8d4bca 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
@@ -16,12 +16,12 @@
package org.onosproject.kafkaintegration.converter;
import org.onosproject.event.Event;
-import org.onosproject.grpc.net.Link.ConnectPoint;
-import org.onosproject.grpc.net.Link.LinkCore;
-import org.onosproject.grpc.net.Link.LinkState;
-import org.onosproject.grpc.net.Link.LinkType;
-import org.onosproject.grpc.net.LinkEvent.LinkEventType;
-import org.onosproject.grpc.net.LinkEvent.LinkNotification;
+import org.onosproject.grpc.net.models.ConnectPointProto.ConnectPoint;
+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;
@@ -42,7 +42,7 @@
if (!linkEventTypeSupported(linkEvent)) {
log.error("Unsupported Onos Event {}. There is no matching "
- + "proto Event type", linkEvent.type().toString());
+ + "proto Event type", linkEvent.type().toString());
return null;
}
@@ -62,20 +62,20 @@
private LinkNotification buildDeviceProtoMessage(LinkEvent linkEvent) {
LinkNotification notification = LinkNotification.newBuilder()
.setLinkEventType(getProtoType(linkEvent))
- .setLink(LinkCore.newBuilder()
- .setState(LinkState
- .valueOf(linkEvent.subject().state().name()))
- .setType(LinkType.valueOf(linkEvent.subject().type().name()))
- .setDst(ConnectPoint.newBuilder()
- .setDeviceId(linkEvent.subject().dst()
- .deviceId().toString())
- .setPortNumber(linkEvent.subject().dst().port()
- .toString()))
- .setSrc(ConnectPoint.newBuilder()
- .setDeviceId(linkEvent.subject().src()
- .deviceId().toString())
- .setPortNumber(linkEvent.subject().src().port()
- .toString())))
+ .setLink(LinkProto.newBuilder()
+ .setState(LinkState
+ .valueOf(linkEvent.subject().state().name()))
+ .setType(LinkType.valueOf(linkEvent.subject().type().name()))
+ .setDst(ConnectPoint.newBuilder()
+ .setDeviceId(linkEvent.subject().dst()
+ .deviceId().toString())
+ .setPortNumber(linkEvent.subject().dst().port()
+ .toString()))
+ .setSrc(ConnectPoint.newBuilder()
+ .setDeviceId(linkEvent.subject().src()
+ .deviceId().toString())
+ .setPortNumber(linkEvent.subject().src().port()
+ .toString())))
.build();
return notification;