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>
diff --git a/incubator/pom.xml b/incubator/pom.xml
index cc945fc..310dc18 100644
--- a/incubator/pom.xml
+++ b/incubator/pom.xml
@@ -39,7 +39,7 @@
<module>grpc-dependencies</module>
<module>protobuf</module>
<module>rpc</module>
- <!-- <module>rpc-grpc</module> -->
+ <module>rpc-grpc</module>
<module>rpc-nb</module>
<module>protobuf-nb</module>
<module>grpc</module>
diff --git a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/ProtobufUtils.java b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/ProtobufUtils.java
index ff29b27..481839a 100644
--- a/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/ProtobufUtils.java
+++ b/incubator/protobuf/models/src/main/java/org/onosproject/incubator/protobuf/models/ProtobufUtils.java
@@ -20,12 +20,12 @@
import java.util.Map;
import org.onlab.packet.ChassisId;
-import org.onosproject.grpc.net.models.DeviceDescriptionProto;
-import org.onosproject.grpc.net.models.DeviceEnums;
-import org.onosproject.grpc.net.models.PortDescriptionProto;
-import org.onosproject.grpc.net.models.PortEnums.PortType;
-import org.onosproject.grpc.net.models.DeviceEnums.DeviceType;
-import org.onosproject.grpc.net.models.PortStatisticsProto;
+import org.onosproject.grpc.net.device.models.DeviceDescriptionProtoOuterClass.DeviceDescriptionProto;
+import org.onosproject.grpc.net.device.models.DeviceEnumsProto.MastershipRoleProto;
+import org.onosproject.grpc.net.device.models.PortDescriptionProtoOuterClass.PortDescriptionProto;
+import org.onosproject.grpc.net.device.models.PortEnumsProto.PortTypeProto;
+import org.onosproject.grpc.net.device.models.DeviceEnumsProto.DeviceTypeProto;
+import org.onosproject.grpc.net.device.models.PortStatisticsProtoOuterClass.PortStatisticsProto;
import org.onosproject.net.Annotations;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.Device;
@@ -54,12 +54,12 @@
private static final Logger log = LoggerFactory.getLogger(ProtobufUtils.class);
/**
- * Translates gRPC enum MastershipRole to ONOS enum.
+ * Translates gRPC enum MastershipRoleProto to ONOS enum.
*
* @param role mastership role in gRPC enum
* @return equivalent in ONOS enum
*/
- public static MastershipRole translate(DeviceEnums.MastershipRole role) {
+ public static MastershipRole translate(MastershipRoleProto role) {
switch (role) {
case NONE:
return MastershipRole.NONE;
@@ -81,52 +81,52 @@
* @param newRole ONOS' mastership role
* @return equivalent in gRPC message enum
*/
- public static DeviceEnums.MastershipRole translate(MastershipRole newRole) {
+ public static MastershipRoleProto translate(MastershipRole newRole) {
switch (newRole) {
case MASTER:
- return DeviceEnums.MastershipRole.MASTER;
+ return MastershipRoleProto.MASTER;
case STANDBY:
- return DeviceEnums.MastershipRole.STANDBY;
+ return MastershipRoleProto.STANDBY;
case NONE:
default:
- return DeviceEnums.MastershipRole.NONE;
+ return MastershipRoleProto.NONE;
}
}
/**
- * Translates gRPC DeviceDescription to {@link DeviceDescription}.
+ * Translates gRPC DeviceDescriptionProto to {@link DeviceDescription}.
*
- * @param deviceDescription gRPC message
+ * @param devDescProto device description protobuf message
* @return {@link DeviceDescription}
*/
public static DeviceDescription translate(
- DeviceDescriptionProto.DeviceDescription deviceDescription) {
- URI uri = URI.create(deviceDescription.getDeviceUri());
- Device.Type type = translate(deviceDescription.getType());
- String manufacturer = deviceDescription.getManufacturer();
- String hwVersion = deviceDescription.getHwVersion();
- String swVersion = deviceDescription.getSwVersion();
- String serialNumber = deviceDescription.getSerialNumber();
- ChassisId chassis = new ChassisId(deviceDescription.getChassisId());
- boolean defaultAvailable = deviceDescription.getIsDefaultAvailable();
+ DeviceDescriptionProto devDescProto) {
+ URI uri = URI.create(devDescProto.getDeviceUri());
+ Device.Type type = translate(devDescProto.getType());
+ String manufacturer = devDescProto.getManufacturer();
+ String hwVersion = devDescProto.getHwVersion();
+ String swVersion = devDescProto.getSwVersion();
+ String serialNumber = devDescProto.getSerialNumber();
+ ChassisId chassis = new ChassisId(devDescProto.getChassisId());
+ boolean defaultAvailable = devDescProto.getIsDefaultAvailable();
return new DefaultDeviceDescription(uri, type, manufacturer,
hwVersion, swVersion, serialNumber,
chassis,
defaultAvailable,
- asAnnotations(deviceDescription.getAnnotationsMap()));
+ asAnnotations(devDescProto.getAnnotationsMap()));
}
/**
- * Translates {@link DeviceDescription} to gRPC DeviceDescription message.
+ * Translates {@link DeviceDescription} to gRPC DeviceDescriptionProto message.
*
* @param deviceDescription {@link DeviceDescription}
- * @return gRPC DeviceDescription message
+ * @return gRPC DeviceDescriptionProto message
*/
- public static DeviceDescriptionProto.DeviceDescription translate(
+ public static DeviceDescriptionProto translate(
DeviceDescription deviceDescription) {
- return DeviceDescriptionProto.DeviceDescription.newBuilder()
+ return DeviceDescriptionProto.newBuilder()
.setDeviceUri(deviceDescription.deviceUri().toString())
.setType(translate(deviceDescription.type()))
.setManufacturer(deviceDescription.manufacturer())
@@ -141,12 +141,12 @@
/**
- * Translates gRPC DeviceType to {@link Device.Type}.
+ * Translates gRPC DeviceTypeProto to {@link Device.Type}.
*
* @param type gRPC message
* @return {@link Device.Type}
*/
- public static Device.Type translate(DeviceType type) {
+ public static Device.Type translate(DeviceTypeProto type) {
switch (type) {
case BALANCER:
return Device.Type.BALANCER;
@@ -174,7 +174,7 @@
return Device.Type.ROUTER;
case SWITCH:
return Device.Type.SWITCH;
- case VIRTUAL:
+ case VIRTUAL_DEVICE:
return Device.Type.VIRTUAL;
case UNRECOGNIZED:
@@ -185,55 +185,55 @@
}
/**
- * Translates {@link Type} to gRPC DeviceType.
+ * Translates {@link Type} to gRPC DeviceTypeProto.
*
* @param type {@link Type}
* @return gRPC message
*/
- public static DeviceType translate(Device.Type type) {
+ public static DeviceTypeProto translate(Device.Type type) {
switch (type) {
case BALANCER:
- return DeviceType.BALANCER;
+ return DeviceTypeProto.BALANCER;
case CONTROLLER:
- return DeviceType.CONTROLLER;
+ return DeviceTypeProto.CONTROLLER;
case FIBER_SWITCH:
- return DeviceType.FIBER_SWITCH;
+ return DeviceTypeProto.FIBER_SWITCH;
case FIREWALL:
- return DeviceType.FIREWALL;
+ return DeviceTypeProto.FIREWALL;
case IDS:
- return DeviceType.IDS;
+ return DeviceTypeProto.IDS;
case IPS:
- return DeviceType.IPS;
+ return DeviceTypeProto.IPS;
case MICROWAVE:
- return DeviceType.MICROWAVE;
+ return DeviceTypeProto.MICROWAVE;
case OTHER:
- return DeviceType.OTHER;
+ return DeviceTypeProto.OTHER;
case OTN:
- return DeviceType.OTN;
+ return DeviceTypeProto.OTN;
case ROADM:
- return DeviceType.ROADM;
+ return DeviceTypeProto.ROADM;
case ROADM_OTN:
- return DeviceType.ROADM_OTN;
+ return DeviceTypeProto.ROADM_OTN;
case ROUTER:
- return DeviceType.ROUTER;
+ return DeviceTypeProto.ROUTER;
case SWITCH:
- return DeviceType.SWITCH;
+ return DeviceTypeProto.SWITCH;
case VIRTUAL:
- return DeviceType.VIRTUAL;
+ return DeviceTypeProto.VIRTUAL_DEVICE;
default:
log.warn("Unexpected Device.Type: {}", type);
- return DeviceType.OTHER;
+ return DeviceTypeProto.OTHER;
}
}
/**
- * Translates gRPC PortDescription message to {@link PortDescription}.
+ * Translates gRPC PortDescriptionProto message to {@link PortDescription}.
*
* @param portDescription gRPC message
* @return {@link PortDescription}
*/
- public static PortDescription translate(PortDescriptionProto.PortDescription portDescription) {
+ public static PortDescription translate(PortDescriptionProto portDescription) {
PortNumber number = PortNumber.fromString(portDescription.getPortNumber());
boolean isEnabled = portDescription.getIsEnabled();
Port.Type type = translate(portDescription.getType());
@@ -243,13 +243,13 @@
}
/**
- * Translates {@link PortDescription} to gRPC PortDescription message.
+ * Translates {@link PortDescription} to gRPC PortDescriptionProto message.
*
* @param portDescription {@link PortDescription}
- * @return gRPC PortDescription message
+ * @return gRPC PortDescriptionProto message
*/
- public static PortDescriptionProto.PortDescription translate(PortDescription portDescription) {
- return PortDescriptionProto.PortDescription.newBuilder()
+ public static PortDescriptionProto translate(PortDescription portDescription) {
+ return PortDescriptionProto.newBuilder()
.setPortNumber(portDescription.portNumber().toString())
.setIsEnabled(portDescription.isEnabled())
.setType(translate(portDescription.type()))
@@ -259,12 +259,12 @@
}
/**
- * Translates gRPC PortType to {@link Port.Type}.
+ * Translates gRPC PortTypeProto to {@link Port.Type}.
*
* @param type gRPC message
* @return {@link Port.Type}
*/
- public static Port.Type translate(org.onosproject.grpc.net.models.PortEnums.PortType type) {
+ public static Port.Type translate(PortTypeProto type) {
switch (type) {
case COPPER:
return Type.COPPER;
@@ -278,7 +278,7 @@
return Type.OMS;
case PACKET:
return Type.PACKET;
- case VIRTUAL:
+ case VIRTUAL_PORT:
return Type.VIRTUAL;
case UNRECOGNIZED:
@@ -294,26 +294,26 @@
* @param type {@link org.onosproject.net.Port.Type}
* @return gRPC message
*/
- public static PortType translate(Port.Type type) {
+ public static PortTypeProto translate(Port.Type type) {
switch (type) {
case COPPER:
- return PortType.COPPER;
+ return PortTypeProto.COPPER;
case FIBER:
- return PortType.FIBER;
+ return PortTypeProto.FIBER;
case OCH:
- return PortType.OCH;
+ return PortTypeProto.OCH;
case ODUCLT:
- return PortType.ODUCLT;
+ return PortTypeProto.ODUCLT;
case OMS:
- return PortType.OMS;
+ return PortTypeProto.OMS;
case PACKET:
- return PortType.PACKET;
+ return PortTypeProto.PACKET;
case VIRTUAL:
- return PortType.VIRTUAL;
+ return PortTypeProto.VIRTUAL_PORT;
default:
log.warn("Unexpected Port.Type: {}", type);
- return PortType.COPPER;
+ return PortTypeProto.COPPER;
}
}
@@ -323,7 +323,7 @@
* @param portStatistics gRPC PortStatistics message
* @return {@link PortStatistics}
*/
- public static PortStatistics translate(PortStatisticsProto.PortStatistics portStatistics) {
+ public static PortStatistics translate(PortStatisticsProto portStatistics) {
// TODO implement adding missing fields
return DefaultPortStatistics.builder()
.setPort(portStatistics.getPort())
@@ -338,9 +338,9 @@
* @param portStatistics {@link PortStatistics}
* @return gRPC PortStatistics message
*/
- public static PortStatisticsProto.PortStatistics translate(PortStatistics portStatistics) {
+ public static PortStatisticsProto translate(PortStatistics portStatistics) {
// TODO implement adding missing fields
- return PortStatisticsProto.PortStatistics.newBuilder()
+ return PortStatisticsProto.newBuilder()
.setPort(portStatistics.port())
.setPacketsReceived(portStatistics.packetsReceived())
.setPacketsSent(portStatistics.packetsSent())
diff --git a/incubator/protobuf/models/src/main/proto/DeviceDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/DeviceDescriptionProto.proto
deleted file mode 100644
index b620bfa..0000000
--- a/incubator/protobuf/models/src/main/proto/DeviceDescriptionProto.proto
+++ /dev/null
@@ -1,18 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
-
-package Device;
-
-import "DeviceEnums.proto";
-
-message DeviceDescription {
- string device_Uri = 1;
- Device.DeviceType type = 2;
- string manufacturer = 3;
- string hw_version = 4;
- string sw_version = 5;
- string serial_number = 6;
- string chassis_id = 7;
- map<string, string> annotations = 8;
- bool is_default_available = 9;
-}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/DeviceEventProto.proto b/incubator/protobuf/models/src/main/proto/DeviceEventProto.proto
deleted file mode 100644
index 9cbbf60..0000000
--- a/incubator/protobuf/models/src/main/proto/DeviceEventProto.proto
+++ /dev/null
@@ -1,16 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
-
-
-import "DeviceProto.proto";
-import "DeviceEnums.proto";
-import "PortProto.proto";
-
-package Device;
-
-// Corresponds to org.onosproject.net.device.DeviceEvent.
-message DeviceNotification {
- Device.DeviceProto device = 1;
- Device.DeviceEventType deviceEventType = 2;
- Port.PortProto port = 3;
-}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/LinkDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/LinkDescriptionProto.proto
deleted file mode 100644
index 16fe534..0000000
--- a/incubator/protobuf/models/src/main/proto/LinkDescriptionProto.proto
+++ /dev/null
@@ -1,14 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
-
-package Link;
-
-import "ConnectPointProto.proto";
-import "LinkEnums.proto";
-
-message LinkDescription {
- ConnectPoint.ConnectPoint src = 1;
- ConnectPoint.ConnectPoint dst = 2;
- Link.LinkType type = 3;
- map<string, string> annotations = 4;
-}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/LinkEventProto.proto b/incubator/protobuf/models/src/main/proto/LinkEventProto.proto
deleted file mode 100644
index be1ee41..0000000
--- a/incubator/protobuf/models/src/main/proto/LinkEventProto.proto
+++ /dev/null
@@ -1,13 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
-
-package Link;
-
-import "LinkProto.proto";
-import "LinkEnums.proto";
-
-// Corresponds to org.onosproject.net.link.LinkEvent.
-message LinkNotification {
- Link.LinkEventType linkEventType = 2;
- Link.LinkProto link = 3;
-}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/LinkProto.proto b/incubator/protobuf/models/src/main/proto/LinkProto.proto
deleted file mode 100644
index 2355618..0000000
--- a/incubator/protobuf/models/src/main/proto/LinkProto.proto
+++ /dev/null
@@ -1,18 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
-
-package Link;
-
-import "LinkEnums.proto";
-import "ConnectPointProto.proto";
-
-// Corresponds to org.onosproject.net.Link.
-message LinkProto {
- Link.LinkState state = 1;
- ConnectPoint.ConnectPoint src = 2;
- ConnectPoint.ConnectPoint dst = 3;
- Link.LinkType type = 4;
- map<string, string> annotations = 5;
-}
-
-
diff --git a/incubator/protobuf/models/src/main/proto/PortDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/PortDescriptionProto.proto
deleted file mode 100644
index 065ef67..0000000
--- a/incubator/protobuf/models/src/main/proto/PortDescriptionProto.proto
+++ /dev/null
@@ -1,15 +0,0 @@
-syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
-
-package Port;
-
-import "PortEnums.proto";
-
-message PortDescription {
- // PortNumber as String PortNumber#toString
- string port_number = 1;
- bool is_enabled = 2;
- Port.PortType type = 3;
- int64 port_speed = 4;
- map<string, string> annotations = 8;
-}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/ConnectPointProto.proto b/incubator/protobuf/models/src/main/proto/net/ConnectPointProto.proto
similarity index 87%
rename from incubator/protobuf/models/src/main/proto/ConnectPointProto.proto
rename to incubator/protobuf/models/src/main/proto/net/ConnectPointProto.proto
index ecc1362..3749b6f 100644
--- a/incubator/protobuf/models/src/main/proto/ConnectPointProto.proto
+++ b/incubator/protobuf/models/src/main/proto/net/ConnectPointProto.proto
@@ -1,9 +1,9 @@
syntax = "proto3";
option java_package = "org.onosproject.grpc.net.models";
-package ConnectPoint;
+package net;
-message ConnectPoint {
+message ConnectPointProto {
oneof element_id {
// DeviceID as String DeviceId#toString
string device_id = 1;
diff --git a/incubator/protobuf/models/src/main/proto/DeviceProto.proto b/incubator/protobuf/models/src/main/proto/net/DeviceProto.proto
similarity index 72%
rename from incubator/protobuf/models/src/main/proto/DeviceProto.proto
rename to incubator/protobuf/models/src/main/proto/net/DeviceProto.proto
index f4a81d1..54e478a 100644
--- a/incubator/protobuf/models/src/main/proto/DeviceProto.proto
+++ b/incubator/protobuf/models/src/main/proto/net/DeviceProto.proto
@@ -1,14 +1,14 @@
syntax = "proto3";
option java_package = "org.onosproject.grpc.net.models";
-package Device;
+package net;
-import "DeviceEnums.proto";
+import "net/device/DeviceEnumsProto.proto";
// Corresponds to org.onosproject.net.Device.
message DeviceProto {
- string deviceId = 1;
- Device.DeviceType type = 2;
+ string device_id = 1;
+ net.device.DeviceTypeProto type = 2;
string manufacturer = 3;
string hw_version = 4;
string sw_version = 5;
diff --git a/incubator/protobuf/models/src/main/proto/net/LinkProto.proto b/incubator/protobuf/models/src/main/proto/net/LinkProto.proto
new file mode 100644
index 0000000..77bb32b
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/LinkProto.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/link/LinkEnumsProto.proto";
+import "net/ConnectPointProto.proto";
+
+// Corresponds to org.onosproject.net.Link.
+message LinkProto {
+ net.link.LinkStateProto state = 1;
+ net.ConnectPointProto src = 2;
+ net.ConnectPointProto dst = 3;
+ net.link.LinkTypeProto type = 4;
+ map<string, string> annotations = 5;
+}
+
+
diff --git a/incubator/protobuf/models/src/main/proto/PortProto.proto b/incubator/protobuf/models/src/main/proto/net/PortProto.proto
similarity index 73%
rename from incubator/protobuf/models/src/main/proto/PortProto.proto
rename to incubator/protobuf/models/src/main/proto/net/PortProto.proto
index 309e50b..e734fae 100644
--- a/incubator/protobuf/models/src/main/proto/PortProto.proto
+++ b/incubator/protobuf/models/src/main/proto/net/PortProto.proto
@@ -1,15 +1,15 @@
syntax = "proto3";
option java_package = "org.onosproject.grpc.net.models";
-package Port;
+package net;
-import "PortEnums.proto";
+import "net/device/PortEnumsProto.proto";
// Corresponds to org.onosproject.net.Port.
message PortProto {
string port_number = 1;
bool is_enabled = 2;
- Port.PortType type = 3;
+ net.device.PortTypeProto type = 3;
int64 port_speed = 4;
map<string, string> annotations = 5;
}
diff --git a/incubator/protobuf/models/src/main/proto/net/device/DeviceDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/net/device/DeviceDescriptionProto.proto
new file mode 100644
index 0000000..c1d6e22
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/device/DeviceDescriptionProto.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+import "net/device/DeviceEnumsProto.proto";
+
+message DeviceDescriptionProto {
+ string device_uri = 1;
+ net.device.DeviceTypeProto type = 2;
+ string manufacturer = 3;
+ string hw_version = 4;
+ string sw_version = 5;
+ string serial_number = 6;
+ string chassis_id = 7;
+ map<string, string> annotations = 8;
+ bool is_default_available = 9;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/DeviceEnums.proto b/incubator/protobuf/models/src/main/proto/net/device/DeviceEnumsProto.proto
similarity index 73%
rename from incubator/protobuf/models/src/main/proto/DeviceEnums.proto
rename to incubator/protobuf/models/src/main/proto/net/device/DeviceEnumsProto.proto
index 7fb1f08..d574a35 100644
--- a/incubator/protobuf/models/src/main/proto/DeviceEnums.proto
+++ b/incubator/protobuf/models/src/main/proto/net/device/DeviceEnumsProto.proto
@@ -1,15 +1,15 @@
syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
+option java_package = "org.onosproject.grpc.net.device.models";
-package Device;
+package net.device;
-enum MastershipRole {
+enum MastershipRoleProto {
NONE = 0;
MASTER = 1;
STANDBY = 2;
}
-enum DeviceType {
+enum DeviceTypeProto {
OTHER = 0;
SWITCH = 1;
ROUTER = 2;
@@ -21,12 +21,12 @@
IPS = 8;
IDS = 9;
CONTROLLER = 10;
- VIRTUAL = 11;
+ VIRTUAL_DEVICE = 11;
FIBER_SWITCH = 12;
MICROWAVE = 13;
}
-enum DeviceEventType {
+enum DeviceEventTypeProto {
DEVICE_ADDED = 0;
DEVICE_UPDATED = 1;
DEVICE_REMOVED = 2;
diff --git a/incubator/protobuf/models/src/main/proto/net/device/DeviceEventProto.proto b/incubator/protobuf/models/src/main/proto/net/device/DeviceEventProto.proto
new file mode 100644
index 0000000..87e7c08
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/device/DeviceEventProto.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+
+import "net/DeviceProto.proto";
+import "net/device/DeviceEnumsProto.proto";
+import "net/PortProto.proto";
+
+package net.device;
+
+// Corresponds to org.onosproject.net.device.DeviceEvent.
+message DeviceNotificationProto {
+ net.DeviceProto device = 1;
+ net.device.DeviceEventTypeProto device_event_type = 2;
+ net.PortProto port = 3;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/device/PortDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/net/device/PortDescriptionProto.proto
new file mode 100644
index 0000000..3097a81
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/device/PortDescriptionProto.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+import "net/device/PortEnumsProto.proto";
+
+message PortDescriptionProto {
+ // PortNumber as String PortNumber#toString
+ string port_number = 1;
+ bool is_enabled = 2;
+ net.device.PortTypeProto type = 3;
+ int64 port_speed = 4;
+ map<string, string> annotations = 8;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/PortEnums.proto b/incubator/protobuf/models/src/main/proto/net/device/PortEnumsProto.proto
similarity index 82%
rename from incubator/protobuf/models/src/main/proto/PortEnums.proto
rename to incubator/protobuf/models/src/main/proto/net/device/PortEnumsProto.proto
index b05efc4..e7892f8 100644
--- a/incubator/protobuf/models/src/main/proto/PortEnums.proto
+++ b/incubator/protobuf/models/src/main/proto/net/device/PortEnumsProto.proto
@@ -1,9 +1,9 @@
syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
+option java_package = "org.onosproject.grpc.net.device.models";
-package Port;
+package net.device;
-enum PortType {
+enum PortTypeProto {
// Signifies copper-based connectivity.
COPPER = 0;
// Signifies optical fiber-based connectivity.
@@ -19,5 +19,5 @@
//Optical Multiplexing Section (See ITU G.709).
OMS = 5;
// Signifies virtual port.
- VIRTUAL = 6;
+ VIRTUAL_PORT = 6;
}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/PortStatisticsProto.proto b/incubator/protobuf/models/src/main/proto/net/device/PortStatisticsProto.proto
similarity index 78%
rename from incubator/protobuf/models/src/main/proto/PortStatisticsProto.proto
rename to incubator/protobuf/models/src/main/proto/net/device/PortStatisticsProto.proto
index 964d47c..b089ec9 100644
--- a/incubator/protobuf/models/src/main/proto/PortStatisticsProto.proto
+++ b/incubator/protobuf/models/src/main/proto/net/device/PortStatisticsProto.proto
@@ -1,9 +1,9 @@
syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
+option java_package = "org.onosproject.grpc.net.device.models";
-package Port;
+package net.device;
-message PortStatistics {
+message PortStatisticsProto {
int32 port = 1;
int64 packets_received = 2;
int64 packets_sent = 3;
diff --git a/incubator/protobuf/models/src/main/proto/net/link/LinkDescriptionProto.proto b/incubator/protobuf/models/src/main/proto/net/link/LinkDescriptionProto.proto
new file mode 100644
index 0000000..d24545d
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/link/LinkDescriptionProto.proto
@@ -0,0 +1,14 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.link.models";
+
+package net.link;
+
+import "net/ConnectPointProto.proto";
+import "net/link/LinkEnumsProto.proto";
+
+message LinkDescriptionProto {
+ net.ConnectPointProto src = 1;
+ net.ConnectPointProto dst = 2;
+ net.link.LinkTypeProto type = 3;
+ map<string, string> annotations = 4;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/LinkEnums.proto b/incubator/protobuf/models/src/main/proto/net/link/LinkEnumsProto.proto
similarity index 84%
rename from incubator/protobuf/models/src/main/proto/LinkEnums.proto
rename to incubator/protobuf/models/src/main/proto/net/link/LinkEnumsProto.proto
index fa5f5ac..0f06aa0 100644
--- a/incubator/protobuf/models/src/main/proto/LinkEnums.proto
+++ b/incubator/protobuf/models/src/main/proto/net/link/LinkEnumsProto.proto
@@ -1,9 +1,9 @@
syntax = "proto3";
-option java_package = "org.onosproject.grpc.net.models";
+option java_package = "org.onosproject.grpc.net.link.models";
-package Link;
+package net.link;
-enum LinkType {
+enum LinkTypeProto {
// Signifies that this is a direct single-segment link.
DIRECT = 0;
@@ -27,13 +27,13 @@
VIRTUAL = 5;
}
-enum LinkState {
+enum LinkStateProto {
ACTIVE = 0;
INACTIVE = 1;
}
// Link Event Types
-enum LinkEventType {
+enum LinkEventTypeProto {
LINK_ADDED = 0;
LINK_UPDATED = 1;
LINK_REMOVED = 2;
diff --git a/incubator/protobuf/models/src/main/proto/net/link/LinkEventProto.proto b/incubator/protobuf/models/src/main/proto/net/link/LinkEventProto.proto
new file mode 100644
index 0000000..1ad93b7
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/link/LinkEventProto.proto
@@ -0,0 +1,13 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.link.models";
+
+package net.link;
+
+import "net/LinkProto.proto";
+import "net/link/LinkEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.link.LinkEvent.
+message LinkNotificationProto {
+ net.link.LinkEventTypeProto link_event_type = 1;
+ net.LinkProto link = 2;
+}
\ No newline at end of file
diff --git a/incubator/rpc-grpc/pom.xml b/incubator/rpc-grpc/pom.xml
index 4139f18..af56f07 100644
--- a/incubator/rpc-grpc/pom.xml
+++ b/incubator/rpc-grpc/pom.xml
@@ -19,7 +19,7 @@
<parent>
<artifactId>onos-incubator-grpc-dependencies</artifactId>
<groupId>org.onosproject</groupId>
- <version>1.11-SNAPSHOT</version>
+ <version>1.11.0-SNAPSHOT</version>
<relativePath>../grpc-dependencies/pom.xml</relativePath>
</parent>
@@ -34,7 +34,7 @@
<onos.app.title>ONOS gRPC API</onos.app.title>
<onos.app.requires>
org.onosproject.incubator.rpc,
- org.onosproject.incubator.protobuf,
+ org.onosproject.incubator.protobuf.models,
org.onosproject.incubator.grpc
</onos.app.requires>
</properties>
@@ -96,7 +96,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/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java
index 4f41835..1da5ddd 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/DeviceProviderServiceClientProxy.java
@@ -31,6 +31,8 @@
import org.onosproject.grpc.net.device.DeviceService.IsReachableRequest;
import org.onosproject.grpc.net.device.DeviceService.RoleChanged;
import org.onosproject.grpc.net.device.DeviceService.TriggerProbe;
+import org.onosproject.grpc.net.device.models.PortDescriptionProtoOuterClass.PortDescriptionProto;
+import org.onosproject.grpc.net.device.models.PortStatisticsProtoOuterClass.PortStatisticsProto;
import org.onosproject.incubator.protobuf.models.ProtobufUtils;
import org.onosproject.net.DeviceId;
import org.onosproject.net.MastershipRole;
@@ -115,7 +117,7 @@
checkValidity();
DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder();
- List<org.onosproject.grpc.net.Port.PortDescription> portDescs =
+ List<PortDescriptionProto> portDescs =
portDescriptions.stream()
.map(ProtobufUtils::translate)
.collect(toList());
@@ -168,7 +170,7 @@
checkValidity();
DeviceProviderServiceMsg.Builder builder = DeviceProviderServiceMsg.newBuilder();
- List<org.onosproject.grpc.net.Port.PortStatistics> portStats =
+ List<PortStatisticsProto> portStats =
portStatistics.stream()
.map(ProtobufUtils::translate)
.collect(toList());
diff --git a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java
index 78f9f37..5c40c90 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceClientProxy.java
@@ -15,18 +15,16 @@
*/
package org.onosproject.incubator.rpc.grpc;
-import static org.onosproject.incubator.protobuf.models.ProtobufUtils.asMap;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import org.onosproject.grpc.net.Link.LinkType;
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.ListenableFuture;
+import io.grpc.Channel;
import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc;
import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc.LinkProviderServiceRpcFutureStub;
import org.onosproject.grpc.net.link.LinkService.LinkDetectedMsg;
import org.onosproject.grpc.net.link.LinkService.LinkVanishedMsg;
import org.onosproject.grpc.net.link.LinkService.Void;
+import org.onosproject.grpc.net.link.models.LinkEnumsProto.LinkTypeProto;
+import org.onosproject.grpc.net.models.ConnectPointProtoOuterClass.ConnectPointProto;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Link.Type;
@@ -38,10 +36,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
-import io.grpc.Channel;
+import static org.onosproject.incubator.protobuf.models.ProtobufUtils.asMap;
/**
* Proxy object to handle LinkProviderService calls.
@@ -226,25 +225,25 @@
* Translates ONOS object to gRPC message.
*
* @param type {@link org.onosproject.net.Link.Type Link.Type}
- * @return gRPC LinkType
+ * @return gRPC LinkTypeProto
*/
- private LinkType translate(Type type) {
+ private LinkTypeProto translate(Type type) {
switch (type) {
case DIRECT:
- return LinkType.DIRECT;
+ return LinkTypeProto.DIRECT;
case EDGE:
- return LinkType.EDGE;
+ return LinkTypeProto.EDGE;
case INDIRECT:
- return LinkType.INDIRECT;
+ return LinkTypeProto.INDIRECT;
case OPTICAL:
- return LinkType.OPTICAL;
+ return LinkTypeProto.OPTICAL;
case TUNNEL:
- return LinkType.TUNNEL;
+ return LinkTypeProto.TUNNEL;
case VIRTUAL:
- return LinkType.VIRTUAL;
+ return LinkTypeProto.VIRTUAL;
default:
- return LinkType.DIRECT;
+ return LinkTypeProto.DIRECT;
}
}
@@ -253,10 +252,10 @@
* Translates ONOS object to gRPC message.
*
* @param cp {@link ConnectPoint}
- * @return gRPC ConnectPoint
+ * @return gRPC ConnectPointProto
*/
- private org.onosproject.grpc.net.Link.ConnectPoint translate(ConnectPoint cp) {
- return org.onosproject.grpc.net.Link.ConnectPoint.newBuilder()
+ private ConnectPointProto translate(ConnectPoint cp) {
+ return ConnectPointProto.newBuilder()
.setDeviceId(cp.deviceId().toString())
.setPortNumber(cp.port().toString())
.build();
diff --git a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java
index 69f9cfd..3ba56e4 100644
--- a/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java
+++ b/incubator/rpc-grpc/src/main/java/org/onosproject/incubator/rpc/grpc/LinkProviderServiceServerProxy.java
@@ -15,26 +15,24 @@
*/
package org.onosproject.incubator.rpc.grpc;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.cache.RemovalListeners.asynchronous;
-import static org.onosproject.net.DeviceId.deviceId;
-import static org.onosproject.net.LinkKey.linkKey;
-
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
+import com.google.common.annotations.Beta;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalNotification;
+import io.grpc.stub.StreamObserver;
import org.apache.commons.lang3.tuple.Pair;
-import org.onosproject.grpc.net.Link.ConnectPoint.ElementIdCase;
-import org.onosproject.grpc.net.Link.LinkType;
import org.onosproject.grpc.net.link.LinkProviderServiceRpcGrpc.LinkProviderServiceRpcImplBase;
import org.onosproject.grpc.net.link.LinkService.LinkDetectedMsg;
import org.onosproject.grpc.net.link.LinkService.LinkVanishedMsg;
import org.onosproject.grpc.net.link.LinkService.Void;
+import org.onosproject.grpc.net.link.models.LinkDescriptionProtoOuterClass.LinkDescriptionProto;
+import org.onosproject.grpc.net.link.models.LinkEnumsProto.LinkTypeProto;
+import org.onosproject.grpc.net.models.ConnectPointProtoOuterClass.ConnectPointProto;
+import org.onosproject.grpc.net.models.ConnectPointProtoOuterClass.ConnectPointProto.ElementIdCase;
import org.onosproject.incubator.protobuf.models.ProtobufUtils;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.Link;
+import org.onosproject.net.Link.Type;
import org.onosproject.net.LinkKey;
import org.onosproject.net.PortNumber;
import org.onosproject.net.SparseAnnotations;
@@ -44,12 +42,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.RemovalNotification;
-import com.google.common.annotations.Beta;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
-import io.grpc.stub.StreamObserver;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.cache.RemovalListeners.asynchronous;
+import static org.onosproject.net.DeviceId.deviceId;
+import static org.onosproject.net.LinkKey.linkKey;
// Only single instance will be created and bound to gRPC LinkProviderService
/**
@@ -174,7 +174,7 @@
* @param connectPoint gRPC message.
* @return {@link ConnectPoint}
*/
- private ConnectPoint translate(org.onosproject.grpc.net.Link.ConnectPoint connectPoint) {
+ private ConnectPoint translate(ConnectPointProto connectPoint) {
checkArgument(connectPoint.getElementIdCase() == ElementIdCase.DEVICE_ID,
"Only DeviceId supported.");
return new ConnectPoint(deviceId(connectPoint.getDeviceId()),
@@ -187,10 +187,10 @@
* @param linkDescription gRPC message
* @return {@link LinkDescription}
*/
- private LinkDescription translate(org.onosproject.grpc.net.Link.LinkDescription linkDescription) {
+ private LinkDescription translate(LinkDescriptionProto linkDescription) {
ConnectPoint src = translate(linkDescription.getSrc());
ConnectPoint dst = translate(linkDescription.getDst());
- Link.Type type = translate(linkDescription.getType());
+ Type type = translate(linkDescription.getType());
SparseAnnotations annotations = ProtobufUtils.asAnnotations(linkDescription.getAnnotations());
return new DefaultLinkDescription(src, dst, type, annotations);
}
@@ -199,26 +199,26 @@
* Translates gRPC message to corresponding ONOS object.
*
* @param type gRPC message enum
- * @return {@link org.onosproject.net.Link.Type Link.Type}
+ * @return {@link Type Link.Type}
*/
- private Link.Type translate(LinkType type) {
+ private Type translate(LinkTypeProto type) {
switch (type) {
case DIRECT:
- return Link.Type.DIRECT;
+ return Type.DIRECT;
case EDGE:
- return Link.Type.EDGE;
+ return Type.EDGE;
case INDIRECT:
- return Link.Type.INDIRECT;
+ return Type.INDIRECT;
case OPTICAL:
- return Link.Type.INDIRECT;
+ return Type.INDIRECT;
case TUNNEL:
- return Link.Type.TUNNEL;
+ return Type.TUNNEL;
case VIRTUAL:
- return Link.Type.VIRTUAL;
+ return Type.VIRTUAL;
case UNRECOGNIZED:
default:
- return Link.Type.DIRECT;
+ return Type.DIRECT;
}
}
diff --git a/incubator/rpc-grpc/src/main/proto/DeviceService.proto b/incubator/rpc-grpc/src/main/proto/DeviceService.proto
index 5ae7cd6..9ff86c5 100644
--- a/incubator/rpc-grpc/src/main/proto/DeviceService.proto
+++ b/incubator/rpc-grpc/src/main/proto/DeviceService.proto
@@ -1,15 +1,17 @@
syntax = "proto3";
option java_package = "org.onosproject.grpc.net.device";
-import "models/Device.proto";
-import "models/Port.proto";
+import "net/device/DeviceDescriptionProto.proto";
+import "net/device/PortDescriptionProto.proto";
+import "net/device/PortStatisticsProto.proto";
+import "net/device/DeviceEnumsProto.proto";
package Device;
message DeviceConnected {
// DeviceID as String DeviceId#toString
string device_id = 1;
- DeviceDescription device_description = 2;
+ net.device.DeviceDescriptionProto device_description = 2;
}
message DeviceDisconnected {
@@ -20,26 +22,26 @@
message UpdatePorts {
// DeviceID as String DeviceId#toString
string device_id = 1;
- repeated Port.PortDescription port_descriptions= 2;
+ repeated net.device.PortDescriptionProto port_descriptions= 2;
}
message PortStatusChanged {
// DeviceID as String DeviceId#toString
string device_id = 1;
- Port.PortDescription port_description= 2;
+ net.device.PortDescriptionProto port_description= 2;
}
message ReceivedRoleReply {
// DeviceID as String DeviceId#toString
string device_id = 1;
- MastershipRole requested = 2;
- MastershipRole response = 3;
+ net.device.MastershipRoleProto requested = 2;
+ net.device.MastershipRoleProto response = 3;
}
message UpdatePortStatistics {
// DeviceID as String DeviceId#toString
string device_id = 1;
- repeated Port.PortStatistics port_statistics = 2;
+ repeated net.device.PortStatisticsProto port_statistics = 2;
}
message RegisterProvider {
@@ -72,7 +74,7 @@
message RoleChanged {
// DeviceID as String DeviceId#toString
string device_id = 1;
- MastershipRole new_role = 2;
+ net.device.MastershipRoleProto new_role = 2;
}
message IsReachableRequest {
diff --git a/incubator/rpc-grpc/src/main/proto/LinkService.proto b/incubator/rpc-grpc/src/main/proto/LinkService.proto
index ee32453..e211e11 100644
--- a/incubator/rpc-grpc/src/main/proto/LinkService.proto
+++ b/incubator/rpc-grpc/src/main/proto/LinkService.proto
@@ -1,7 +1,8 @@
syntax = "proto3";
option java_package = "org.onosproject.grpc.net.link";
-import "models/Link.proto";
+import "net/link/LinkDescriptionProto.proto";
+import "net/ConnectPointProto.proto";
package Link;
@@ -11,15 +12,15 @@
message LinkDetectedMsg {
// ProviderId scheme only
string provider_id = 1;
- LinkDescription link_description = 2;
+ net.link.LinkDescriptionProto link_description = 2;
}
message LinkVanishedMsg {
// ProviderId scheme only
string provider_id = 1;
oneof subject {
- LinkDescription link_description = 2;
- ConnectPoint connect_point = 3;
+ net.link.LinkDescriptionProto link_description = 2;
+ net.ConnectPointProto connect_point = 3;
string device_id = 4;
}
}