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