Wei-Yu Chen | ad55cb8 | 2022-02-15 20:07:01 +0800 | [diff] [blame] | 1 | // SPDX-FileCopyrightText: 2020 The Magma Authors. |
| 2 | // SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org> |
| 3 | // |
| 4 | // SPDX-License-Identifier: BSD-3-Clause |
| 5 | |
| 6 | syntax = "proto3"; |
| 7 | package magma.orc8r; |
| 8 | |
| 9 | import "orc8r/protos/common.proto"; |
| 10 | import "orc8r/protos/metricsd.proto"; |
| 11 | import "google/protobuf/wrappers.proto"; |
| 12 | |
| 13 | option go_package = "magma/orc8r/lib/go/protos"; |
| 14 | |
| 15 | // -------------------------------------------------------------------------- |
| 16 | // Service status messages |
| 17 | // -------------------------------------------------------------------------- |
| 18 | |
| 19 | message EnodebdStatus { |
| 20 | // For bools, parameter is not set if result can't be determined |
| 21 | google.protobuf.BoolValue enodeb_connected = 1; |
| 22 | google.protobuf.BoolValue opstate_enabled = 2; |
| 23 | google.protobuf.BoolValue rf_tx_on = 3; |
| 24 | google.protobuf.BoolValue gps_connected = 4; |
| 25 | google.protobuf.BoolValue ptp_connected = 5; |
| 26 | google.protobuf.BoolValue mme_connected = 6; |
| 27 | google.protobuf.BoolValue enodeb_configured = 7; |
| 28 | google.protobuf.FloatValue gps_latitude = 8; |
| 29 | google.protobuf.FloatValue gps_longitude = 9; |
| 30 | google.protobuf.BoolValue rf_tx_desired = 10; |
| 31 | } |
| 32 | |
| 33 | message ServiceStatus { |
| 34 | // Metadata from the services that will be sent to the cloud through checkin |
| 35 | map<string, string> meta = 2; |
| 36 | } |
| 37 | |
| 38 | message ServiceInfo { |
| 39 | string name = 1; |
| 40 | |
| 41 | string version = 2; |
| 42 | |
| 43 | enum ServiceState { |
| 44 | UNKNOWN = 0; |
| 45 | STARTING = 1; |
| 46 | ALIVE = 2; |
| 47 | STOPPING = 3; |
| 48 | STOPPED = 4; |
| 49 | } |
| 50 | ServiceState state = 3; |
| 51 | |
| 52 | ServiceStatus status = 4; |
| 53 | |
| 54 | // Gives information about whether the application is usable. Though the |
| 55 | // process may have started, the connections may not be set up. APP_HEALTHY in |
| 56 | // this case means the application is entirely usable |
| 57 | enum ApplicationHealth { |
| 58 | APP_UNKNOWN = 0; |
| 59 | APP_UNHEALTHY = 1; |
| 60 | APP_HEALTHY = 2; |
| 61 | } |
| 62 | ApplicationHealth health = 5; |
| 63 | |
| 64 | // Time when the service was started (in seconds since epoch) |
| 65 | uint64 start_time_secs = 6; |
| 66 | } |
| 67 | |
| 68 | message LogLevelMessage { |
| 69 | LogLevel level = 1; |
| 70 | } |
| 71 | |
| 72 | message LogVerbosity { |
| 73 | int32 verbosity = 1; |
| 74 | } |
| 75 | |
| 76 | message ReloadConfigResponse { |
| 77 | enum ReloadConfigResult { |
| 78 | RELOAD_UNKNOWN = 0; |
| 79 | RELOAD_SUCCESS = 1; |
| 80 | RELOAD_FAILURE = 2; |
| 81 | RELOAD_UNSUPPORTED = 3; |
| 82 | } |
| 83 | ReloadConfigResult result = 1; |
| 84 | } |
| 85 | |
| 86 | message State { |
| 87 | // Type determines how the value is deserialized and validated on the cloud service side |
| 88 | string type = 1; |
| 89 | string deviceID = 2; |
| 90 | // Value contains the operational state json-serialized. |
| 91 | bytes value = 3; |
| 92 | uint64 version = 4; |
| 93 | } |
| 94 | |
| 95 | message GetOperationalStatesResponse { |
| 96 | repeated State states = 1; |
| 97 | } |
| 98 | |
| 99 | // -------------------------------------------------------------------------- |
| 100 | // Service303 interface definition. |
| 101 | // |
| 102 | // Service303 is named after fb303, which was named after TB-303 |
| 103 | // https://en.wikipedia.org/wiki/Roland_TB-303. |
| 104 | // |
| 105 | // The Service303 interface implements a set of functionalities which |
| 106 | // all Magma services expose. |
| 107 | // -------------------------------------------------------------------------- |
| 108 | service Service303 { |
| 109 | |
| 110 | // Returns the service level info like name, version, state, status, etc. |
| 111 | // |
| 112 | rpc GetServiceInfo (Void) returns (ServiceInfo) {} |
| 113 | |
| 114 | // Request to stop the service gracefully. |
| 115 | // |
| 116 | rpc StopService (Void) returns (Void) {} |
| 117 | |
| 118 | // Collects metrics from the service |
| 119 | rpc GetMetrics (Void) returns (MetricsContainer) {} |
| 120 | |
| 121 | // Set logging level |
| 122 | rpc SetLogLevel (LogLevelMessage) returns (Void) {} |
| 123 | |
| 124 | // Set logging verbosity The larger, the more verbose. default 0 |
| 125 | rpc SetLogVerbosity (LogVerbosity) returns (Void) {} |
| 126 | |
| 127 | // Requests service reloads config files loaded on startup (<servicename>.yml) |
| 128 | rpc ReloadServiceConfig (Void) returns (ReloadConfigResponse) {} |
| 129 | |
| 130 | // Returns the operational states of devices managed by this service. |
| 131 | rpc GetOperationalStates (Void) returns (GetOperationalStatesResponse) {} |
| 132 | } |