VOL-3741: Create per RPC Error Reason Enumeration

Change-Id: I4488a169d6cd1bdeff9cba898a1107dc1dbda928
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