Skip to content

Commit d1f0e91

Browse files
Add communication component state codes and snapshot message
This commit adds a new enum `CommunicationComponentStateCode` to represent the high-level operational state of a communication component. It also introduces a new message `CommunicationComponentStateSnapshot` that captures a snapshot of the component's state, diagnostics, and timing. This is useful for monitoring and diagnosing the status of communication components in a microgrid system. Signed-off-by: Tiyash Basu <[email protected]>
1 parent d0833cb commit d1f0e91

File tree

2 files changed

+67
-5
lines changed

2 files changed

+67
-5
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Added warnings to sensor `SensorState`.
2121
- Added a common `TimeIntervalFilter` message in `frequenz.api.common.v1.types` to standardize time interval filtering across APIs. This uses `start_time` (inclusive) and `end_time` (exclusive) fields, aligning with ISO 8601 and common programming conventions.
2222
- Added new message `CommunicationComponentDiagnostic` to represent warnings and errors in microgrid communication components.
23+
- Added new message `CommunicationComponentStateSnapshot` to represent the state of communication components.
2324
- Added new message definitions for streaming events (Deleted, Created, Updated)
2425

2526
## Bug Fixes

proto/frequenz/api/common/v1/microgrid/communication_components/communication_components.proto

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,36 @@ syntax = "proto3";
1212

1313
package frequenz.api.common.v1.microgrid.communication_components;
1414

15+
import "google/protobuf/timestamp.proto";
16+
17+
// Defines the high-level operational state of a communication component.
18+
// These codes can be used in a one-shot snapshot to show its current condition.
19+
enum CommunicationComponentStateCode {
20+
// Default unset value.
21+
COMMUNICATION_COMPONENT_STATE_CODE_UNSPECIFIED = 0;
22+
23+
// The component's internal status is unknown.
24+
COMMUNICATION_COMPONENT_STATE_CODE_UNKNOWN = 1;
25+
26+
// The component is powered on and responding to network traffic.
27+
COMMUNICATION_COMPONENT_STATE_CODE_ONLINE = 2;
28+
29+
// The component is powered off, unreachable, or administratively disabled.
30+
COMMUNICATION_COMPONENT_STATE_CODE_OFFLINE = 3;
31+
32+
// The component is in the process of establishing connections.
33+
COMMUNICATION_COMPONENT_STATE_CODE_CONNECTING = 4;
34+
35+
// The component is in the process of shutting down connections.
36+
COMMUNICATION_COMPONENT_STATE_CODE_DISCONNECTING = 5;
37+
38+
// The component is undergoing maintenance (e.g., firmware upgrade).
39+
COMMUNICATION_COMPONENT_STATE_CODE_MAINTENANCE = 6;
40+
41+
// The component is up but experiencing degraded performance (e.g., high packet loss).
42+
COMMUNICATION_COMPONENT_STATE_CODE_DEGRADED = 7;
43+
}
44+
1545
// Enumerated diagnostic codes for communication components.
1646
//
1747
// These codes indicate common network- or device-level faults that may affect
@@ -32,19 +62,50 @@ enum CommunicationComponentDiagnosticCode {
3262
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_AUTHENTICATION_ERR = 3;
3363

3464
// Configuration error detected (e.g., invalid VLAN, IP conflict).
35-
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_CONFIGURATION_ERR = 3;
65+
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_CONFIGURATION_ERR = 4;
3666

3767
// High packet loss detected over a sustained period.
38-
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_PACKET_LOSS = 4;
68+
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_PACKET_LOSS = 5;
3969

4070
// Excessive latency observed (e.g., ping time above threshold).
41-
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_HIGH_LATENCY = 5;
71+
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_HIGH_LATENCY = 6;
4272

4373
// Hardware fault reported by device (e.g., port error, cable disconnected).
44-
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_HARDWARE_GENERIC_FAULT = 6;
74+
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_HARDWARE_GENERIC_FAULT = 7;
4575

4676
// Hardware fault due to overheating.
47-
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_OVER_TEMPERATURE = 7;
77+
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_OVER_TEMPERATURE = 8;
78+
}
79+
80+
// A single snapshot of a communication component's state, diagnostics, and timing.
81+
//
82+
// !!! note "snapshot semantics"
83+
// all fields in this message represent the component's view at one point
84+
// in time, so there is only a single `snapshot_time`. any parallel reads
85+
// happening to produce this data are collapsed under that timestamp.
86+
message CommunicationComponentStateSnapshot {
87+
// the utc time when this snapshot was taken.
88+
google.protobuf.Timestamp snapshot_time = 1;
89+
90+
// one or more high-level state codes active at snapshot_time.
91+
//
92+
// !!! note
93+
// typical usage is a single state (e.g., online), but multiple may
94+
// apply (e.g., connecting + degraded) if that makes sense.
95+
repeated CommunicationComponentStateCode states = 2;
96+
97+
// non-critical warnings detected for the component.
98+
//
99+
// !!! note
100+
// warnings may coexist with an online state, indicating potential
101+
// issues that do not prevent basic operation.
102+
repeated CommunicationComponentDiagnostic warnings = 3;
103+
104+
// critical errors currently affecting the component.
105+
//
106+
// !!! note
107+
// an error state code should accompany entries here.
108+
repeated CommunicationComponentDiagnostic errors = 4;
48109
}
49110

50111
// Represents an error or warning condition reported by a microgrid

0 commit comments

Comments
 (0)