blob: d871d8a584261b463bed9b7a679cd6675b8d1d90 [file] [log] [blame]
/*
* Top-level Voltha API definition
*
* For details, see individual definition files.
*/
syntax = "proto3";
package voltha;
import "google/protobuf/empty.proto";
import "google/protobuf/any.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";
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 {
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"}];
}
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"}];
}
/*
* Cluster-wide Voltha APIs
*
* These APIs are potentially dispatched to the leader of the Voltha cluster,
* to a specific Voltha instance which owns the given device or logical device.
*
*/
service VolthaGlobalService {
// 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 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';
}
// 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 tansition to ENABLED state. If it was is DISABLED state then it
// will tansition 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"
};
}
// 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"
};
}
}
/*
* Per-instance APIs
*
* These APIs are always served locally by the Voltha instance on which the
* call is made.
*/
service VolthaLocalService {
// Get information on this Voltha instance
rpc GetVolthaInstance(google.protobuf.Empty) returns(VolthaInstance) {
option (google.api.http) = {
get: "/api/v1/local"
};
}
// Get the health state of the Voltha instance
rpc GetHealth(google.protobuf.Empty) returns(HealthStatus) {
option (google.api.http) = {
get: "/api/v1/local/health"
};
option (voltha.yang_xml_tag).xml_tag = 'health';
}
// List all active adapters (plugins) in this Voltha instance
rpc ListAdapters(google.protobuf.Empty) returns(Adapters) {
option (google.api.http) = {
get: "/api/v1/local/adapters"
};
option (voltha.yang_xml_tag).xml_tag = 'adapters';
}
// List all logical devices managed by this Voltha instance
rpc ListLogicalDevices(google.protobuf.Empty) returns(LogicalDevices) {
option (google.api.http) = {
get: "/api/v1/local/logical_devices"
};
option (voltha.yang_xml_tag).xml_tag = 'logical_devices';
}
// Get additional information on given logical device
rpc GetLogicalDevice(ID) returns(LogicalDevice) {
option (google.api.http) = {
get: "/api/v1/local/logical_devices/{id}"
};
}
// List ports of a logical device
rpc ListLogicalDevicePorts(ID) returns(LogicalPorts) {
option (google.api.http) = {
get: "/api/v1/local/logical_devices/{id}/ports"
};
option (voltha.yang_xml_tag).xml_tag = 'ports';
}
// List all flows of a logical device
rpc ListLogicalDeviceFlows(ID) returns(openflow_13.Flows) {
option (google.api.http) = {
get: "/api/v1/local/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/local/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/local/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 logical device
rpc UpdateLogicalDeviceFlowGroupTable(openflow_13.FlowGroupTableUpdate)
returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/local/logical_devices/{id}/flow_groups"
body: "*"
};
}
// List all physical devices managed by this Voltha instance
rpc ListDevices(google.protobuf.Empty) returns(Devices) {
option (google.api.http) = {
get: "/api/v1/local/devices"
};
option (voltha.yang_xml_tag).xml_tag = 'devices';
}
// Get additional information on this device
rpc GetDevice(ID) returns(Device) {
option (google.api.http) = {
get: "/api/v1/local/devices/{id}"
};
}
// Pre-provision a new physical device
rpc CreateDevice(Device) returns(Device) {
option (google.api.http) = {
post: "/api/v1/local/devices"
body: "*"
};
}
// Enable a device. If the device was in pre-provisioned state then it
// will tansition to ENABLED state. If it was is DISABLED state then it
// will tansition to ENABLED state as well.
rpc EnableDevice(ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/local/devices/{id}/enable"
};
}
// Disable a device
rpc DisableDevice(ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/local/devices/{id}/disable"
};
}
// Reboot a device
rpc RebootDevice(ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
post: "/api/v1/local/devices/{id}/reboot"
};
}
// Delete a device
rpc DeleteDevice(ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
delete: "/api/v1/local/devices/{id}/delete"
};
}
// List ports of a device
rpc ListDevicePorts(ID) returns(Ports) {
option (google.api.http) = {
get: "/api/v1/local/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/local/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/local/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/local/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/local/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 know to Voltha instance
rpc ListDeviceTypes(google.protobuf.Empty) returns(DeviceTypes) {
option (google.api.http) = {
get: "/api/v1/local/device_types"
};
option (voltha.yang_xml_tag).xml_tag = 'device_types';
}
// Get additional information on given device type
rpc GetDeviceType(ID) returns(DeviceType) {
option (google.api.http) = {
get: "/api/v1/local/device_types/{id}"
};
}
// List device sharding groups managed by this Voltha instance
rpc ListDeviceGroups(google.protobuf.Empty) returns(DeviceGroups) {
option (google.api.http) = {
get: "/api/v1/local/device_groups"
};
option (voltha.yang_xml_tag).xml_tag = 'device_groups';
}
// Get more information on given device shard
rpc GetDeviceGroup(ID) returns(DeviceGroup) {
option (google.api.http) = {
get: "/api/v1/local/device_groups/{id}"
};
}
// 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
}
rpc CreateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
option (google.api.http) = {
post: "/api/v1/local/alarm_filters"
body: "*"
};
}
rpc GetAlarmFilter(ID) returns(AlarmFilter) {
option (google.api.http) = {
get: "/api/v1/local/alarm_filters/{id}"
};
}
rpc UpdateAlarmFilter(AlarmFilter) returns(AlarmFilter) {
option (google.api.http) = {
put: "/api/v1/local/alarm_filters/{id}"
body: "*"
};
}
rpc DeleteAlarmFilter(ID) returns(google.protobuf.Empty) {
option (google.api.http) = {
delete: "/api/v1/local/alarm_filters/{id}"
};
}
rpc ListAlarmFilters(google.protobuf.Empty) returns(AlarmFilters) {
option (google.api.http) = {
get: "/api/v1/local/alarm_filters"
};
}
}