| syntax = "proto3"; |
| |
| package voltha; |
| |
| import "google/api/annotations.proto"; |
| |
| option java_package = "org.opencord.voltha"; |
| option java_outer_classname = "VolthaProtos"; |
| option csharp_namespace = "Opencord.Voltha.Voltha"; |
| |
| // Empty message |
| message NullMessage {} |
| |
| // Encode health status of a Voltha instance |
| message HealthStatus { |
| |
| // Health states |
| enum HealthState { |
| HEALTHY = 0; // The instance is healthy |
| OVERLOADED = 1; // The instance is overloaded, decrease query rate |
| DYING = 2; // The instance is in a critical condition, do not use it |
| } |
| |
| // Current state of health of this Voltha instance |
| HealthState state = 1; |
| |
| } |
| |
| // Health related services |
| service HealthService { |
| |
| // Return current health status of a Voltha instance |
| rpc GetHealthStatus(NullMessage) returns (HealthStatus) { |
| option (google.api.http) = { |
| get: "/health" |
| }; |
| } |
| |
| } |
| |
| // (placeholder) Address as example message |
| message Address { |
| string id = 7; // ID of address record |
| string street = 1; // Street address |
| string street2 = 2; // Apartment, suite, building, etc. |
| string street3 = 3; // Apartment, suite, building, etc. |
| string city = 4; // City |
| string state = 5; // State |
| uint32 zip = 6; // Zip code |
| } |
| |
| message Addresses { |
| repeated Address addresses = 1; |
| } |
| |
| // (placeholder) A more complex message type for testing purposes |
| message MoreComplex { |
| HealthStatus health = 1; // Embedded health status |
| int32 foo_counter = 2; // Counting foos |
| string name = 3; // Name of this thing |
| repeated MoreComplex children = 4; // Nested object to test recursion type |
| Address address = 5; |
| } |
| |
| // (placeholder) Convey an identifier |
| message ID { |
| string id = 1; |
| } |
| |
| // Subscriber |
| message Subscriber { |
| string id = 1; |
| // TODO add meat here |
| } |
| |
| message Subscribers { |
| repeated Subscriber subscribers = 1; |
| } |
| |
| /* |
| message FlowSwitch { |
| string id = 1; |
| string name = 2; |
| uint64 device_id = 3; |
| repeated FlowPort ports = 4; |
| } |
| |
| enum PortSpeed { |
| // TODO |
| } |
| |
| enum PortType { |
| // TODO |
| } |
| |
| message FlowPort { |
| string id = 1; |
| string name = 2; |
| uint32 number = 3; |
| string mac_address = 4; |
| PortSpeed speed = 5; |
| PortType type = 6; |
| string flow_switch_id = 7; |
| } |
| */ |
| |
| service VolthaService { |
| |
| // Create a subscriber record |
| rpc CreateSubscriber(Subscriber) returns (Subscriber) { |
| option (google.api.http) = { |
| post: "/subscribers" |
| body: "*" |
| }; |
| } |
| |
| // Return an subscriber by ID |
| rpc GetSubscriber(ID) returns (Subscriber) { |
| option (google.api.http) = { |
| get: "/subscribers/{id}" |
| }; |
| } |
| |
| // Update an existing subscriber record by ID |
| rpc UpdateSubscriber(Subscriber) returns (Subscriber) { |
| option (google.api.http) = { |
| patch: "/subscribers/{id}" |
| body: "*" |
| }; |
| } |
| |
| // Delete a subscriber record by ID |
| rpc DeleteSubscriber(ID) returns (NullMessage) { |
| option (google.api.http) = { |
| delete: "/subscribers/{id}" |
| }; |
| } |
| |
| // List subscribers |
| rpc ListSubscribers(NullMessage) returns (Subscribers) { |
| option (google.api.http) = { |
| get: "/subscribers" |
| }; |
| } |
| |
| } |
| |
| // (placeholder) This is an example service |
| service ExampleService { |
| |
| // Create an address record |
| rpc CreateAddress(Address) returns (Address) { |
| option (google.api.http) = { |
| post: "/addresses" |
| body: "*" |
| }; |
| } |
| |
| // Return an address by ID |
| rpc GetAddress(ID) returns (Address) { |
| option (google.api.http) = { |
| get: "/addresses/{id}" |
| }; |
| } |
| |
| // Update an existing address record by ID |
| rpc UpdateAddress(Address) returns (Address) { |
| option (google.api.http) = { |
| patch: "/addresses/{id}" |
| body: "*" |
| }; |
| } |
| |
| // Delete an address record by ID |
| rpc DeleteAddress(ID) returns (NullMessage) { |
| option (google.api.http) = { |
| delete: "/addresses/{id}" |
| }; |
| } |
| |
| // Return a bit more complex objects |
| rpc ListAddresses(NullMessage) returns (Addresses) { |
| option (google.api.http) = { |
| get: "/addresses" |
| }; |
| } |
| } |