Refactor protocol buffer to split models into different packages
Change-Id: I26152ba227ebe9afd871c6e501ccca17c49e1e4e
diff --git a/incubator/protobuf/models/src/main/proto/net/ConnectPointProto.proto b/incubator/protobuf/models/src/main/proto/net/ConnectPointProto.proto
new file mode 100644
index 0000000..3749b6f
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/ConnectPointProto.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+message ConnectPointProto {
+ oneof element_id {
+ // DeviceID as String DeviceId#toString
+ string device_id = 1;
+
+ // TODO add support to other element_id if required
+ }
+ // PortNumber as String PortNumber#toString
+ string port_number = 2;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/DeviceProto.proto b/incubator/protobuf/models/src/main/proto/net/DeviceProto.proto
new file mode 100644
index 0000000..54e478a
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/DeviceProto.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/device/DeviceEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.Device.
+message DeviceProto {
+ string device_id = 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;
+}
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/net/PortProto.proto b/incubator/protobuf/models/src/main/proto/net/PortProto.proto
new file mode 100644
index 0000000..e734fae
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/PortProto.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.models";
+
+package net;
+
+import "net/device/PortEnumsProto.proto";
+
+// Corresponds to org.onosproject.net.Port.
+message PortProto {
+ string port_number = 1;
+ bool is_enabled = 2;
+ 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/net/device/DeviceEnumsProto.proto b/incubator/protobuf/models/src/main/proto/net/device/DeviceEnumsProto.proto
new file mode 100644
index 0000000..d574a35
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/device/DeviceEnumsProto.proto
@@ -0,0 +1,39 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+enum MastershipRoleProto {
+ NONE = 0;
+ MASTER = 1;
+ STANDBY = 2;
+}
+
+enum DeviceTypeProto {
+ OTHER = 0;
+ SWITCH = 1;
+ ROUTER = 2;
+ ROADM = 3;
+ OTN = 4;
+ ROADM_OTN = 5;
+ FIREWALL = 6;
+ BALANCER = 7;
+ IPS = 8;
+ IDS = 9;
+ CONTROLLER = 10;
+ VIRTUAL_DEVICE = 11;
+ FIBER_SWITCH = 12;
+ MICROWAVE = 13;
+}
+
+enum DeviceEventTypeProto {
+ DEVICE_ADDED = 0;
+ DEVICE_UPDATED = 1;
+ DEVICE_REMOVED = 2;
+ DEVICE_SUSPENDED = 3;
+ DEVICE_AVAILABILITY_CHANGED = 4;
+ PORT_ADDED = 5;
+ PORT_UPDATED = 6;
+ PORT_REMOVED = 7;
+ PORT_STATS_UPDATED = 8;
+}
\ No newline at end of file
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/net/device/PortEnumsProto.proto b/incubator/protobuf/models/src/main/proto/net/device/PortEnumsProto.proto
new file mode 100644
index 0000000..e7892f8
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/device/PortEnumsProto.proto
@@ -0,0 +1,23 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+enum PortTypeProto {
+ // Signifies copper-based connectivity.
+ COPPER = 0;
+ // Signifies optical fiber-based connectivity.
+ FIBER = 1;
+ // Signifies optical fiber-based packet port.
+ PACKET = 2;
+ // Signifies optical fiber-based optical tributary port (called T-port).
+ //The signal from the client side will be formed into a ITU G.709 (OTN) frame.
+ ODUCLT = 3;
+ // Signifies optical fiber-based Line-side port (called L-port).
+ OCH = 4;
+ // Signifies optical fiber-based WDM port (called W-port).
+ //Optical Multiplexing Section (See ITU G.709).
+ OMS = 5;
+ // Signifies virtual port.
+ VIRTUAL_PORT = 6;
+}
\ No newline at end of file
diff --git a/incubator/protobuf/models/src/main/proto/net/device/PortStatisticsProto.proto b/incubator/protobuf/models/src/main/proto/net/device/PortStatisticsProto.proto
new file mode 100644
index 0000000..b089ec9
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/device/PortStatisticsProto.proto
@@ -0,0 +1,20 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.device.models";
+
+package net.device;
+
+message PortStatisticsProto {
+ int32 port = 1;
+ int64 packets_received = 2;
+ int64 packets_sent = 3;
+ int64 bytes_received = 4;
+ int64 bytes_sent = 5;
+ int64 packets_rx_dropped = 6;
+ int64 packets_tx_dropped = 7;
+ int64 packets_rx_errors = 8;
+ int64 packets_tx_errors = 9;
+ int64 duration_sec = 10;
+ int64 duration_nano = 11;
+ bool is_zero = 12;
+ // TODO add all other fields
+}
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/net/link/LinkEnumsProto.proto b/incubator/protobuf/models/src/main/proto/net/link/LinkEnumsProto.proto
new file mode 100644
index 0000000..0f06aa0
--- /dev/null
+++ b/incubator/protobuf/models/src/main/proto/net/link/LinkEnumsProto.proto
@@ -0,0 +1,40 @@
+syntax = "proto3";
+option java_package = "org.onosproject.grpc.net.link.models";
+
+package net.link;
+
+enum LinkTypeProto {
+ // Signifies that this is a direct single-segment link.
+ DIRECT = 0;
+
+ // Signifies that this link is potentially comprised from multiple
+ // underlying segments or hops, and as such should be used to tag
+ // links traversing optical paths, tunnels or intervening 'dark'
+ // switches.
+ INDIRECT = 1;
+
+ // Signifies that this link is an edge, i.e. host link.
+ EDGE = 2;
+
+ // Signifies that this link represents a logical link backed by
+ // some form of a tunnel, e.g., GRE, MPLS, ODUk, OCH.
+ TUNNEL = 3;
+
+ // Signifies that this link is realized by fiber (either single channel or WDM).
+ OPTICAL = 4;
+
+ // Signifies that this link is a virtual link or a pseudo-wire.
+ VIRTUAL = 5;
+}
+
+enum LinkStateProto {
+ ACTIVE = 0;
+ INACTIVE = 1;
+}
+
+// Link Event Types
+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