VOL-3741: Create per RPC Error Reason Enumeration
Change-Id: I4488a169d6cd1bdeff9cba898a1107dc1dbda928
diff --git a/protos/dmi/commons.proto b/protos/dmi/commons.proto
index 4b9757b..d468bcd 100644
--- a/protos/dmi/commons.proto
+++ b/protos/dmi/commons.proto
@@ -11,21 +11,6 @@
ERROR_STATUS = 2;
}
-// Reason for the failure of request
-enum Reason {
- UNDEFINED_REASON = 0;
- UNKNOWN_DEVICE = 1;
- INTERNAL_ERROR = 2;
- WRONG_METRIC = 3;
- WRONG_EVENT = 4;
- LOGGING_ENDPOINT_ERROR = 5;
- LOGGING_ENDPOINT_PROTOCOL_ERROR = 6;
- KAFKA_ENDPOINT_ERROR = 7;
- UNKNOWN_LOG_ENTITY = 8;
- ERROR_FETCHING_CONFIG = 9;
- INVALID_CONFIG = 10;
-}
-
//Log Level
enum LogLevel {
TRACE = 0;
diff --git a/protos/dmi/hw_events_mgmt_service.proto b/protos/dmi/hw_events_mgmt_service.proto
index 2a53e3e..2387420 100644
--- a/protos/dmi/hw_events_mgmt_service.proto
+++ b/protos/dmi/hw_events_mgmt_service.proto
@@ -103,6 +103,11 @@
}
message ListEventsResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ }
Status status = 1;
Reason reason = 2;
EventsCfg events = 3;
@@ -117,6 +122,12 @@
}
message EventsConfigurationResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ INVALID_CONFIG = 3;
+ }
Status status = 1;
Reason reason = 2;
}
diff --git a/protos/dmi/hw_management_service.proto b/protos/dmi/hw_management_service.proto
index 1ca65e7..cf713ba 100644
--- a/protos/dmi/hw_management_service.proto
+++ b/protos/dmi/hw_management_service.proto
@@ -14,6 +14,11 @@
}
message PhysicalInventoryResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ }
Status status = 1;
Reason reason = 2;
Hardware inventory = 3;
@@ -26,6 +31,12 @@
}
message HWComponentInfoGetResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ UNKNOWN_COMPONENT = 2;
+ INTERNAL_ERROR = 3;
+ }
Status status = 1;
Reason reason = 2;
Component component = 3;
@@ -39,11 +50,29 @@
}
message HWComponentInfoSetResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ UNKNOWN_COMPONENT = 2;
+ INVALID_PARAMS = 3;
+ INTERNAL_ERROR = 4;
+ }
Status status = 1;
Reason reason = 2;
}
message StartManagingDeviceResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ // DEVICE_ALREADY_MANAGED is returned when StartManagingDevice is called again for the same name AFTER a previously
+ // successful StartManagingDevice operation
+ DEVICE_ALREADY_MANAGED = 1;
+ // OPERATION_ALREADY_IN_PROGRESS is returned when StartManagingDevice is called again for the same name BEFORE
+ // a previous StartManagingDevice operation has completed
+ OPERATION_ALREADY_IN_PROGRESS = 2;
+ INVALID_PARAMS = 3;
+ INTERNAL_ERROR = 4;
+ }
Status status = 1;
Reason reason = 2;
Uuid device_uuid = 3;
@@ -54,6 +83,12 @@
}
message StopManagingDeviceResponse {
+ // The only case in which an error is expected is if the name of the
+ // device to be stopped is not found
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE= 1;
+ }
Status status = 1;
Reason reason = 2;
}
@@ -69,11 +104,24 @@
}
message SetRemoteEndpointResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ LOGGING_ENDPOINT_ERROR = 3;
+ LOGGING_ENDPOINT_PROTOCOL_ERROR = 4;
+ MSGBUS_ENDPOINT_ERROR = 5;
+ }
Status status = 1;
Reason reason = 2;
}
message GetLoggingEndpointResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ }
Status status = 1;
Reason reason = 2;
string logging_endpoint = 3;
@@ -85,6 +133,10 @@
}
message GetMsgBusEndpointResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ INTERNAL_ERROR = 1;
+ }
Status status = 1;
Reason reason = 2;
string msgbus_endpoint = 3;
@@ -101,6 +153,12 @@
}
message SetLogLevelResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ UNKNOWN_LOG_ENTITY = 3;
+ }
Uuid device_uuid = 1;
Status status = 2;
Reason reason = 3;
@@ -112,6 +170,12 @@
}
message GetLogLevelResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ UNKNOWN_LOG_ENTITY = 3;
+ }
Uuid device_uuid = 1;
repeated EntitiesLogLevel logLevels = 2;
Status status = 3;
@@ -122,8 +186,6 @@
Uuid device_uuid = 1;
}
-
-
service NativeHWManagementService {
// Initializes context for a device and sets up required states
// In the call to StartManagingDevice, the fields of ModifiableComponent which are relevant
@@ -137,6 +199,8 @@
rpc StartManagingDevice(ModifiableComponent) returns(stream StartManagingDeviceResponse);
// Stop management of a device and clean up any context and caches for that device
+ // This rpc can be called at any time, even before the StartManagingDevice operation
+ // has completed, and should be able to cleanup.
rpc StopManagingDevice(StopManagingDeviceRequest) returns(StopManagingDeviceResponse);
// Returns an object containing a list of devices managed by this entity
diff --git a/protos/dmi/hw_metrics_mgmt_service.proto b/protos/dmi/hw_metrics_mgmt_service.proto
index adec0d3..2fc8078 100644
--- a/protos/dmi/hw_metrics_mgmt_service.proto
+++ b/protos/dmi/hw_metrics_mgmt_service.proto
@@ -67,6 +67,11 @@
}
message ListMetricsResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ }
Status status = 1;
Reason reason = 2;
MetricsConfig metrics = 3;
@@ -81,6 +86,13 @@
}
message MetricsConfigurationResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ POLL_INTERVAL_UNSUPPORTED = 3;
+ INVALID_METRIC = 4;
+ }
Status status = 1;
Reason reason = 2;
}
@@ -107,6 +119,13 @@
}
message GetMetricResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ UNKNOWN_COMPONENT = 2;
+ INTERNAL_ERROR = 3;
+ INVALID_METRIC = 4;
+ }
Status status = 1;
Reason reason = 2;
Metric metric = 3;
diff --git a/protos/dmi/sw_image.proto b/protos/dmi/sw_image.proto
index 3bb3b44..8013c8b 100644
--- a/protos/dmi/sw_image.proto
+++ b/protos/dmi/sw_image.proto
@@ -45,6 +45,11 @@
DEVICE_IN_WRONG_STATE = 3;
INVALID_IMAGE = 4;
WRONG_IMAGE_CHECKSUM = 5;
+ OPERATION_ALREADY_IN_PROGRESS = 6;
+ UNKNOWN_DEVICE = 7;
+ // The DM implementations should have retry mechanisms (timeout values dependant on specific implementations)
+ // and even after those if the operation cannot be completed/reached then return error with reason as DEVICE_NOT_REACHABLE
+ DEVICE_NOT_REACHABLE = 8;
}
Status status = 1;
diff --git a/protos/dmi/sw_management_service.proto b/protos/dmi/sw_management_service.proto
index 3dda39f..754a654 100644
--- a/protos/dmi/sw_management_service.proto
+++ b/protos/dmi/sw_management_service.proto
@@ -19,6 +19,11 @@
}
message GetSoftwareVersionInformationResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ }
Status status = 1;
Reason reason = 2;
SoftwareVersionInformation info = 3;
@@ -38,6 +43,14 @@
}
message ConfigResponse {
+ enum Reason {
+ UNDEFINED_REASON = 0;
+ UNKNOWN_DEVICE = 1;
+ INTERNAL_ERROR = 2;
+ ERROR_FETCHING_CONFIG = 3;
+ INVALID_CONFIG = 4;
+ OPERATION_ALREADY_IN_PROGRESS = 5;
+ }
Status status = 1;
Reason reason = 2;
}