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