blob: 2563bb025df3b58ca4e23001f323e750c477cf08 [file] [log] [blame]
/*
* Top-level Voltha API definition
*
* For details, see individual definition files.
*/
syntax = "proto3";
option go_package = "github.com/opencord/voltha-protos/go/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;
}
message Logging {
LogLevel.LogLevel level = 1;
string package_name = 2;
}
// CoreInstance represents a core instance. It is data held in memory when a core
// is running. This data is not persistent.
message CoreInstance {
option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
string instance_id = 1 [(access) = READ_ONLY];
HealthStatus health = 2 [(child_node) = {}];
}
message CoreInstances {
option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
repeated CoreInstance items = 1;
}
// Voltha represents the Voltha cluster data. Each Core instance will hold a subset of
// the entire cluster. However, some items (e.g. adapters) will be held by all cores
// for better performance
message Voltha {
option (yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
string version = 1 [(access) = READ_ONLY];
repeated Adapter adapters = 2 [(child_node) = {key: "id"}];
repeated LogicalDevice logical_devices = 3 [(child_node) = {key: "id"}];
repeated Device devices = 4 [(child_node) = {key: "id"}];
repeated DeviceType device_types = 5 [(child_node) = {key: "id"}];
repeated DeviceGroup device_groups = 6 [(child_node) = {key: "id"}];
repeated AlarmFilter alarm_filters = 7 [(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;
}
// Identifies a membership group a Core belongs to
message Membership {
// Group name
string group_name = 1;
// Unique ID of a container within that group
string id = 2;
}
/*
* Voltha APIs
*
*/
service VolthaService {
// Get more information on a given physical device
rpc UpdateLogLevel(Logging) returns(google.protobuf.Empty) {
option (google.api.http) = {
get: "/api/v1/logs"
};
}
// Set the membership group of a Voltha Core
rpc UpdateMembership(Membership) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/membership"
body: "*"
};
}
// 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 core instances
rpc ListCoreInstances(google.protobuf.Empty) returns(CoreInstances) {
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 GetCoreInstance(ID) returns(CoreInstance) {
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';
}
// List all physical devices IDs controlled by the Voltha cluster
rpc ListDeviceIds(google.protobuf.Empty) returns(IDs) {
option (google.api.http) = {
get: "/api/v1/deviceids"
};
option (voltha.yang_xml_tag).xml_tag = 'id';
option (voltha.yang_xml_tag).list_items_name = 'items';
}
// Request to a voltha Core to reconcile a set of devices based on their IDs
rpc ReconcileDevices(IDs) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/deviceids"
body: "*"
};
}
// 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';
}
// Stream control packets to the dataplane
rpc StreamPacketsOut(stream openflow_13.PacketOut)
returns(google.protobuf.Empty) {
// This does not have an HTTP representation
}
// Receive control packet stream
rpc ReceivePacketsIn(google.protobuf.Empty)
returns(stream openflow_13.PacketIn) {
// This does not have an HTTP representation
}
rpc ReceiveChangeEvents(google.protobuf.Empty)
returns(stream openflow_13.ChangeEvent) {
// This does not have an HTTP representation
}
// 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"
};
}
rpc Subscribe (OfAgentSubscriber) returns (OfAgentSubscriber) {
}
}