diff --git a/gnmi_server/gnoi.go b/gnmi_server/gnoi.go index 47dc2a4a..4c3aad6c 100644 --- a/gnmi_server/gnoi.go +++ b/gnmi_server/gnoi.go @@ -174,13 +174,14 @@ func (srv *SystemServer) Reboot(ctx context.Context, req *gnoi_system_pb.RebootR log.V(1).Info("Request:", req) // Check the reboot type - if req.GetMethod() == gnoi_system_pb.RebootMethod_HALT { + switch req.GetMethod() { + case gnoi_system_pb.RebootMethod_HALT: log.V(1).Info("Reboot method is HALT. Halting the system...") err = HaltSystem() if err != nil { return nil, err } - } else { + default: log.V(1).Info("Reboot system now, delay is ignored...") // TODO: Support GNOI reboot delay // Delay in nanoseconds before issuing reboot. diff --git a/sonic_service_client/dbus_client.go b/sonic_service_client/dbus_client.go index 651cdf16..de8a3eec 100644 --- a/sonic_service_client/dbus_client.go +++ b/sonic_service_client/dbus_client.go @@ -203,6 +203,7 @@ func (c *DbusClient) HaltSystem() error { busPath := c.busPathPrefix + modName intName := c.intNamePrefix + modName + ".execute_reboot" + //Set the method to HALT(3) the system method := 3 // Invoke the D-Bus API to execute the halt command