blob: 2f1a23d01a461c03425929dc5992d88e1f9ce3b9 [file] [log] [blame]
Amit Ghosh09f28362020-06-12 21:52:19 +01001syntax = "proto3";
2
3option go_package = "github.com/opencord/device-management-interface/v3/go/dmi";
4package dmi;
5
6import "dmi/commons.proto";
7import "dmi/hw.proto";
Chandrakanth Nalkudre Gowda68590a42021-04-22 15:19:21 +05308import "google/protobuf/empty.proto";
Amit Ghosh09f28362020-06-12 21:52:19 +01009
10// The model used to represent the event data on the SensorData of a component as described
11// in RFC8348 (https://tools.ietf.org/html/rfc8348)
12
13// Management of Metrics and protos for encoding of Metrics
14
15enum MetricNames {
16 METRIC_NAME_UNDEFINED = 0;
17
18 // FAN related metrics
19 METRIC_FAN_SPEED = 1;
20
21 // CPU related metrics
22 METRIC_CPU_TEMP = 100;
23 METRIC_CPU_USAGE_PERCENTAGE = 101;
24
25 // Transceiver related metrics
26 METRIC_TRANSCEIVER_TEMP = 200;
27 METRIC_TRANSCEIVER_VOLTAGE = 201;
28 METRIC_TRANSCEIVER_BIAS = 202;
29 METRIC_TRANSCEIVER_RX_POWER = 203;
30 METRIC_TRANSCEIVER_TX_POWER = 204;
31 METRIC_TRANSCEIVER_WAVELENGTH = 205;
32
33 // Disk related metrics
34 METRIC_DISK_TEMP = 300;
35 METRIC_DISK_CAPACITY = 301;
36 METRIC_DISK_USAGE = 302;
37 METRIC_DISK_USAGE_PERCENTAGE = 303;
38 METRIC_DISK_READ_WRITE_PERCENTAGE = 304;
39 METRIC_DISK_FAULTY_CELLS_PERCENTAGE = 305;
40
41 // RAM related metrics
42 METRIC_RAM_TEMP = 400;
43 METRIC_RAM_CAPACITY = 401;
44 METRIC_RAM_USAGE = 402;
45 METRIC_RAM_USAGE_PERCENTAGE = 403;
46
47 // Power related metrics
48 METRIC_POWER_MAX = 500;
49 METRIC_POWER_USAGE = 501;
50 METRIC_POWER_USAGE_PERCENTAGE = 502;
51
52 // Chassis related metrics
53 METRIC_INNER_SURROUNDING_TEMP = 600;
54}
55
56message MetricConfig {
57 MetricNames metric_id = 1;
58 // Whether the device manager is collecting and reporting this metric or not
59 bool is_configured = 2;
60 // Number of seconds between two consecutive polls of the particular metric
61 // Each device manager implemenation could have it's per metric default poll frequency which
62 // can be requested to be changed using this value
63 uint32 poll_interval = 3;
64}
65
66message MetricsConfig {
67 repeated MetricConfig metrics = 1;
68}
69
70message ListMetricsResponse {
amit.ghoshae473032021-01-10 11:59:10 +010071 enum Reason {
72 UNDEFINED_REASON = 0;
73 UNKNOWN_DEVICE = 1;
74 INTERNAL_ERROR = 2;
amit.ghoshbd2022e2021-02-22 05:58:53 +010075 DEVICE_UNREACHABLE = 3;
amit.ghoshae473032021-01-10 11:59:10 +010076 }
Amit Ghosh09f28362020-06-12 21:52:19 +010077 Status status = 1;
78 Reason reason = 2;
79 MetricsConfig metrics = 3;
amit.ghosh8ab1e6e2021-02-23 07:40:17 +010080 string reason_detail = 4;
Amit Ghosh09f28362020-06-12 21:52:19 +010081}
82
83message MetricsConfigurationRequest {
84 Uuid device_uuid = 1;
85 oneof operation {
86 MetricsConfig changes = 2;
87 bool reset_to_default = 3;
88 }
89}
90
91message MetricsConfigurationResponse {
amit.ghoshae473032021-01-10 11:59:10 +010092 enum Reason {
93 UNDEFINED_REASON = 0;
94 UNKNOWN_DEVICE = 1;
95 INTERNAL_ERROR = 2;
96 POLL_INTERVAL_UNSUPPORTED = 3;
97 INVALID_METRIC = 4;
amit.ghoshbd2022e2021-02-22 05:58:53 +010098 DEVICE_UNREACHABLE = 5;
amit.ghoshae473032021-01-10 11:59:10 +010099 }
Amit Ghosh09f28362020-06-12 21:52:19 +0100100 Status status = 1;
101 Reason reason = 2;
amit.ghosh8ab1e6e2021-02-23 07:40:17 +0100102 string reason_detail = 3;
Amit Ghosh09f28362020-06-12 21:52:19 +0100103}
104
105message MetricMetaData {
106 Uuid device_uuid = 1;
107 // uuid of the component
108 Uuid component_uuid = 2;
109 string component_name = 3;
110}
111
Chandrakanth Nalkudre Gowda68590a42021-04-22 15:19:21 +0530112// The Metrics are conveyed to external systems either by submitting them on a message bus or using gRPC server streaming.
Amit Ghosh09f28362020-06-12 21:52:19 +0100113// The topic to which are Metrics are submitted would be configured as startup
114// configuration of the components
115message Metric {
116 MetricNames metric_id = 1;
117 MetricMetaData metric_metadata = 2;
118 ComponentSensorData value = 3;
119}
120
121message GetMetricRequest {
122 MetricMetaData meta_data = 1;
123 MetricNames metric_id = 2;
124}
125
aghoshc301dcd2020-09-03 16:55:34 +0100126message GetMetricResponse {
amit.ghoshae473032021-01-10 11:59:10 +0100127 enum Reason {
128 UNDEFINED_REASON = 0;
129 UNKNOWN_DEVICE = 1;
130 UNKNOWN_COMPONENT = 2;
131 INTERNAL_ERROR = 3;
132 INVALID_METRIC = 4;
amit.ghoshbd2022e2021-02-22 05:58:53 +0100133 DEVICE_UNREACHABLE = 5;
amit.ghoshae473032021-01-10 11:59:10 +0100134 }
aghoshc301dcd2020-09-03 16:55:34 +0100135 Status status = 1;
136 Reason reason = 2;
137 Metric metric = 3;
amit.ghosh8ab1e6e2021-02-23 07:40:17 +0100138 string reason_detail = 4;
aghoshc301dcd2020-09-03 16:55:34 +0100139}
140
Amit Ghosh09f28362020-06-12 21:52:19 +0100141service NativeMetricsManagementService {
142
143 // List the supported metrics for the passed device.
144 // This would be the first call that you make to know about the metrics that a particular device supports and
145 // then use the UpdateMetricsConfiguration API to monitor only the required metrics.
146 rpc ListMetrics(HardwareID) returns(ListMetricsResponse);
147
148 // Updates the configuration of the list of metrics in the request
149 // Acts upon single metric configuration, collection of a single metric can be started/stopped
150 // by changing its configuration.
151 //
152 // This configuration is persisted across restart of the device or the device manager
153 rpc UpdateMetricsConfiguration(MetricsConfigurationRequest) returns(MetricsConfigurationResponse);
154
155 // Get the instantenous value of a metric
aghoshc301dcd2020-09-03 16:55:34 +0100156 rpc GetMetric(GetMetricRequest) returns(GetMetricResponse);
Chandrakanth Nalkudre Gowda68590a42021-04-22 15:19:21 +0530157
158 // Initiate the server streaming of the metrics
159 rpc StreamMetrics(google.protobuf.Empty) returns(stream Metric);
Amit Ghosh09f28362020-06-12 21:52:19 +0100160}