blob: 75199aae7a69ec1e8debfee00af56c30110363c8 [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/api/annotations.proto";
import "google/protobuf/empty.proto";
import public "voltha_protos/meta.proto";
import public "voltha_protos/common.proto";
import public "voltha_protos/health.proto";
import public "voltha_protos/logical_device.proto";
import public "voltha_protos/device.proto";
import public "voltha_protos/adapter.proto";
import public "voltha_protos/openflow_13.proto";
import "voltha_protos/omci_mib_db.proto";
import "voltha_protos/omci_alarm_db.proto";
import "voltha_protos/yang_options.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 (common.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 {
common.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 (common.yang_message_rule) = CREATE_BOTH_GROUPING_AND_CONTAINER;
string instance_id = 1 [(access) = READ_ONLY];
HealthStatus health = 2 [(child_node) = {}];
}
message CoreInstances {
option (common.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 (common.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"}];
repeated
omci.AlarmDeviceData omci_alarm_database = 29
[(child_node) = {key: "device_id"}];
}
// Device Self Test Response
message SelfTestResponse {
option (common.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;
}
// Additional information required to process flow at device adapters
message FlowMetadata {
// Meters associated with flow-update to adapter
repeated openflow_13.ofp_meter_config meters = 1;
}
/*
* 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"
};
}
// Get the membership group of a Voltha Core
rpc GetMembership(google.protobuf.Empty) returns(Membership) {
option (google.api.http) = {
get: "/api/v1/membership"
};
}
// 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 (common.yang_xml_tag).xml_tag = 'items';
option (common.yang_xml_tag).list_items_name = 'items';
}
// Get details on a Voltha cluster instance
rpc GetCoreInstance(common.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 (common.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 (common.yang_xml_tag).xml_tag = 'logical_devices';
}
// Get additional information on a given logical device
rpc GetLogicalDevice(common.ID) returns(LogicalDevice) {
option (google.api.http) = {
get: "/api/v1/logical_devices/{id}"
};
}
// List ports of a logical device
rpc ListLogicalDevicePorts(common.ID) returns(LogicalPorts) {
option (google.api.http) = {
get: "/api/v1/logical_devices/{id}/ports"
};
option (common.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 (common.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(common.ID) returns(openflow_13.Flows) {
option (google.api.http) = {
get: "/api/v1/logical_devices/{id}/flows"
};
option (common.yang_xml_tag).xml_tag = 'flows';
option (common.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: "*"
};
}
// Update meter table for logical device
rpc UpdateLogicalDeviceMeterTable(openflow_13.MeterModUpdate)
returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/logical_devices/{id}/meters"
body: "*"
};
}
// List all meters of a logical device
rpc ListLogicalDeviceMeters(common.ID) returns (openflow_13.Meters) {
option (google.api.http) = {
get: "/api/v1/logical_devices/{id}/meters"
};
option (common.yang_xml_tag).xml_tag = 'meters';
option (common.yang_xml_tag).list_items_name = 'items';
}
// List all flow groups of a logical device
rpc ListLogicalDeviceFlowGroups(common.ID) returns(openflow_13.FlowGroups) {
option (google.api.http) = {
get: "/api/v1/logical_devices/{id}/flow_groups"
};
option (common.yang_xml_tag).xml_tag = 'flow_groups';
option (common.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 (common.yang_xml_tag).xml_tag = 'devices';
}
// List all physical devices IDs controlled by the Voltha cluster
rpc ListDeviceIds(google.protobuf.Empty) returns(common.IDs) {
option (google.api.http) = {
get: "/api/v1/deviceids"
};
option (common.yang_xml_tag).xml_tag = 'id';
option (common.yang_xml_tag).list_items_name = 'items';
}
// Request to a voltha Core to reconcile a set of devices based on their IDs
rpc ReconcileDevices(common.IDs) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/deviceids"
body: "*"
};
}
// Get more information on a given physical device
rpc GetDevice(common.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(common.ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/devices/{id}/enable"
};
}
// Disable a device
rpc DisableDevice(common.ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/devices/{id}/disable"
};
}
// Reboot a device
rpc RebootDevice(common.ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/devices/{id}/reboot"
};
}
// Delete a device
rpc DeleteDevice(common.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(common.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(common.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(common.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(common.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(common.OperationResp) {
option (google.api.http) = {
post: "/api/v1/devices/{id}/image_downloads/{name}/image_revert"
body: "*"
};
}
// List ports of a device
rpc ListDevicePorts(common.ID) returns(Ports) {
option (google.api.http) = {
get: "/api/v1/devices/{id}/ports"
};
option (common.yang_xml_tag).xml_tag = 'ports';
}
// List pm config of a device
rpc ListDevicePmConfigs(common.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(common.ID) returns(openflow_13.Flows) {
option (google.api.http) = {
get: "/api/v1/devices/{id}/flows"
};
option (common.yang_xml_tag).xml_tag = 'flows';
option (common.yang_xml_tag).list_items_name = 'items';
}
// List all flow groups of a device
rpc ListDeviceFlowGroups(common.ID) returns(openflow_13.FlowGroups) {
option (google.api.http) = {
get: "/api/v1/devices/{id}/flow_groups"
};
option (common.yang_xml_tag).xml_tag = 'flow_groups';
option (common.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 (common.yang_xml_tag).xml_tag = 'device_types';
}
// Get additional information on a device type
rpc GetDeviceType(common.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 (common.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(common.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(common.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(common.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(common.ID) returns(Images) {
option (google.api.http) = {
get: "/api/v1/devices/{id}/images"
};
}
rpc SelfTest(common.ID) returns(SelfTestResponse) {
option (google.api.http) = {
post: "/api/v1/devices/{id}/self_test"
};
}
// OpenOMCI MIB information
rpc GetMibDeviceData(common.ID) returns(omci.MibDeviceData) {
option (google.api.http) = {
get: "/api/v1/openomci/{id}/mib"
};
}
// OpenOMCI ALARM information
rpc GetAlarmDeviceData(common.ID) returns(omci.AlarmDeviceData) {
option (google.api.http) = {
get: "/api/v1/openomci/{id}/alarm"
};
}
// Simulate an Alarm
rpc SimulateAlarm(SimulateAlarmRequest) returns(common.OperationResp) {
option (google.api.http) = {
post: "/api/v1/devices/{id}/simulate_larm"
body: "*"
};
}
rpc Subscribe (OfAgentSubscriber) returns (OfAgentSubscriber) {
}
}