blob: 56370fb0fa532122c10221b7ea1843fb9282df55 [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;
Abhilash laxmeshwarfbf836c2026-02-03 16:25:31 +053032 METRIC_TRANSCEIVER_XGSPON_TX_POWER = 206;
Amit Ghosh09f28362020-06-12 21:52:19 +010033
34 // Disk related metrics
35 METRIC_DISK_TEMP = 300;
36 METRIC_DISK_CAPACITY = 301;
37 METRIC_DISK_USAGE = 302;
38 METRIC_DISK_USAGE_PERCENTAGE = 303;
39 METRIC_DISK_READ_WRITE_PERCENTAGE = 304;
40 METRIC_DISK_FAULTY_CELLS_PERCENTAGE = 305;
41
42 // RAM related metrics
43 METRIC_RAM_TEMP = 400;
44 METRIC_RAM_CAPACITY = 401;
45 METRIC_RAM_USAGE = 402;
46 METRIC_RAM_USAGE_PERCENTAGE = 403;
47
48 // Power related metrics
49 METRIC_POWER_MAX = 500;
50 METRIC_POWER_USAGE = 501;
51 METRIC_POWER_USAGE_PERCENTAGE = 502;
52
53 // Chassis related metrics
54 METRIC_INNER_SURROUNDING_TEMP = 600;
55}
56
57message MetricConfig {
58 MetricNames metric_id = 1;
59 // Whether the device manager is collecting and reporting this metric or not
60 bool is_configured = 2;
61 // Number of seconds between two consecutive polls of the particular metric
62 // Each device manager implemenation could have it's per metric default poll frequency which
63 // can be requested to be changed using this value
64 uint32 poll_interval = 3;
65}
66
67message MetricsConfig {
68 repeated MetricConfig metrics = 1;
69}
70
71message ListMetricsResponse {
amit.ghoshae473032021-01-10 11:59:10 +010072 enum Reason {
73 UNDEFINED_REASON = 0;
74 UNKNOWN_DEVICE = 1;
75 INTERNAL_ERROR = 2;
amit.ghoshbd2022e2021-02-22 05:58:53 +010076 DEVICE_UNREACHABLE = 3;
amit.ghoshae473032021-01-10 11:59:10 +010077 }
Amit Ghosh09f28362020-06-12 21:52:19 +010078 Status status = 1;
79 Reason reason = 2;
80 MetricsConfig metrics = 3;
amit.ghosh8ab1e6e2021-02-23 07:40:17 +010081 string reason_detail = 4;
Amit Ghosh09f28362020-06-12 21:52:19 +010082}
83
84message MetricsConfigurationRequest {
85 Uuid device_uuid = 1;
86 oneof operation {
87 MetricsConfig changes = 2;
88 bool reset_to_default = 3;
89 }
90}
91
92message MetricsConfigurationResponse {
amit.ghoshae473032021-01-10 11:59:10 +010093 enum Reason {
94 UNDEFINED_REASON = 0;
95 UNKNOWN_DEVICE = 1;
96 INTERNAL_ERROR = 2;
97 POLL_INTERVAL_UNSUPPORTED = 3;
98 INVALID_METRIC = 4;
amit.ghoshbd2022e2021-02-22 05:58:53 +010099 DEVICE_UNREACHABLE = 5;
amit.ghoshae473032021-01-10 11:59:10 +0100100 }
Amit Ghosh09f28362020-06-12 21:52:19 +0100101 Status status = 1;
102 Reason reason = 2;
amit.ghosh8ab1e6e2021-02-23 07:40:17 +0100103 string reason_detail = 3;
Amit Ghosh09f28362020-06-12 21:52:19 +0100104}
105
106message MetricMetaData {
107 Uuid device_uuid = 1;
108 // uuid of the component
109 Uuid component_uuid = 2;
110 string component_name = 3;
111}
112
Chandrakanth Nalkudre Gowda68590a42021-04-22 15:19:21 +0530113// 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 +0100114// The topic to which are Metrics are submitted would be configured as startup
115// configuration of the components
116message Metric {
117 MetricNames metric_id = 1;
118 MetricMetaData metric_metadata = 2;
119 ComponentSensorData value = 3;
120}
121
122message GetMetricRequest {
123 MetricMetaData meta_data = 1;
124 MetricNames metric_id = 2;
125}
126
aghoshc301dcd2020-09-03 16:55:34 +0100127message GetMetricResponse {
amit.ghoshae473032021-01-10 11:59:10 +0100128 enum Reason {
129 UNDEFINED_REASON = 0;
130 UNKNOWN_DEVICE = 1;
131 UNKNOWN_COMPONENT = 2;
132 INTERNAL_ERROR = 3;
133 INVALID_METRIC = 4;
amit.ghoshbd2022e2021-02-22 05:58:53 +0100134 DEVICE_UNREACHABLE = 5;
amit.ghoshae473032021-01-10 11:59:10 +0100135 }
aghoshc301dcd2020-09-03 16:55:34 +0100136 Status status = 1;
137 Reason reason = 2;
138 Metric metric = 3;
amit.ghosh8ab1e6e2021-02-23 07:40:17 +0100139 string reason_detail = 4;
aghoshc301dcd2020-09-03 16:55:34 +0100140}
141
Amit Ghosh09f28362020-06-12 21:52:19 +0100142service NativeMetricsManagementService {
143
144 // List the supported metrics for the passed device.
145 // This would be the first call that you make to know about the metrics that a particular device supports and
146 // then use the UpdateMetricsConfiguration API to monitor only the required metrics.
147 rpc ListMetrics(HardwareID) returns(ListMetricsResponse);
148
149 // Updates the configuration of the list of metrics in the request
150 // Acts upon single metric configuration, collection of a single metric can be started/stopped
151 // by changing its configuration.
152 //
153 // This configuration is persisted across restart of the device or the device manager
154 rpc UpdateMetricsConfiguration(MetricsConfigurationRequest) returns(MetricsConfigurationResponse);
155
156 // Get the instantenous value of a metric
aghoshc301dcd2020-09-03 16:55:34 +0100157 rpc GetMetric(GetMetricRequest) returns(GetMetricResponse);
Chandrakanth Nalkudre Gowda68590a42021-04-22 15:19:21 +0530158
159 // Initiate the server streaming of the metrics
160 rpc StreamMetrics(google.protobuf.Empty) returns(stream Metric);
Amit Ghosh09f28362020-06-12 21:52:19 +0100161}