[VOL-5452] Added new RPCs and enums for component states as well as reset/enable/disable of components

Change-Id: I03781f71f8f7829c54d6b73298742f7bea364e41
Signed-off-by: Amit Ghosh <amit.ghosh@radisys.com>
diff --git a/protos/dmi/hw.proto b/protos/dmi/hw.proto
index d79da0a..422370f 100644
--- a/protos/dmi/hw.proto
+++ b/protos/dmi/hw.proto
@@ -44,6 +44,12 @@
     COMP_ADMIN_STATE_LOCKED = 2;

     COMP_ADMIN_STATE_SHUTTING_DOWN = 3;

     COMP_ADMIN_STATE_UNLOCKED = 4;

+    // Indicates that the component is in a prohibited administrative state, meaning operations are not allowed.

+    // Typically used to enforce security or policy restrictions.

+    COMP_ADMIN_STATE_ISOLATED = 6;    

+    // Indicates that the component is administratively isolated from the rest of the system.

+    // Used when a component must be separated for maintenance, troubleshooting, or security reasons.

+    COMP_ADMIN_STATE_PROHIBITED = 5;

 }

 

 enum ComponentOperState {

@@ -52,6 +58,23 @@
     COMP_OPER_STATE_DISABLED = 2;

     COMP_OPER_STATE_ENABLED = 3;

     COMP_OPER_STATE_TESTING = 4;

+    // Indicates that the component is operating normally.

+    COMP_OPER_STATE_NORMAL = 5;

+    // Indicates that the component is currently being configured.

+    COMP_OPER_STATE_CONFIGURING = 6;

+    // Indicates that the component is automatically loading configuration or software.

+    COMP_OPER_STATE_AUTOMATIC_LOADING = 7;

+    // Indicates that the component has encountered a failure.

+    COMP_OPER_STATE_FAILED = 8;

+    // Indicates that the component is temporarily shut down.

+    // The component is in a high temperature shutdown state due to exceeding safe operating temperature limits.

+    COMP_OPER_STATE_HIGH_TEMP_SHUTDOWN= 9;

+    // Indicates that the component is manually shut down.

+    COMP_OPER_STATE_MANUAL_SHUTDOWN = 10;

+    // Indicates that the component is shut down to save power.

+    COMP_OPER_STATE_POWER_SAVING_SHUTDOWN = 11;

+    // Indicates that the component's type does not match the expected type.

+    COMP_OPER_STATE_TYPE_MISMATCH = 12;  

 }

 

 enum ComponentUsageState {

diff --git a/protos/dmi/hw_events_mgmt_service.proto b/protos/dmi/hw_events_mgmt_service.proto
index e8c1e9c..7cde7d9 100644
--- a/protos/dmi/hw_events_mgmt_service.proto
+++ b/protos/dmi/hw_events_mgmt_service.proto
@@ -85,6 +85,14 @@
     EVENT_LINE_CARD_PLUG_OUT = 600;

     EVENT_LINE_CARD_PLUG_IN = 601;

 

+    // Indicates that the a state of a component has changed.

+    // The StateChangeInfo message inside the event conveys the old and new states.

+    EVENT_COMPONENT_ADMIN_STATE_CHANGED = 700;

+    EVENT_COMPONENT_OPER_STATE_CHANGED = 701;

+    EVENT_COMPONENT_ALARM_STATE_CHANGED = 702;

+    EVENT_COMPONENT_USAGE_STATE_CHANGED = 703;

+    EVENT_COMPONENT_STANDBY_STATE_CHANGED = 704;

+

     // More to be added

 }

 

@@ -176,6 +184,40 @@
     string component_name = 3;

 }

 

+message AdminStateChange {

+    ComponentAdminState old = 1;

+    ComponentAdminState new = 2;

+}

+

+message OperStateChange {

+    ComponentOperState old = 1;

+    ComponentOperState new = 2;

+}

+

+message AlarmStateChange {

+    ComponentAlarmState old = 1;

+    ComponentAlarmState new = 2;

+}

+

+message UsageStateChange {

+    ComponentUsageState old = 1;

+    ComponentUsageState new = 2;

+}

+

+message StandbyStateChange {

+    ComponentStandbyState old = 1;

+    ComponentStandbyState new = 2;

+}

+

+message StateChangeInfo {

+    oneof state_change {

+        AdminStateChange admin_state_change = 1;

+        OperStateChange oper_state_change = 2;

+        AlarmStateChange alarm_state_change = 3;

+        UsageStateChange usage_state_change = 4;

+        StandbyStateChange standby_state_change = 5;

+    }

+}

 // The Events are conveyed to external systems either by submitting them on a message bus or using gRPC server streaming.

 // The message bus topic to which are Events are submitted would be configured as startup

 // configuration of the components

@@ -188,6 +230,7 @@
     ThresholdInformation threshold_info = 4;

     // Any additional info regarding the event

     string add_info = 5;

+    StateChangeInfo state_change_info = 6; // Only set for state change events

 }

 

 service NativeEventsManagementService {

diff --git a/protos/dmi/hw_management_service.proto b/protos/dmi/hw_management_service.proto
index 6caa7a5..58be1a1 100644
--- a/protos/dmi/hw_management_service.proto
+++ b/protos/dmi/hw_management_service.proto
@@ -279,6 +279,96 @@
     string reason_detail = 5;

 }

 

+// Request to disable a hardware component on a device.

+// At least one of component_name or component_uuid must be provided, along with device_uuid.

+message DisableHWComponentRequest {

+    // UUID of the device containing the component to disable (required)

+    Uuid device_uuid = 1;

+    // UUID of the component to disable (optional, but either this or component_name must be set)

+    Uuid component_uuid = 2;

+    // Name of the component to disable (optional, but either this or component_uuid must be set)

+    string component_name = 3;

+}

+

+// Response for DisableHWComponent RPC.

+message DisableHWComponentResponse {

+    enum Reason {

+        UNDEFINED_REASON = 0;

+        UNKNOWN_DEVICE = 1;

+        UNKNOWN_COMPONENT = 2;

+        INTERNAL_ERROR = 3;

+        DEVICE_UNREACHABLE = 4;

+        DISABLE_UNSUPPORTED = 5; // Disabling this component is not supported

+        INVALID_PARAMS = 6;      // Neither component_name nor component_uuid provided

+    }

+    // Indicates whether the operation was successful or not.

+    Status status = 1;

+    // Reason for failure, if any

+    Reason reason = 2;

+    // Human-readable details for logging or display

+    string reason_detail = 3;

+}

+

+// Request to reset a hardware component on a device.

+// At least one of component_name or component_uuid must be provided, along with device_uuid.

+message ResetHWComponentRequest {

+    // UUID of the device containing the component to reset (required)

+    Uuid device_uuid = 1;

+    // UUID of the component to reset (optional, but either this or component_name must be set)

+    Uuid component_uuid = 2;

+    // Name of the component to reset (optional, but either this or component_uuid must be set)

+    string component_name = 3;

+}

+

+// Response for ResetHWComponent RPC.

+message ResetHWComponentResponse {

+    enum Reason {

+        UNDEFINED_REASON = 0;

+        UNKNOWN_DEVICE = 1;

+        UNKNOWN_COMPONENT = 2;

+        INTERNAL_ERROR = 3;

+        DEVICE_UNREACHABLE = 4;

+        RESET_UNSUPPORTED = 5; // Resetting this component is not supported

+        INVALID_PARAMS = 6;    // Neither component_name nor component_uuid provided

+    }

+    // Indicates whether the operation was successful or not.

+    Status status = 1;

+    // Reason for failure, if any

+    Reason reason = 2;

+    // Human-readable details for logging or display

+    string reason_detail = 3;

+}

+

+// Request to enable a hardware component on a device.

+// At least one of component_name or component_uuid must be provided, along with device_uuid.

+message EnableHWComponentRequest {

+    // UUID of the device containing the component to enable (required)

+    Uuid device_uuid = 1;

+    // UUID of the component to enable (optional, but either this or component_name must be set)

+    Uuid component_uuid = 2;

+    // Name of the component to enable (optional, but either this or component_uuid must be set)

+    string component_name = 3;

+}

+

+// Response for EnableHWComponent RPC.

+message EnableHWComponentResponse {

+    enum Reason {

+        UNDEFINED_REASON = 0;

+        UNKNOWN_DEVICE = 1;

+        UNKNOWN_COMPONENT = 2;

+        INTERNAL_ERROR = 3;

+        DEVICE_UNREACHABLE = 4;

+        ENABLE_UNSUPPORTED = 5; // Enabling this component is not supported

+        INVALID_PARAMS = 6;     // Neither component_name nor component_uuid provided

+    }

+    // Indicates whether the operation was successful or not.

+    Status status = 1;

+    // Reason for failure, if any

+    Reason reason = 2;

+    // Human-readable details for logging or display

+    string reason_detail = 3;

+}

+

 service NativeHWManagementService {

     // Initializes context for a device and sets up required states

     // In the call to StartManagingDevice, the fields of ModifiableComponent which are relevant

@@ -345,4 +435,13 @@
 

     // Gets the log level at which the Device Manager is running

     rpc GetDmLogLevel(GetDmLogLevelRequest) returns(GetDmLogLevelResponse);

+

+    // Disables a hardware component on a device.

+    rpc DisableHWComponent(DisableHWComponentRequest) returns(DisableHWComponentResponse);

+

+    // Resets a hardware component on a device.

+    rpc ResetHWComponent(ResetHWComponentRequest) returns(ResetHWComponentResponse);

+

+    // Enables a hardware component on a device.

+    rpc EnableHWComponent(EnableHWComponentRequest) returns(EnableHWComponentResponse);

 }