[VOL-1024] This update consists of:
1) Inter-container kafka library in Go
2) initial set of proto definitions
3) Test cases for the kafka library
Change-Id: Ibe8b0f673a90bbe4cb92847ce40f31ec2d0b6244
diff --git a/protos/voltha.proto b/protos/voltha.proto
new file mode 100644
index 0000000..a107bd2
--- /dev/null
+++ b/protos/voltha.proto
@@ -0,0 +1,505 @@
+/*
+ * Top-level Voltha API definition
+ *
+ * For details, see individual definition files.
+ */
+
+syntax = "proto3";
+
+option go_package = "github.com/opencord/voltha-go/protos/voltha";
+
+package voltha;
+
+import "google/protobuf/empty.proto";
+import "google/api/annotations.proto";
+
+import "yang_options.proto";
+
+import public "meta.proto";
+import public "common.proto";
+import public "health.proto";
+import public "logical_device.proto";
+import public "device.proto";
+import public "adapter.proto";
+import public "openflow_13.proto";
+import "omci_mib_db.proto";
+
+
+option java_package = "org.opencord.voltha";
+option java_outer_classname = "VolthaProtos";
+option csharp_namespace = "Opencord.Voltha.Voltha";
+
+message DeviceGroup {
+
+ string id = 1 [(access) = READ_ONLY];
+
+ repeated LogicalDevice logical_devices = 2 [(child_node) = {key: "id"}];
+
+ repeated Device devices = 3 [(child_node) = {key: "id"}];
+}
+
+message DeviceGroups {
+ repeated DeviceGroup items = 1;
+}
+
+
+message AlarmFilterRuleKey {
+ option (yang_child_rule) = MOVE_TO_PARENT_LEVEL;
+
+ enum AlarmFilterRuleKey {
+ id = 0;
+ type = 1;
+ severity = 2;
+ resource_id = 3;
+ category = 4;
+ device_id = 5;
+ }
+}
+
+message AlarmFilterRule {
+ AlarmFilterRuleKey.AlarmFilterRuleKey key = 1;
+ string value = 2;
+}
+message AlarmFilter {
+ string id = 1 [(access) = READ_ONLY];
+
+ repeated AlarmFilterRule rules = 2;
+}
+
+message AlarmFilters {
+ repeated AlarmFilter filters = 1;
+}
+
+// Top-level (root) node for a Voltha Instance
+message VolthaInstance {
+ option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
+
+ string instance_id = 1 [(access) = READ_ONLY];
+
+ string version = 2 [(access) = READ_ONLY];
+
+ LogLevel.LogLevel log_level = 3;
+
+ HealthStatus health = 10 [(child_node) = {}];
+
+ repeated Adapter adapters = 11 [(child_node) = {key: "id" }];
+
+ repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}];
+
+ repeated Device devices = 13 [(child_node) = {key: "id"}];
+
+ repeated DeviceType device_types = 14 [(child_node) = {key: "id"}];
+
+ repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}];
+
+ repeated AlarmFilter alarm_filters = 16 [(child_node) = {key: "id"}];
+
+ repeated
+ omci.MibDeviceData omci_mibs = 28
+ [(child_node) = {key: "device_id"}];
+}
+
+message VolthaInstances {
+ option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
+ repeated string items = 1;
+}
+
+// Voltha representing the entire Voltha cluster
+message Voltha {
+ option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
+
+ string version = 1 [(access) = READ_ONLY];
+
+ LogLevel.LogLevel log_level = 2;
+
+ repeated VolthaInstance instances = 3 [(child_node) = {key: "instance_id"}];
+
+ repeated Adapter adapters = 11 [(child_node) = {key: "id"}];
+
+ repeated LogicalDevice logical_devices = 12 [(child_node) = {key: "id"}];
+
+ repeated Device devices = 13 [(child_node) = {key: "id"}];
+
+ repeated DeviceGroup device_groups = 15 [(child_node) = {key: "id"}];
+
+ repeated
+ omci.MibDeviceData omci_mib_database = 28
+ [(child_node) = {key: "device_id"}];
+}
+
+// Device Self Test Response
+message SelfTestResponse {
+ option (yang_child_rule) = MOVE_TO_PARENT_LEVEL;
+
+ enum SelfTestResult {
+ SUCCESS = 0;
+ FAILURE = 1;
+ NOT_SUPPORTED = 2;
+ UNKNOWN_ERROR = 3;
+ }
+ SelfTestResult result = 1;
+}
+
+message OfAgentSubscriber {
+ // ID of ofagent instance
+ string ofagent_id = 1;
+
+ // ID of voltha instance to which the ofagent is subscribed
+ string voltha_id = 2;
+}
+
+/*
+ * Voltha APIs
+ *
+ */
+service VolthaService {
+
+ // Get high level information on the Voltha cluster
+ rpc GetVoltha(google.protobuf.Empty) returns(Voltha) {
+ option (google.api.http) = {
+ get: "/api/v1"
+ };
+ }
+
+ // List all Voltha cluster instances
+ rpc ListVolthaInstances(google.protobuf.Empty) returns(VolthaInstances) {
+ option (google.api.http) = {
+ get: "/api/v1/instances"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'items';
+ option (voltha.yang_xml_tag).list_items_name = 'items';
+ }
+
+ // Get details on a Voltha cluster instance
+ rpc GetVolthaInstance(ID) returns(VolthaInstance) {
+ option (google.api.http) = {
+ get: "/api/v1/instances/{id}"
+ };
+ }
+
+ // List all active adapters (plugins) in the Voltha cluster
+ rpc ListAdapters(google.protobuf.Empty) returns(Adapters) {
+ option (google.api.http) = {
+ get: "/api/v1/adapters"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'adapters';
+ }
+
+
+ // List all logical devices managed by the Voltha cluster
+ rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) {
+ option (google.api.http) = {
+ get: "/api/v1/logical_devices"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'logical_devices';
+ }
+
+ // Get additional information on a given logical device
+ rpc GetLogicalDevice(ID) returns(LogicalDevice) {
+ option (google.api.http) = {
+ get: "/api/v1/logical_devices/{id}"
+ };
+ }
+
+ // List ports of a logical device
+ rpc ListLogicalDevicePorts(ID) returns(LogicalPorts) {
+ option (google.api.http) = {
+ get: "/api/v1/logical_devices/{id}/ports"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'ports';
+ }
+
+ // Gets a logical device port
+ rpc GetLogicalDevicePort(LogicalPortId) returns(LogicalPort) {
+ option (google.api.http) = {
+ get: "/api/v1/logical_devices/{id}/ports/{port_id}"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'port';
+ }
+
+ // Enables a logical device port
+ rpc EnableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/logical_devices/{id}/ports/{port_id}/enable"
+ };
+ }
+
+ // Disables a logical device port
+ rpc DisableLogicalDevicePort(LogicalPortId) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/logical_devices/{id}/ports/{port_id}/disable"
+ };
+ }
+
+ // List all flows of a logical device
+ rpc ListLogicalDeviceFlows(ID) returns(openflow_13.Flows) {
+ option (google.api.http) = {
+ get: "/api/v1/logical_devices/{id}/flows"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'flows';
+ option (voltha.yang_xml_tag).list_items_name = 'items';
+ }
+
+ // Update flow table for logical device
+ rpc UpdateLogicalDeviceFlowTable(openflow_13.FlowTableUpdate)
+ returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/logical_devices/{id}/flows"
+ body: "*"
+ };
+ }
+
+ // List all flow groups of a logical device
+ rpc ListLogicalDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
+ option (google.api.http) = {
+ get: "/api/v1/logical_devices/{id}/flow_groups"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
+ option (voltha.yang_xml_tag).list_items_name = 'items';
+ }
+
+ // Update group table for device
+ rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate)
+ returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/logical_devices/{id}/flow_groups"
+ body: "*"
+ };
+ }
+
+ // List all physical devices controlled by the Voltha cluster
+ rpc ListDevices(google.protobuf.Empty) returns(Devices) {
+ option (google.api.http) = {
+ get: "/api/v1/devices"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'devices';
+ }
+
+ // Get more information on a given physical device
+ rpc GetDevice(ID) returns(Device) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}"
+ };
+ }
+
+ // Pre-provision a new physical device
+ rpc CreateDevice(Device) returns(Device) {
+ option (google.api.http) = {
+ post: "/api/v1/devices"
+ body: "*"
+ };
+ }
+
+ // Enable a device. If the device was in pre-provisioned state then it
+ // will transition to ENABLED state. If it was is DISABLED state then it
+ // will transition to ENABLED state as well.
+ rpc EnableDevice(ID) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/enable"
+ };
+ }
+
+ // Disable a device
+ rpc DisableDevice(ID) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/disable"
+ };
+ }
+
+ // Reboot a device
+ rpc RebootDevice(ID) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/reboot"
+ };
+ }
+
+ // Delete a device
+ rpc DeleteDevice(ID) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ delete: "/api/v1/devices/{id}/delete"
+ };
+ }
+
+ // Request an image download to the standby partition
+ // of a device.
+ // Note that the call is expected to be non-blocking.
+ rpc DownloadImage(ImageDownload) returns(OperationResp) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/image_downloads/{name}"
+ body: "*"
+ };
+ }
+
+ // Get image download status on a device
+ // The request retrieves progress on device and updates db record
+ rpc GetImageDownloadStatus(ImageDownload) returns(ImageDownload) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/image_downloads/{name}/status"
+ };
+ }
+
+ // Get image download db record
+ rpc GetImageDownload(ImageDownload) returns(ImageDownload) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/image_downloads/{name}"
+ };
+ }
+
+ // List image download db records for a given device
+ rpc ListImageDownloads(ID) returns(ImageDownloads) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/image_downloads"
+ };
+ }
+
+ // Cancel an existing image download process on a device
+ rpc CancelImageDownload(ImageDownload) returns(OperationResp) {
+ option (google.api.http) = {
+ delete: "/api/v1/devices/{id}/image_downloads/{name}"
+ };
+ }
+
+ // Activate the specified image at a standby partition
+ // to active partition.
+ // Depending on the device implementation, this call
+ // may or may not cause device reboot.
+ // If no reboot, then a reboot is required to make the
+ // activated image running on device
+ // Note that the call is expected to be non-blocking.
+ rpc ActivateImageUpdate(ImageDownload) returns(OperationResp) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/image_downloads/{name}/image_update"
+ body: "*"
+ };
+ }
+
+ // Revert the specified image at standby partition
+ // to active partition, and revert to previous image
+ // Depending on the device implementation, this call
+ // may or may not cause device reboot.
+ // If no reboot, then a reboot is required to make the
+ // previous image running on device
+ // Note that the call is expected to be non-blocking.
+ rpc RevertImageUpdate(ImageDownload) returns(OperationResp) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
+ body: "*"
+ };
+ }
+
+ // List ports of a device
+ rpc ListDevicePorts(ID) returns(Ports) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/ports"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'ports';
+ }
+
+ // List pm config of a device
+ rpc ListDevicePmConfigs(ID) returns(PmConfigs) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/pm_configs"
+ };
+ }
+
+ // Update the pm config of a device
+ rpc UpdateDevicePmConfigs(voltha.PmConfigs) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/pm_configs"
+ body: "*"
+ };
+ }
+
+ // List all flows of a device
+ rpc ListDeviceFlows(ID) returns(openflow_13.Flows) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/flows"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'flows';
+ option (voltha.yang_xml_tag).list_items_name = 'items';
+ }
+
+ // List all flow groups of a device
+ rpc ListDeviceFlowGroups(ID) returns(openflow_13.FlowGroups) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/flow_groups"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'flow_groups';
+ option (voltha.yang_xml_tag).list_items_name = 'items';
+ }
+
+ // List device types known to Voltha
+ rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
+ option (google.api.http) = {
+ get: "/api/v1/device_types"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'device_types';
+ }
+
+ // Get additional information on a device type
+ rpc GetDeviceType(ID) returns(DeviceType) {
+ option (google.api.http) = {
+ get: "/api/v1/device_types/{id}"
+ };
+ }
+
+ // List all device sharding groups
+ rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
+ option (google.api.http) = {
+ get: "/api/v1/device_groups"
+ };
+ option (voltha.yang_xml_tag).xml_tag = 'device_groups';
+ }
+
+ // Get additional information on a device group
+ rpc GetDeviceGroup(ID) returns(DeviceGroup) {
+ option (google.api.http) = {
+ get: "/api/v1/device_groups/{id}"
+ };
+ }
+
+ rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
+ option (google.api.http) = {
+ post: "/api/v1/alarm_filters"
+ body: "*"
+ };
+ }
+
+ rpc GetAlarmFilter(ID) returns(AlarmFilter) {
+ option (google.api.http) = {
+ get: "/api/v1/alarm_filters/{id}"
+ };
+ }
+
+ rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
+ option (google.api.http) = {
+ put: "/api/v1/alarm_filters/{id}"
+ body: "*"
+ };
+ }
+
+ rpc DeleteAlarmFilter(ID) returns(google.protobuf.Empty) {
+ option (google.api.http) = {
+ delete: "/api/v1/alarm_filters/{id}"
+ };
+ }
+
+ rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
+ option (google.api.http) = {
+ get: "/api/v1/alarm_filters"
+ };
+ }
+
+ rpc GetImages(ID) returns(Images) {
+ option (google.api.http) = {
+ get: "/api/v1/devices/{id}/images"
+ };
+ }
+
+ rpc SelfTest(ID) returns(SelfTestResponse) {
+ option (google.api.http) = {
+ post: "/api/v1/devices/{id}/self_test"
+ };
+ }
+}
+