diff --git a/cpp/dmi/hw_management_service.grpc.pb.cc b/cpp/dmi/hw_management_service.grpc.pb.cc
index c1e9d91..ef057ff 100644
--- a/cpp/dmi/hw_management_service.grpc.pb.cc
+++ b/cpp/dmi/hw_management_service.grpc.pb.cc
@@ -37,6 +37,8 @@
   "/dmi.NativeHWManagementService/GetLogLevel",
   "/dmi.NativeHWManagementService/HeartbeatCheck",
   "/dmi.NativeHWManagementService/RebootDevice",
+  "/dmi.NativeHWManagementService/SetDmLogLevel",
+  "/dmi.NativeHWManagementService/GetDmLogLevel",
 };
 
 std::unique_ptr< NativeHWManagementService::Stub> NativeHWManagementService::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
@@ -61,6 +63,8 @@
   , rpcmethod_GetLogLevel_(NativeHWManagementService_method_names[12], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
   , rpcmethod_HeartbeatCheck_(NativeHWManagementService_method_names[13], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
   , rpcmethod_RebootDevice_(NativeHWManagementService_method_names[14], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
+  , rpcmethod_SetDmLogLevel_(NativeHWManagementService_method_names[15], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
+  , rpcmethod_GetDmLogLevel_(NativeHWManagementService_method_names[16], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
   {}
 
 ::grpc::ClientReader< ::dmi::StartManagingDeviceResponse>* NativeHWManagementService::Stub::StartManagingDeviceRaw(::grpc::ClientContext* context, const ::dmi::ModifiableComponent& request) {
@@ -447,6 +451,62 @@
   return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::dmi::RebootDeviceResponse>::Create(channel_.get(), cq, rpcmethod_RebootDevice_, context, request, false);
 }
 
+::grpc::Status NativeHWManagementService::Stub::SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::dmi::SetDmLogLevelResponse* response) {
+  return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_SetDmLogLevel_, context, request, response);
+}
+
+void NativeHWManagementService::Stub::experimental_async::SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, std::function<void(::grpc::Status)> f) {
+  ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_SetDmLogLevel_, context, request, response, std::move(f));
+}
+
+void NativeHWManagementService::Stub::experimental_async::SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, std::function<void(::grpc::Status)> f) {
+  ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_SetDmLogLevel_, context, request, response, std::move(f));
+}
+
+void NativeHWManagementService::Stub::experimental_async::SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
+  ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_SetDmLogLevel_, context, request, response, reactor);
+}
+
+void NativeHWManagementService::Stub::experimental_async::SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
+  ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_SetDmLogLevel_, context, request, response, reactor);
+}
+
+::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>* NativeHWManagementService::Stub::AsyncSetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+  return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::dmi::SetDmLogLevelResponse>::Create(channel_.get(), cq, rpcmethod_SetDmLogLevel_, context, request, true);
+}
+
+::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>* NativeHWManagementService::Stub::PrepareAsyncSetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+  return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::dmi::SetDmLogLevelResponse>::Create(channel_.get(), cq, rpcmethod_SetDmLogLevel_, context, request, false);
+}
+
+::grpc::Status NativeHWManagementService::Stub::GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::dmi::GetDmLogLevelResponse* response) {
+  return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_GetDmLogLevel_, context, request, response);
+}
+
+void NativeHWManagementService::Stub::experimental_async::GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, std::function<void(::grpc::Status)> f) {
+  ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_GetDmLogLevel_, context, request, response, std::move(f));
+}
+
+void NativeHWManagementService::Stub::experimental_async::GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, std::function<void(::grpc::Status)> f) {
+  ::grpc_impl::internal::CallbackUnaryCall(stub_->channel_.get(), stub_->rpcmethod_GetDmLogLevel_, context, request, response, std::move(f));
+}
+
+void NativeHWManagementService::Stub::experimental_async::GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
+  ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_GetDmLogLevel_, context, request, response, reactor);
+}
+
+void NativeHWManagementService::Stub::experimental_async::GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
+  ::grpc_impl::internal::ClientCallbackUnaryFactory::Create(stub_->channel_.get(), stub_->rpcmethod_GetDmLogLevel_, context, request, response, reactor);
+}
+
+::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>* NativeHWManagementService::Stub::AsyncGetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+  return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::dmi::GetDmLogLevelResponse>::Create(channel_.get(), cq, rpcmethod_GetDmLogLevel_, context, request, true);
+}
+
+::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>* NativeHWManagementService::Stub::PrepareAsyncGetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+  return ::grpc_impl::internal::ClientAsyncResponseReaderFactory< ::dmi::GetDmLogLevelResponse>::Create(channel_.get(), cq, rpcmethod_GetDmLogLevel_, context, request, false);
+}
+
 NativeHWManagementService::Service::Service() {
   AddMethod(new ::grpc::internal::RpcServiceMethod(
       NativeHWManagementService_method_names[0],
@@ -598,6 +658,26 @@
              ::dmi::RebootDeviceResponse* resp) {
                return service->RebootDevice(ctx, req, resp);
              }, this)));
+  AddMethod(new ::grpc::internal::RpcServiceMethod(
+      NativeHWManagementService_method_names[15],
+      ::grpc::internal::RpcMethod::NORMAL_RPC,
+      new ::grpc::internal::RpcMethodHandler< NativeHWManagementService::Service, ::dmi::SetDmLogLevelRequest, ::dmi::SetDmLogLevelResponse>(
+          [](NativeHWManagementService::Service* service,
+             ::grpc_impl::ServerContext* ctx,
+             const ::dmi::SetDmLogLevelRequest* req,
+             ::dmi::SetDmLogLevelResponse* resp) {
+               return service->SetDmLogLevel(ctx, req, resp);
+             }, this)));
+  AddMethod(new ::grpc::internal::RpcServiceMethod(
+      NativeHWManagementService_method_names[16],
+      ::grpc::internal::RpcMethod::NORMAL_RPC,
+      new ::grpc::internal::RpcMethodHandler< NativeHWManagementService::Service, ::dmi::GetDmLogLevelRequest, ::dmi::GetDmLogLevelResponse>(
+          [](NativeHWManagementService::Service* service,
+             ::grpc_impl::ServerContext* ctx,
+             const ::dmi::GetDmLogLevelRequest* req,
+             ::dmi::GetDmLogLevelResponse* resp) {
+               return service->GetDmLogLevel(ctx, req, resp);
+             }, this)));
 }
 
 NativeHWManagementService::Service::~Service() {
@@ -708,6 +788,20 @@
   return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
 }
 
+::grpc::Status NativeHWManagementService::Service::SetDmLogLevel(::grpc::ServerContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response) {
+  (void) context;
+  (void) request;
+  (void) response;
+  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status NativeHWManagementService::Service::GetDmLogLevel(::grpc::ServerContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response) {
+  (void) context;
+  (void) request;
+  (void) response;
+  return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
 
 }  // namespace dmi
 
diff --git a/cpp/dmi/hw_management_service.grpc.pb.h b/cpp/dmi/hw_management_service.grpc.pb.h
index f9f34a4..938264c 100644
--- a/cpp/dmi/hw_management_service.grpc.pb.h
+++ b/cpp/dmi/hw_management_service.grpc.pb.h
@@ -177,6 +177,22 @@
     std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::RebootDeviceResponse>> PrepareAsyncRebootDevice(::grpc::ClientContext* context, const ::dmi::RebootDeviceRequest& request, ::grpc::CompletionQueue* cq) {
       return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::RebootDeviceResponse>>(PrepareAsyncRebootDeviceRaw(context, request, cq));
     }
+    // Sets the log level of the Device Manager itself
+    virtual ::grpc::Status SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::dmi::SetDmLogLevelResponse* response) = 0;
+    std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::SetDmLogLevelResponse>> AsyncSetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::SetDmLogLevelResponse>>(AsyncSetDmLogLevelRaw(context, request, cq));
+    }
+    std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::SetDmLogLevelResponse>> PrepareAsyncSetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::SetDmLogLevelResponse>>(PrepareAsyncSetDmLogLevelRaw(context, request, cq));
+    }
+    // Gets the log level at which the Device Manager is running
+    virtual ::grpc::Status GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::dmi::GetDmLogLevelResponse* response) = 0;
+    std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::GetDmLogLevelResponse>> AsyncGetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::GetDmLogLevelResponse>>(AsyncGetDmLogLevelRaw(context, request, cq));
+    }
+    std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::GetDmLogLevelResponse>> PrepareAsyncGetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::dmi::GetDmLogLevelResponse>>(PrepareAsyncGetDmLogLevelRaw(context, request, cq));
+    }
     class experimental_async_interface {
      public:
       virtual ~experimental_async_interface() {}
@@ -369,6 +385,32 @@
       #else
       virtual void RebootDevice(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::RebootDeviceResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
       #endif
+      // Sets the log level of the Device Manager itself
+      virtual void SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) = 0;
+      virtual void SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) = 0;
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      virtual void SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+      #else
+      virtual void SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
+      #endif
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      virtual void SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+      #else
+      virtual void SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
+      #endif
+      // Gets the log level at which the Device Manager is running
+      virtual void GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) = 0;
+      virtual void GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) = 0;
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      virtual void GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+      #else
+      virtual void GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
+      #endif
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      virtual void GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+      #else
+      virtual void GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
+      #endif
     };
     #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
     typedef class experimental_async_interface async_interface;
@@ -411,6 +453,10 @@
     virtual ::grpc::ClientAsyncResponseReaderInterface< ::dmi::Heartbeat>* PrepareAsyncHeartbeatCheckRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) = 0;
     virtual ::grpc::ClientAsyncResponseReaderInterface< ::dmi::RebootDeviceResponse>* AsyncRebootDeviceRaw(::grpc::ClientContext* context, const ::dmi::RebootDeviceRequest& request, ::grpc::CompletionQueue* cq) = 0;
     virtual ::grpc::ClientAsyncResponseReaderInterface< ::dmi::RebootDeviceResponse>* PrepareAsyncRebootDeviceRaw(::grpc::ClientContext* context, const ::dmi::RebootDeviceRequest& request, ::grpc::CompletionQueue* cq) = 0;
+    virtual ::grpc::ClientAsyncResponseReaderInterface< ::dmi::SetDmLogLevelResponse>* AsyncSetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) = 0;
+    virtual ::grpc::ClientAsyncResponseReaderInterface< ::dmi::SetDmLogLevelResponse>* PrepareAsyncSetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) = 0;
+    virtual ::grpc::ClientAsyncResponseReaderInterface< ::dmi::GetDmLogLevelResponse>* AsyncGetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) = 0;
+    virtual ::grpc::ClientAsyncResponseReaderInterface< ::dmi::GetDmLogLevelResponse>* PrepareAsyncGetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) = 0;
   };
   class Stub final : public StubInterface {
    public:
@@ -526,6 +572,20 @@
     std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::RebootDeviceResponse>> PrepareAsyncRebootDevice(::grpc::ClientContext* context, const ::dmi::RebootDeviceRequest& request, ::grpc::CompletionQueue* cq) {
       return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::RebootDeviceResponse>>(PrepareAsyncRebootDeviceRaw(context, request, cq));
     }
+    ::grpc::Status SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::dmi::SetDmLogLevelResponse* response) override;
+    std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>> AsyncSetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>>(AsyncSetDmLogLevelRaw(context, request, cq));
+    }
+    std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>> PrepareAsyncSetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>>(PrepareAsyncSetDmLogLevelRaw(context, request, cq));
+    }
+    ::grpc::Status GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::dmi::GetDmLogLevelResponse* response) override;
+    std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>> AsyncGetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>>(AsyncGetDmLogLevelRaw(context, request, cq));
+    }
+    std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>> PrepareAsyncGetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) {
+      return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>>(PrepareAsyncGetDmLogLevelRaw(context, request, cq));
+    }
     class experimental_async final :
       public StubInterface::experimental_async_interface {
      public:
@@ -688,6 +748,30 @@
       #else
       void RebootDevice(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::RebootDeviceResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
       #endif
+      void SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) override;
+      void SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) override;
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      void SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
+      #else
+      void SetDmLogLevel(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
+      #endif
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      void SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
+      #else
+      void SetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::SetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
+      #endif
+      void GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) override;
+      void GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, std::function<void(::grpc::Status)>) override;
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      void GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
+      #else
+      void GetDmLogLevel(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
+      #endif
+      #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      void GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
+      #else
+      void GetDmLogLevel(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::dmi::GetDmLogLevelResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
+      #endif
      private:
       friend class Stub;
       explicit experimental_async(Stub* stub): stub_(stub) { }
@@ -732,6 +816,10 @@
     ::grpc::ClientAsyncResponseReader< ::dmi::Heartbeat>* PrepareAsyncHeartbeatCheckRaw(::grpc::ClientContext* context, const ::google::protobuf::Empty& request, ::grpc::CompletionQueue* cq) override;
     ::grpc::ClientAsyncResponseReader< ::dmi::RebootDeviceResponse>* AsyncRebootDeviceRaw(::grpc::ClientContext* context, const ::dmi::RebootDeviceRequest& request, ::grpc::CompletionQueue* cq) override;
     ::grpc::ClientAsyncResponseReader< ::dmi::RebootDeviceResponse>* PrepareAsyncRebootDeviceRaw(::grpc::ClientContext* context, const ::dmi::RebootDeviceRequest& request, ::grpc::CompletionQueue* cq) override;
+    ::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>* AsyncSetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) override;
+    ::grpc::ClientAsyncResponseReader< ::dmi::SetDmLogLevelResponse>* PrepareAsyncSetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::SetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) override;
+    ::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>* AsyncGetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) override;
+    ::grpc::ClientAsyncResponseReader< ::dmi::GetDmLogLevelResponse>* PrepareAsyncGetDmLogLevelRaw(::grpc::ClientContext* context, const ::dmi::GetDmLogLevelRequest& request, ::grpc::CompletionQueue* cq) override;
     const ::grpc::internal::RpcMethod rpcmethod_StartManagingDevice_;
     const ::grpc::internal::RpcMethod rpcmethod_StopManagingDevice_;
     const ::grpc::internal::RpcMethod rpcmethod_GetManagedDevices_;
@@ -747,6 +835,8 @@
     const ::grpc::internal::RpcMethod rpcmethod_GetLogLevel_;
     const ::grpc::internal::RpcMethod rpcmethod_HeartbeatCheck_;
     const ::grpc::internal::RpcMethod rpcmethod_RebootDevice_;
+    const ::grpc::internal::RpcMethod rpcmethod_SetDmLogLevel_;
+    const ::grpc::internal::RpcMethod rpcmethod_GetDmLogLevel_;
   };
   static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
 
@@ -799,6 +889,10 @@
     virtual ::grpc::Status HeartbeatCheck(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::dmi::Heartbeat* response);
     // Performs the reboot of the device
     virtual ::grpc::Status RebootDevice(::grpc::ServerContext* context, const ::dmi::RebootDeviceRequest* request, ::dmi::RebootDeviceResponse* response);
+    // Sets the log level of the Device Manager itself
+    virtual ::grpc::Status SetDmLogLevel(::grpc::ServerContext* context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response);
+    // Gets the log level at which the Device Manager is running
+    virtual ::grpc::Status GetDmLogLevel(::grpc::ServerContext* context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response);
   };
   template <class BaseClass>
   class WithAsyncMethod_StartManagingDevice : public BaseClass {
@@ -1100,7 +1194,47 @@
       ::grpc::Service::RequestAsyncUnary(14, context, request, response, new_call_cq, notification_cq, tag);
     }
   };
-  typedef WithAsyncMethod_StartManagingDevice<WithAsyncMethod_StopManagingDevice<WithAsyncMethod_GetManagedDevices<WithAsyncMethod_GetPhysicalInventory<WithAsyncMethod_GetHWComponentInfo<WithAsyncMethod_SetHWComponentInfo<WithAsyncMethod_SetLoggingEndpoint<WithAsyncMethod_GetLoggingEndpoint<WithAsyncMethod_SetMsgBusEndpoint<WithAsyncMethod_GetMsgBusEndpoint<WithAsyncMethod_GetLoggableEntities<WithAsyncMethod_SetLogLevel<WithAsyncMethod_GetLogLevel<WithAsyncMethod_HeartbeatCheck<WithAsyncMethod_RebootDevice<Service > > > > > > > > > > > > > > > AsyncService;
+  template <class BaseClass>
+  class WithAsyncMethod_SetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithAsyncMethod_SetDmLogLevel() {
+      ::grpc::Service::MarkMethodAsync(15);
+    }
+    ~WithAsyncMethod_SetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status SetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    void RequestSetDmLogLevel(::grpc::ServerContext* context, ::dmi::SetDmLogLevelRequest* request, ::grpc::ServerAsyncResponseWriter< ::dmi::SetDmLogLevelResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+      ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag);
+    }
+  };
+  template <class BaseClass>
+  class WithAsyncMethod_GetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithAsyncMethod_GetDmLogLevel() {
+      ::grpc::Service::MarkMethodAsync(16);
+    }
+    ~WithAsyncMethod_GetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status GetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    void RequestGetDmLogLevel(::grpc::ServerContext* context, ::dmi::GetDmLogLevelRequest* request, ::grpc::ServerAsyncResponseWriter< ::dmi::GetDmLogLevelResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+      ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag);
+    }
+  };
+  typedef WithAsyncMethod_StartManagingDevice<WithAsyncMethod_StopManagingDevice<WithAsyncMethod_GetManagedDevices<WithAsyncMethod_GetPhysicalInventory<WithAsyncMethod_GetHWComponentInfo<WithAsyncMethod_SetHWComponentInfo<WithAsyncMethod_SetLoggingEndpoint<WithAsyncMethod_GetLoggingEndpoint<WithAsyncMethod_SetMsgBusEndpoint<WithAsyncMethod_GetMsgBusEndpoint<WithAsyncMethod_GetLoggableEntities<WithAsyncMethod_SetLogLevel<WithAsyncMethod_GetLogLevel<WithAsyncMethod_HeartbeatCheck<WithAsyncMethod_RebootDevice<WithAsyncMethod_SetDmLogLevel<WithAsyncMethod_GetDmLogLevel<Service > > > > > > > > > > > > > > > > > AsyncService;
   template <class BaseClass>
   class ExperimentalWithCallbackMethod_StartManagingDevice : public BaseClass {
    private:
@@ -1779,11 +1913,105 @@
     #endif
       { return nullptr; }
   };
+  template <class BaseClass>
+  class ExperimentalWithCallbackMethod_SetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    ExperimentalWithCallbackMethod_SetDmLogLevel() {
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      ::grpc::Service::
+    #else
+      ::grpc::Service::experimental().
+    #endif
+        MarkMethodCallback(15,
+          new ::grpc_impl::internal::CallbackUnaryHandler< ::dmi::SetDmLogLevelRequest, ::dmi::SetDmLogLevelResponse>(
+            [this](
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+                   ::grpc::CallbackServerContext*
+    #else
+                   ::grpc::experimental::CallbackServerContext*
+    #endif
+                     context, const ::dmi::SetDmLogLevelRequest* request, ::dmi::SetDmLogLevelResponse* response) { return this->SetDmLogLevel(context, request, response); }));}
+    void SetMessageAllocatorFor_SetDmLogLevel(
+        ::grpc::experimental::MessageAllocator< ::dmi::SetDmLogLevelRequest, ::dmi::SetDmLogLevelResponse>* allocator) {
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(15);
+    #else
+      ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(15);
+    #endif
+      static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::dmi::SetDmLogLevelRequest, ::dmi::SetDmLogLevelResponse>*>(handler)
+              ->SetMessageAllocator(allocator);
+    }
+    ~ExperimentalWithCallbackMethod_SetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status SetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+    virtual ::grpc::ServerUnaryReactor* SetDmLogLevel(
+      ::grpc::CallbackServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/)
+    #else
+    virtual ::grpc::experimental::ServerUnaryReactor* SetDmLogLevel(
+      ::grpc::experimental::CallbackServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/)
+    #endif
+      { return nullptr; }
+  };
+  template <class BaseClass>
+  class ExperimentalWithCallbackMethod_GetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    ExperimentalWithCallbackMethod_GetDmLogLevel() {
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      ::grpc::Service::
+    #else
+      ::grpc::Service::experimental().
+    #endif
+        MarkMethodCallback(16,
+          new ::grpc_impl::internal::CallbackUnaryHandler< ::dmi::GetDmLogLevelRequest, ::dmi::GetDmLogLevelResponse>(
+            [this](
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+                   ::grpc::CallbackServerContext*
+    #else
+                   ::grpc::experimental::CallbackServerContext*
+    #endif
+                     context, const ::dmi::GetDmLogLevelRequest* request, ::dmi::GetDmLogLevelResponse* response) { return this->GetDmLogLevel(context, request, response); }));}
+    void SetMessageAllocatorFor_GetDmLogLevel(
+        ::grpc::experimental::MessageAllocator< ::dmi::GetDmLogLevelRequest, ::dmi::GetDmLogLevelResponse>* allocator) {
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(16);
+    #else
+      ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(16);
+    #endif
+      static_cast<::grpc_impl::internal::CallbackUnaryHandler< ::dmi::GetDmLogLevelRequest, ::dmi::GetDmLogLevelResponse>*>(handler)
+              ->SetMessageAllocator(allocator);
+    }
+    ~ExperimentalWithCallbackMethod_GetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status GetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+    virtual ::grpc::ServerUnaryReactor* GetDmLogLevel(
+      ::grpc::CallbackServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/)
+    #else
+    virtual ::grpc::experimental::ServerUnaryReactor* GetDmLogLevel(
+      ::grpc::experimental::CallbackServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/)
+    #endif
+      { return nullptr; }
+  };
   #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
-  typedef ExperimentalWithCallbackMethod_StartManagingDevice<ExperimentalWithCallbackMethod_StopManagingDevice<ExperimentalWithCallbackMethod_GetManagedDevices<ExperimentalWithCallbackMethod_GetPhysicalInventory<ExperimentalWithCallbackMethod_GetHWComponentInfo<ExperimentalWithCallbackMethod_SetHWComponentInfo<ExperimentalWithCallbackMethod_SetLoggingEndpoint<ExperimentalWithCallbackMethod_GetLoggingEndpoint<ExperimentalWithCallbackMethod_SetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetLoggableEntities<ExperimentalWithCallbackMethod_SetLogLevel<ExperimentalWithCallbackMethod_GetLogLevel<ExperimentalWithCallbackMethod_HeartbeatCheck<ExperimentalWithCallbackMethod_RebootDevice<Service > > > > > > > > > > > > > > > CallbackService;
+  typedef ExperimentalWithCallbackMethod_StartManagingDevice<ExperimentalWithCallbackMethod_StopManagingDevice<ExperimentalWithCallbackMethod_GetManagedDevices<ExperimentalWithCallbackMethod_GetPhysicalInventory<ExperimentalWithCallbackMethod_GetHWComponentInfo<ExperimentalWithCallbackMethod_SetHWComponentInfo<ExperimentalWithCallbackMethod_SetLoggingEndpoint<ExperimentalWithCallbackMethod_GetLoggingEndpoint<ExperimentalWithCallbackMethod_SetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetLoggableEntities<ExperimentalWithCallbackMethod_SetLogLevel<ExperimentalWithCallbackMethod_GetLogLevel<ExperimentalWithCallbackMethod_HeartbeatCheck<ExperimentalWithCallbackMethod_RebootDevice<ExperimentalWithCallbackMethod_SetDmLogLevel<ExperimentalWithCallbackMethod_GetDmLogLevel<Service > > > > > > > > > > > > > > > > > CallbackService;
   #endif
 
-  typedef ExperimentalWithCallbackMethod_StartManagingDevice<ExperimentalWithCallbackMethod_StopManagingDevice<ExperimentalWithCallbackMethod_GetManagedDevices<ExperimentalWithCallbackMethod_GetPhysicalInventory<ExperimentalWithCallbackMethod_GetHWComponentInfo<ExperimentalWithCallbackMethod_SetHWComponentInfo<ExperimentalWithCallbackMethod_SetLoggingEndpoint<ExperimentalWithCallbackMethod_GetLoggingEndpoint<ExperimentalWithCallbackMethod_SetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetLoggableEntities<ExperimentalWithCallbackMethod_SetLogLevel<ExperimentalWithCallbackMethod_GetLogLevel<ExperimentalWithCallbackMethod_HeartbeatCheck<ExperimentalWithCallbackMethod_RebootDevice<Service > > > > > > > > > > > > > > > ExperimentalCallbackService;
+  typedef ExperimentalWithCallbackMethod_StartManagingDevice<ExperimentalWithCallbackMethod_StopManagingDevice<ExperimentalWithCallbackMethod_GetManagedDevices<ExperimentalWithCallbackMethod_GetPhysicalInventory<ExperimentalWithCallbackMethod_GetHWComponentInfo<ExperimentalWithCallbackMethod_SetHWComponentInfo<ExperimentalWithCallbackMethod_SetLoggingEndpoint<ExperimentalWithCallbackMethod_GetLoggingEndpoint<ExperimentalWithCallbackMethod_SetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetMsgBusEndpoint<ExperimentalWithCallbackMethod_GetLoggableEntities<ExperimentalWithCallbackMethod_SetLogLevel<ExperimentalWithCallbackMethod_GetLogLevel<ExperimentalWithCallbackMethod_HeartbeatCheck<ExperimentalWithCallbackMethod_RebootDevice<ExperimentalWithCallbackMethod_SetDmLogLevel<ExperimentalWithCallbackMethod_GetDmLogLevel<Service > > > > > > > > > > > > > > > > > ExperimentalCallbackService;
   template <class BaseClass>
   class WithGenericMethod_StartManagingDevice : public BaseClass {
    private:
@@ -2040,6 +2268,40 @@
     }
   };
   template <class BaseClass>
+  class WithGenericMethod_SetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithGenericMethod_SetDmLogLevel() {
+      ::grpc::Service::MarkMethodGeneric(15);
+    }
+    ~WithGenericMethod_SetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status SetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+  };
+  template <class BaseClass>
+  class WithGenericMethod_GetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithGenericMethod_GetDmLogLevel() {
+      ::grpc::Service::MarkMethodGeneric(16);
+    }
+    ~WithGenericMethod_GetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status GetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+  };
+  template <class BaseClass>
   class WithRawMethod_StartManagingDevice : public BaseClass {
    private:
     void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
@@ -2340,6 +2602,46 @@
     }
   };
   template <class BaseClass>
+  class WithRawMethod_SetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithRawMethod_SetDmLogLevel() {
+      ::grpc::Service::MarkMethodRaw(15);
+    }
+    ~WithRawMethod_SetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status SetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    void RequestSetDmLogLevel(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+      ::grpc::Service::RequestAsyncUnary(15, context, request, response, new_call_cq, notification_cq, tag);
+    }
+  };
+  template <class BaseClass>
+  class WithRawMethod_GetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithRawMethod_GetDmLogLevel() {
+      ::grpc::Service::MarkMethodRaw(16);
+    }
+    ~WithRawMethod_GetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status GetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    void RequestGetDmLogLevel(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+      ::grpc::Service::RequestAsyncUnary(16, context, request, response, new_call_cq, notification_cq, tag);
+    }
+  };
+  template <class BaseClass>
   class ExperimentalWithRawCallbackMethod_StartManagingDevice : public BaseClass {
    private:
     void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
@@ -2910,6 +3212,82 @@
       { return nullptr; }
   };
   template <class BaseClass>
+  class ExperimentalWithRawCallbackMethod_SetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    ExperimentalWithRawCallbackMethod_SetDmLogLevel() {
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      ::grpc::Service::
+    #else
+      ::grpc::Service::experimental().
+    #endif
+        MarkMethodRawCallback(15,
+          new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
+            [this](
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+                   ::grpc::CallbackServerContext*
+    #else
+                   ::grpc::experimental::CallbackServerContext*
+    #endif
+                     context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->SetDmLogLevel(context, request, response); }));
+    }
+    ~ExperimentalWithRawCallbackMethod_SetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status SetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+    virtual ::grpc::ServerUnaryReactor* SetDmLogLevel(
+      ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
+    #else
+    virtual ::grpc::experimental::ServerUnaryReactor* SetDmLogLevel(
+      ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
+    #endif
+      { return nullptr; }
+  };
+  template <class BaseClass>
+  class ExperimentalWithRawCallbackMethod_GetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    ExperimentalWithRawCallbackMethod_GetDmLogLevel() {
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+      ::grpc::Service::
+    #else
+      ::grpc::Service::experimental().
+    #endif
+        MarkMethodRawCallback(16,
+          new ::grpc_impl::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
+            [this](
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+                   ::grpc::CallbackServerContext*
+    #else
+                   ::grpc::experimental::CallbackServerContext*
+    #endif
+                     context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->GetDmLogLevel(context, request, response); }));
+    }
+    ~ExperimentalWithRawCallbackMethod_GetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable synchronous version of this method
+    ::grpc::Status GetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+    virtual ::grpc::ServerUnaryReactor* GetDmLogLevel(
+      ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
+    #else
+    virtual ::grpc::experimental::ServerUnaryReactor* GetDmLogLevel(
+      ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
+    #endif
+      { return nullptr; }
+  };
+  template <class BaseClass>
   class WithStreamedUnaryMethod_StopManagingDevice : public BaseClass {
    private:
     void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
@@ -3233,7 +3611,61 @@
     // replace default version of method with streamed unary
     virtual ::grpc::Status StreamedRebootDevice(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::dmi::RebootDeviceRequest,::dmi::RebootDeviceResponse>* server_unary_streamer) = 0;
   };
-  typedef WithStreamedUnaryMethod_StopManagingDevice<WithStreamedUnaryMethod_GetManagedDevices<WithStreamedUnaryMethod_SetHWComponentInfo<WithStreamedUnaryMethod_SetLoggingEndpoint<WithStreamedUnaryMethod_GetLoggingEndpoint<WithStreamedUnaryMethod_SetMsgBusEndpoint<WithStreamedUnaryMethod_GetMsgBusEndpoint<WithStreamedUnaryMethod_GetLoggableEntities<WithStreamedUnaryMethod_SetLogLevel<WithStreamedUnaryMethod_GetLogLevel<WithStreamedUnaryMethod_HeartbeatCheck<WithStreamedUnaryMethod_RebootDevice<Service > > > > > > > > > > > > StreamedUnaryService;
+  template <class BaseClass>
+  class WithStreamedUnaryMethod_SetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithStreamedUnaryMethod_SetDmLogLevel() {
+      ::grpc::Service::MarkMethodStreamed(15,
+        new ::grpc::internal::StreamedUnaryHandler<
+          ::dmi::SetDmLogLevelRequest, ::dmi::SetDmLogLevelResponse>(
+            [this](::grpc_impl::ServerContext* context,
+                   ::grpc_impl::ServerUnaryStreamer<
+                     ::dmi::SetDmLogLevelRequest, ::dmi::SetDmLogLevelResponse>* streamer) {
+                       return this->StreamedSetDmLogLevel(context,
+                         streamer);
+                  }));
+    }
+    ~WithStreamedUnaryMethod_SetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable regular version of this method
+    ::grpc::Status SetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::SetDmLogLevelRequest* /*request*/, ::dmi::SetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    // replace default version of method with streamed unary
+    virtual ::grpc::Status StreamedSetDmLogLevel(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::dmi::SetDmLogLevelRequest,::dmi::SetDmLogLevelResponse>* server_unary_streamer) = 0;
+  };
+  template <class BaseClass>
+  class WithStreamedUnaryMethod_GetDmLogLevel : public BaseClass {
+   private:
+    void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+   public:
+    WithStreamedUnaryMethod_GetDmLogLevel() {
+      ::grpc::Service::MarkMethodStreamed(16,
+        new ::grpc::internal::StreamedUnaryHandler<
+          ::dmi::GetDmLogLevelRequest, ::dmi::GetDmLogLevelResponse>(
+            [this](::grpc_impl::ServerContext* context,
+                   ::grpc_impl::ServerUnaryStreamer<
+                     ::dmi::GetDmLogLevelRequest, ::dmi::GetDmLogLevelResponse>* streamer) {
+                       return this->StreamedGetDmLogLevel(context,
+                         streamer);
+                  }));
+    }
+    ~WithStreamedUnaryMethod_GetDmLogLevel() override {
+      BaseClassMustBeDerivedFromService(this);
+    }
+    // disable regular version of this method
+    ::grpc::Status GetDmLogLevel(::grpc::ServerContext* /*context*/, const ::dmi::GetDmLogLevelRequest* /*request*/, ::dmi::GetDmLogLevelResponse* /*response*/) override {
+      abort();
+      return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+    }
+    // replace default version of method with streamed unary
+    virtual ::grpc::Status StreamedGetDmLogLevel(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::dmi::GetDmLogLevelRequest,::dmi::GetDmLogLevelResponse>* server_unary_streamer) = 0;
+  };
+  typedef WithStreamedUnaryMethod_StopManagingDevice<WithStreamedUnaryMethod_GetManagedDevices<WithStreamedUnaryMethod_SetHWComponentInfo<WithStreamedUnaryMethod_SetLoggingEndpoint<WithStreamedUnaryMethod_GetLoggingEndpoint<WithStreamedUnaryMethod_SetMsgBusEndpoint<WithStreamedUnaryMethod_GetMsgBusEndpoint<WithStreamedUnaryMethod_GetLoggableEntities<WithStreamedUnaryMethod_SetLogLevel<WithStreamedUnaryMethod_GetLogLevel<WithStreamedUnaryMethod_HeartbeatCheck<WithStreamedUnaryMethod_RebootDevice<WithStreamedUnaryMethod_SetDmLogLevel<WithStreamedUnaryMethod_GetDmLogLevel<Service > > > > > > > > > > > > > > StreamedUnaryService;
   template <class BaseClass>
   class WithSplitStreamingMethod_StartManagingDevice : public BaseClass {
    private:
@@ -3316,7 +3748,7 @@
     virtual ::grpc::Status StreamedGetHWComponentInfo(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::dmi::HWComponentInfoGetRequest,::dmi::HWComponentInfoGetResponse>* server_split_streamer) = 0;
   };
   typedef WithSplitStreamingMethod_StartManagingDevice<WithSplitStreamingMethod_GetPhysicalInventory<WithSplitStreamingMethod_GetHWComponentInfo<Service > > > SplitStreamedService;
-  typedef WithSplitStreamingMethod_StartManagingDevice<WithStreamedUnaryMethod_StopManagingDevice<WithStreamedUnaryMethod_GetManagedDevices<WithSplitStreamingMethod_GetPhysicalInventory<WithSplitStreamingMethod_GetHWComponentInfo<WithStreamedUnaryMethod_SetHWComponentInfo<WithStreamedUnaryMethod_SetLoggingEndpoint<WithStreamedUnaryMethod_GetLoggingEndpoint<WithStreamedUnaryMethod_SetMsgBusEndpoint<WithStreamedUnaryMethod_GetMsgBusEndpoint<WithStreamedUnaryMethod_GetLoggableEntities<WithStreamedUnaryMethod_SetLogLevel<WithStreamedUnaryMethod_GetLogLevel<WithStreamedUnaryMethod_HeartbeatCheck<WithStreamedUnaryMethod_RebootDevice<Service > > > > > > > > > > > > > > > StreamedService;
+  typedef WithSplitStreamingMethod_StartManagingDevice<WithStreamedUnaryMethod_StopManagingDevice<WithStreamedUnaryMethod_GetManagedDevices<WithSplitStreamingMethod_GetPhysicalInventory<WithSplitStreamingMethod_GetHWComponentInfo<WithStreamedUnaryMethod_SetHWComponentInfo<WithStreamedUnaryMethod_SetLoggingEndpoint<WithStreamedUnaryMethod_GetLoggingEndpoint<WithStreamedUnaryMethod_SetMsgBusEndpoint<WithStreamedUnaryMethod_GetMsgBusEndpoint<WithStreamedUnaryMethod_GetLoggableEntities<WithStreamedUnaryMethod_SetLogLevel<WithStreamedUnaryMethod_GetLogLevel<WithStreamedUnaryMethod_HeartbeatCheck<WithStreamedUnaryMethod_RebootDevice<WithStreamedUnaryMethod_SetDmLogLevel<WithStreamedUnaryMethod_GetDmLogLevel<Service > > > > > > > > > > > > > > > > > StreamedService;
 };
 
 }  // namespace dmi
diff --git a/cpp/dmi/hw_management_service.pb.cc b/cpp/dmi/hw_management_service.pb.cc
index 082e7d4..850ac0e 100644
--- a/cpp/dmi/hw_management_service.pb.cc
+++ b/cpp/dmi/hw_management_service.pb.cc
@@ -111,6 +111,22 @@
  public:
   ::google::protobuf::internal::ExplicitlyConstructed<GetLoggableEntitiesRequest> _instance;
 } _GetLoggableEntitiesRequest_default_instance_;
+class SetDmLogLevelRequestDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<SetDmLogLevelRequest> _instance;
+} _SetDmLogLevelRequest_default_instance_;
+class SetDmLogLevelResponseDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<SetDmLogLevelResponse> _instance;
+} _SetDmLogLevelResponse_default_instance_;
+class GetDmLogLevelRequestDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<GetDmLogLevelRequest> _instance;
+} _GetDmLogLevelRequest_default_instance_;
+class GetDmLogLevelResponseDefaultTypeInternal {
+ public:
+  ::google::protobuf::internal::ExplicitlyConstructed<GetDmLogLevelResponse> _instance;
+} _GetDmLogLevelResponse_default_instance_;
 class HeartbeatDefaultTypeInternal {
  public:
   ::google::protobuf::internal::ExplicitlyConstructed<Heartbeat> _instance;
@@ -450,6 +466,62 @@
     {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 1, InitDefaultsGetLoggableEntitiesRequest_dmi_2fhw_5fmanagement_5fservice_2eproto}, {
       &scc_info_Uuid_dmi_2fhw_2eproto.base,}};
 
+static void InitDefaultsSetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  {
+    void* ptr = &::dmi::_SetDmLogLevelRequest_default_instance_;
+    new (ptr) ::dmi::SetDmLogLevelRequest();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::dmi::SetDmLogLevelRequest::InitAsDefaultInstance();
+}
+
+::google::protobuf::internal::SCCInfo<0> scc_info_SetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto =
+    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsSetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto}, {}};
+
+static void InitDefaultsSetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  {
+    void* ptr = &::dmi::_SetDmLogLevelResponse_default_instance_;
+    new (ptr) ::dmi::SetDmLogLevelResponse();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::dmi::SetDmLogLevelResponse::InitAsDefaultInstance();
+}
+
+::google::protobuf::internal::SCCInfo<0> scc_info_SetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto =
+    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsSetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto}, {}};
+
+static void InitDefaultsGetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  {
+    void* ptr = &::dmi::_GetDmLogLevelRequest_default_instance_;
+    new (ptr) ::dmi::GetDmLogLevelRequest();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::dmi::GetDmLogLevelRequest::InitAsDefaultInstance();
+}
+
+::google::protobuf::internal::SCCInfo<0> scc_info_GetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto =
+    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsGetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto}, {}};
+
+static void InitDefaultsGetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto() {
+  GOOGLE_PROTOBUF_VERIFY_VERSION;
+
+  {
+    void* ptr = &::dmi::_GetDmLogLevelResponse_default_instance_;
+    new (ptr) ::dmi::GetDmLogLevelResponse();
+    ::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
+  }
+  ::dmi::GetDmLogLevelResponse::InitAsDefaultInstance();
+}
+
+::google::protobuf::internal::SCCInfo<0> scc_info_GetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto =
+    {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsGetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto}, {}};
+
 static void InitDefaultsHeartbeat_dmi_2fhw_5fmanagement_5fservice_2eproto() {
   GOOGLE_PROTOBUF_VERIFY_VERSION;
 
@@ -516,13 +588,17 @@
   ::google::protobuf::internal::InitSCC(&scc_info_GetLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
   ::google::protobuf::internal::InitSCC(&scc_info_GetLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
   ::google::protobuf::internal::InitSCC(&scc_info_GetLoggableEntitiesRequest_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  ::google::protobuf::internal::InitSCC(&scc_info_SetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  ::google::protobuf::internal::InitSCC(&scc_info_SetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  ::google::protobuf::internal::InitSCC(&scc_info_GetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  ::google::protobuf::internal::InitSCC(&scc_info_GetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
   ::google::protobuf::internal::InitSCC(&scc_info_Heartbeat_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
   ::google::protobuf::internal::InitSCC(&scc_info_RebootDeviceRequest_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
   ::google::protobuf::internal::InitSCC(&scc_info_RebootDeviceResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
 }
 
-::google::protobuf::Metadata file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto[25];
-const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto[12];
+::google::protobuf::Metadata file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto[29];
+const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto[14];
 constexpr ::google::protobuf::ServiceDescriptor const** file_level_service_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto = nullptr;
 
 const ::google::protobuf::uint32 TableStruct_dmi_2fhw_5fmanagement_5fservice_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
@@ -701,6 +777,34 @@
   ~0u,  // no _weak_field_map_
   PROTOBUF_FIELD_OFFSET(::dmi::GetLoggableEntitiesRequest, device_uuid_),
   ~0u,  // no _has_bits_
+  PROTOBUF_FIELD_OFFSET(::dmi::SetDmLogLevelRequest, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  PROTOBUF_FIELD_OFFSET(::dmi::SetDmLogLevelRequest, level_),
+  ~0u,  // no _has_bits_
+  PROTOBUF_FIELD_OFFSET(::dmi::SetDmLogLevelResponse, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  PROTOBUF_FIELD_OFFSET(::dmi::SetDmLogLevelResponse, status_),
+  PROTOBUF_FIELD_OFFSET(::dmi::SetDmLogLevelResponse, reason_),
+  PROTOBUF_FIELD_OFFSET(::dmi::SetDmLogLevelResponse, reason_detail_),
+  ~0u,  // no _has_bits_
+  PROTOBUF_FIELD_OFFSET(::dmi::GetDmLogLevelRequest, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  ~0u,  // no _has_bits_
+  PROTOBUF_FIELD_OFFSET(::dmi::GetDmLogLevelResponse, _internal_metadata_),
+  ~0u,  // no _extensions_
+  ~0u,  // no _oneof_case_
+  ~0u,  // no _weak_field_map_
+  PROTOBUF_FIELD_OFFSET(::dmi::GetDmLogLevelResponse, level_),
+  PROTOBUF_FIELD_OFFSET(::dmi::GetDmLogLevelResponse, status_),
+  PROTOBUF_FIELD_OFFSET(::dmi::GetDmLogLevelResponse, reason_),
+  PROTOBUF_FIELD_OFFSET(::dmi::GetDmLogLevelResponse, reason_detail_),
+  ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::dmi::Heartbeat, _internal_metadata_),
   ~0u,  // no _extensions_
   ~0u,  // no _oneof_case_
@@ -744,9 +848,13 @@
   { 151, -1, sizeof(::dmi::GetLogLevelRequest)},
   { 158, -1, sizeof(::dmi::GetLogLevelResponse)},
   { 168, -1, sizeof(::dmi::GetLoggableEntitiesRequest)},
-  { 174, -1, sizeof(::dmi::Heartbeat)},
-  { 180, -1, sizeof(::dmi::RebootDeviceRequest)},
-  { 186, -1, sizeof(::dmi::RebootDeviceResponse)},
+  { 174, -1, sizeof(::dmi::SetDmLogLevelRequest)},
+  { 180, -1, sizeof(::dmi::SetDmLogLevelResponse)},
+  { 188, -1, sizeof(::dmi::GetDmLogLevelRequest)},
+  { 193, -1, sizeof(::dmi::GetDmLogLevelResponse)},
+  { 202, -1, sizeof(::dmi::Heartbeat)},
+  { 208, -1, sizeof(::dmi::RebootDeviceRequest)},
+  { 214, -1, sizeof(::dmi::RebootDeviceResponse)},
 };
 
 static ::google::protobuf::Message const * const file_default_instances[] = {
@@ -772,6 +880,10 @@
   reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_GetLogLevelRequest_default_instance_),
   reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_GetLogLevelResponse_default_instance_),
   reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_GetLoggableEntitiesRequest_default_instance_),
+  reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_SetDmLogLevelRequest_default_instance_),
+  reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_SetDmLogLevelResponse_default_instance_),
+  reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_GetDmLogLevelRequest_default_instance_),
+  reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_GetDmLogLevelResponse_default_instance_),
   reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_Heartbeat_default_instance_),
   reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_RebootDeviceRequest_default_instance_),
   reinterpret_cast<const ::google::protobuf::Message*>(&::dmi::_RebootDeviceResponse_default_instance_),
@@ -780,7 +892,7 @@
 ::google::protobuf::internal::AssignDescriptorsTable assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto = {
   {}, AddDescriptors_dmi_2fhw_5fmanagement_5fservice_2eproto, "dmi/hw_management_service.proto", schemas,
   file_default_instances, TableStruct_dmi_2fhw_5fmanagement_5fservice_2eproto::offsets,
-  file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto, 25, file_level_enum_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto, file_level_service_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto,
+  file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto, 29, file_level_enum_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto, file_level_service_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto,
 };
 
 const char descriptor_table_protodef_dmi_2fhw_5fmanagement_5fservice_2eproto[] =
@@ -887,52 +999,68 @@
   "\020\001\022\022\n\016INTERNAL_ERROR\020\002\022\026\n\022UNKNOWN_LOG_EN"
   "TITY\020\003\022\026\n\022DEVICE_UNREACHABLE\020\004\"<\n\032GetLog"
   "gableEntitiesRequest\022\036\n\013device_uuid\030\001 \001("
-  "\0132\t.dmi.Uuid\"(\n\tHeartbeat\022\033\n\023heartbeat_s"
-  "ignature\030\001 \001(\007\"5\n\023RebootDeviceRequest\022\036\n"
-  "\013device_uuid\030\001 \001(\0132\t.dmi.Uuid\"\367\001\n\024Reboot"
-  "DeviceResponse\022\033\n\006status\030\003 \001(\0162\013.dmi.Sta"
-  "tus\0220\n\006reason\030\004 \001(\0162 .dmi.RebootDeviceRe"
-  "sponse.Reason\022\025\n\rreason_detail\030\005 \001(\t\"y\n\006"
-  "Reason\022\024\n\020UNDEFINED_REASON\020\000\022\022\n\016UNKNOWN_"
-  "DEVICE\020\001\022\022\n\016INTERNAL_ERROR\020\002\022\026\n\022DEVICE_U"
-  "NREACHABLE\020\003\022\031\n\025DEVICE_IN_WRONG_STATE\020\0042"
-  "\256\t\n\031NativeHWManagementService\022S\n\023StartMa"
-  "nagingDevice\022\030.dmi.ModifiableComponent\032 "
-  ".dmi.StartManagingDeviceResponse0\001\022U\n\022St"
-  "opManagingDevice\022\036.dmi.StopManagingDevic"
-  "eRequest\032\037.dmi.StopManagingDeviceRespons"
-  "e\022H\n\021GetManagedDevices\022\026.google.protobuf"
-  ".Empty\032\033.dmi.ManagedDevicesResponse\022W\n\024G"
-  "etPhysicalInventory\022\035.dmi.PhysicalInvent"
-  "oryRequest\032\036.dmi.PhysicalInventoryRespon"
-  "se0\001\022W\n\022GetHWComponentInfo\022\036.dmi.HWCompo"
-  "nentInfoGetRequest\032\037.dmi.HWComponentInfo"
-  "GetResponse0\001\022U\n\022SetHWComponentInfo\022\036.dm"
-  "i.HWComponentInfoSetRequest\032\037.dmi.HWComp"
-  "onentInfoSetResponse\022T\n\022SetLoggingEndpoi"
-  "nt\022\036.dmi.SetLoggingEndpointRequest\032\036.dmi"
-  ".SetRemoteEndpointResponse\022F\n\022GetLogging"
-  "Endpoint\022\017.dmi.HardwareID\032\037.dmi.GetLoggi"
-  "ngEndpointResponse\022R\n\021SetMsgBusEndpoint\022"
-  "\035.dmi.SetMsgBusEndpointRequest\032\036.dmi.Set"
-  "RemoteEndpointResponse\022K\n\021GetMsgBusEndpo"
-  "int\022\026.google.protobuf.Empty\032\036.dmi.GetMsg"
-  "BusEndpointResponse\022P\n\023GetLoggableEntiti"
-  "es\022\037.dmi.GetLoggableEntitiesRequest\032\030.dm"
-  "i.GetLogLevelResponse\022@\n\013SetLogLevel\022\027.d"
-  "mi.SetLogLevelRequest\032\030.dmi.SetLogLevelR"
-  "esponse\022@\n\013GetLogLevel\022\027.dmi.GetLogLevel"
-  "Request\032\030.dmi.GetLogLevelResponse\0228\n\016Hea"
-  "rtbeatCheck\022\026.google.protobuf.Empty\032\016.dm"
-  "i.Heartbeat\022C\n\014RebootDevice\022\030.dmi.Reboot"
-  "DeviceRequest\032\031.dmi.RebootDeviceResponse"
-  "B;Z9github.com/opencord/device-managemen"
-  "t-interface/v3/go/dmib\006proto3"
+  "\0132\t.dmi.Uuid\"4\n\024SetDmLogLevelRequest\022\034\n\005"
+  "level\030\001 \001(\0162\r.dmi.LogLevel\"\311\001\n\025SetDmLogL"
+  "evelResponse\022\033\n\006status\030\001 \001(\0162\013.dmi.Statu"
+  "s\0221\n\006reason\030\002 \001(\0162!.dmi.SetDmLogLevelRes"
+  "ponse.Reason\022\025\n\rreason_detail\030\003 \001(\t\"I\n\006R"
+  "eason\022\024\n\020UNDEFINED_REASON\020\000\022\022\n\016INTERNAL_"
+  "ERROR\020\001\022\025\n\021UNKNOWN_LOG_LEVEL\020\002\"\026\n\024GetDmL"
+  "ogLevelRequest\"\320\001\n\025GetDmLogLevelResponse"
+  "\022\034\n\005level\030\001 \001(\0162\r.dmi.LogLevel\022\033\n\006status"
+  "\030\002 \001(\0162\013.dmi.Status\0221\n\006reason\030\003 \001(\0162!.dm"
+  "i.GetDmLogLevelResponse.Reason\022\025\n\rreason"
+  "_detail\030\004 \001(\t\"2\n\006Reason\022\024\n\020UNDEFINED_REA"
+  "SON\020\000\022\022\n\016INTERNAL_ERROR\020\001\"(\n\tHeartbeat\022\033"
+  "\n\023heartbeat_signature\030\001 \001(\007\"5\n\023RebootDev"
+  "iceRequest\022\036\n\013device_uuid\030\001 \001(\0132\t.dmi.Uu"
+  "id\"\367\001\n\024RebootDeviceResponse\022\033\n\006status\030\003 "
+  "\001(\0162\013.dmi.Status\0220\n\006reason\030\004 \001(\0162 .dmi.R"
+  "ebootDeviceResponse.Reason\022\025\n\rreason_det"
+  "ail\030\005 \001(\t\"y\n\006Reason\022\024\n\020UNDEFINED_REASON\020"
+  "\000\022\022\n\016UNKNOWN_DEVICE\020\001\022\022\n\016INTERNAL_ERROR\020"
+  "\002\022\026\n\022DEVICE_UNREACHABLE\020\003\022\031\n\025DEVICE_IN_W"
+  "RONG_STATE\020\0042\276\n\n\031NativeHWManagementServi"
+  "ce\022S\n\023StartManagingDevice\022\030.dmi.Modifiab"
+  "leComponent\032 .dmi.StartManagingDeviceRes"
+  "ponse0\001\022U\n\022StopManagingDevice\022\036.dmi.Stop"
+  "ManagingDeviceRequest\032\037.dmi.StopManaging"
+  "DeviceResponse\022H\n\021GetManagedDevices\022\026.go"
+  "ogle.protobuf.Empty\032\033.dmi.ManagedDevices"
+  "Response\022W\n\024GetPhysicalInventory\022\035.dmi.P"
+  "hysicalInventoryRequest\032\036.dmi.PhysicalIn"
+  "ventoryResponse0\001\022W\n\022GetHWComponentInfo\022"
+  "\036.dmi.HWComponentInfoGetRequest\032\037.dmi.HW"
+  "ComponentInfoGetResponse0\001\022U\n\022SetHWCompo"
+  "nentInfo\022\036.dmi.HWComponentInfoSetRequest"
+  "\032\037.dmi.HWComponentInfoSetResponse\022T\n\022Set"
+  "LoggingEndpoint\022\036.dmi.SetLoggingEndpoint"
+  "Request\032\036.dmi.SetRemoteEndpointResponse\022"
+  "F\n\022GetLoggingEndpoint\022\017.dmi.HardwareID\032\037"
+  ".dmi.GetLoggingEndpointResponse\022R\n\021SetMs"
+  "gBusEndpoint\022\035.dmi.SetMsgBusEndpointRequ"
+  "est\032\036.dmi.SetRemoteEndpointResponse\022K\n\021G"
+  "etMsgBusEndpoint\022\026.google.protobuf.Empty"
+  "\032\036.dmi.GetMsgBusEndpointResponse\022P\n\023GetL"
+  "oggableEntities\022\037.dmi.GetLoggableEntitie"
+  "sRequest\032\030.dmi.GetLogLevelResponse\022@\n\013Se"
+  "tLogLevel\022\027.dmi.SetLogLevelRequest\032\030.dmi"
+  ".SetLogLevelResponse\022@\n\013GetLogLevel\022\027.dm"
+  "i.GetLogLevelRequest\032\030.dmi.GetLogLevelRe"
+  "sponse\0228\n\016HeartbeatCheck\022\026.google.protob"
+  "uf.Empty\032\016.dmi.Heartbeat\022C\n\014RebootDevice"
+  "\022\030.dmi.RebootDeviceRequest\032\031.dmi.RebootD"
+  "eviceResponse\022F\n\rSetDmLogLevel\022\031.dmi.Set"
+  "DmLogLevelRequest\032\032.dmi.SetDmLogLevelRes"
+  "ponse\022F\n\rGetDmLogLevel\022\031.dmi.GetDmLogLev"
+  "elRequest\032\032.dmi.GetDmLogLevelResponseB;Z"
+  "9github.com/opencord/device-management-i"
+  "nterface/v3/go/dmib\006proto3"
   ;
 ::google::protobuf::internal::DescriptorTable descriptor_table_dmi_2fhw_5fmanagement_5fservice_2eproto = {
   false, InitDefaults_dmi_2fhw_5fmanagement_5fservice_2eproto, 
   descriptor_table_protodef_dmi_2fhw_5fmanagement_5fservice_2eproto,
-  "dmi/hw_management_service.proto", &assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto, 5749,
+  "dmi/hw_management_service.proto", &assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto, 6386,
 };
 
 void AddDescriptors_dmi_2fhw_5fmanagement_5fservice_2eproto() {
@@ -1239,10 +1367,54 @@
 const GetLogLevelResponse_Reason GetLogLevelResponse::Reason_MAX;
 const int GetLogLevelResponse::Reason_ARRAYSIZE;
 #endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
-const ::google::protobuf::EnumDescriptor* RebootDeviceResponse_Reason_descriptor() {
+const ::google::protobuf::EnumDescriptor* SetDmLogLevelResponse_Reason_descriptor() {
   ::google::protobuf::internal::AssignDescriptors(&assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto);
   return file_level_enum_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto[11];
 }
+bool SetDmLogLevelResponse_Reason_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+    case 2:
+      return true;
+    default:
+      return false;
+  }
+}
+
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const SetDmLogLevelResponse_Reason SetDmLogLevelResponse::UNDEFINED_REASON;
+const SetDmLogLevelResponse_Reason SetDmLogLevelResponse::INTERNAL_ERROR;
+const SetDmLogLevelResponse_Reason SetDmLogLevelResponse::UNKNOWN_LOG_LEVEL;
+const SetDmLogLevelResponse_Reason SetDmLogLevelResponse::Reason_MIN;
+const SetDmLogLevelResponse_Reason SetDmLogLevelResponse::Reason_MAX;
+const int SetDmLogLevelResponse::Reason_ARRAYSIZE;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+const ::google::protobuf::EnumDescriptor* GetDmLogLevelResponse_Reason_descriptor() {
+  ::google::protobuf::internal::AssignDescriptors(&assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto);
+  return file_level_enum_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto[12];
+}
+bool GetDmLogLevelResponse_Reason_IsValid(int value) {
+  switch (value) {
+    case 0:
+    case 1:
+      return true;
+    default:
+      return false;
+  }
+}
+
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const GetDmLogLevelResponse_Reason GetDmLogLevelResponse::UNDEFINED_REASON;
+const GetDmLogLevelResponse_Reason GetDmLogLevelResponse::INTERNAL_ERROR;
+const GetDmLogLevelResponse_Reason GetDmLogLevelResponse::Reason_MIN;
+const GetDmLogLevelResponse_Reason GetDmLogLevelResponse::Reason_MAX;
+const int GetDmLogLevelResponse::Reason_ARRAYSIZE;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+const ::google::protobuf::EnumDescriptor* RebootDeviceResponse_Reason_descriptor() {
+  ::google::protobuf::internal::AssignDescriptors(&assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto);
+  return file_level_enum_descriptors_dmi_2fhw_5fmanagement_5fservice_2eproto[13];
+}
 bool RebootDeviceResponse_Reason_IsValid(int value) {
   switch (value) {
     case 0:
@@ -10255,6 +10427,1315 @@
 
 // ===================================================================
 
+void SetDmLogLevelRequest::InitAsDefaultInstance() {
+}
+class SetDmLogLevelRequest::HasBitSetters {
+ public:
+};
+
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int SetDmLogLevelRequest::kLevelFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+SetDmLogLevelRequest::SetDmLogLevelRequest()
+  : ::google::protobuf::Message(), _internal_metadata_(nullptr) {
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:dmi.SetDmLogLevelRequest)
+}
+SetDmLogLevelRequest::SetDmLogLevelRequest(const SetDmLogLevelRequest& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(nullptr) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  level_ = from.level_;
+  // @@protoc_insertion_point(copy_constructor:dmi.SetDmLogLevelRequest)
+}
+
+void SetDmLogLevelRequest::SharedCtor() {
+  level_ = 0;
+}
+
+SetDmLogLevelRequest::~SetDmLogLevelRequest() {
+  // @@protoc_insertion_point(destructor:dmi.SetDmLogLevelRequest)
+  SharedDtor();
+}
+
+void SetDmLogLevelRequest::SharedDtor() {
+}
+
+void SetDmLogLevelRequest::SetCachedSize(int size) const {
+  _cached_size_.Set(size);
+}
+const SetDmLogLevelRequest& SetDmLogLevelRequest::default_instance() {
+  ::google::protobuf::internal::InitSCC(&::scc_info_SetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  return *internal_default_instance();
+}
+
+
+void SetDmLogLevelRequest::Clear() {
+// @@protoc_insertion_point(message_clear_start:dmi.SetDmLogLevelRequest)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  level_ = 0;
+  _internal_metadata_.Clear();
+}
+
+#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+const char* SetDmLogLevelRequest::_InternalParse(const char* begin, const char* end, void* object,
+                  ::google::protobuf::internal::ParseContext* ctx) {
+  auto msg = static_cast<SetDmLogLevelRequest*>(object);
+  ::google::protobuf::int32 size; (void)size;
+  int depth; (void)depth;
+  ::google::protobuf::uint32 tag;
+  ::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
+  auto ptr = begin;
+  while (ptr < end) {
+    ptr = ::google::protobuf::io::Parse32(ptr, &tag);
+    GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+    switch (tag >> 3) {
+      // .dmi.LogLevel level = 1;
+      case 1: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 8) goto handle_unusual;
+        ::google::protobuf::uint64 val = ::google::protobuf::internal::ReadVarint(&ptr);
+        msg->set_level(static_cast<::dmi::LogLevel>(val));
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        break;
+      }
+      default: {
+      handle_unusual:
+        if ((tag & 7) == 4 || tag == 0) {
+          ctx->EndGroup(tag);
+          return ptr;
+        }
+        auto res = UnknownFieldParse(tag, {_InternalParse, msg},
+          ptr, end, msg->_internal_metadata_.mutable_unknown_fields(), ctx);
+        ptr = res.first;
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr);
+        if (res.second) return ptr;
+      }
+    }  // switch
+  }  // while
+  return ptr;
+}
+#else  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+bool SetDmLogLevelRequest::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::google::protobuf::uint32 tag;
+  // @@protoc_insertion_point(parse_start:dmi.SetDmLogLevelRequest)
+  for (;;) {
+    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // .dmi.LogLevel level = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (8 & 0xFF)) {
+          int value = 0;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          set_level(static_cast< ::dmi::LogLevel >(value));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      default: {
+      handle_unusual:
+        if (tag == 0) {
+          goto success;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, _internal_metadata_.mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+success:
+  // @@protoc_insertion_point(parse_success:dmi.SetDmLogLevelRequest)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:dmi.SetDmLogLevelRequest)
+  return false;
+#undef DO_
+}
+#endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+
+void SetDmLogLevelRequest::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:dmi.SetDmLogLevelRequest)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  // .dmi.LogLevel level = 1;
+  if (this->level() != 0) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->level(), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:dmi.SetDmLogLevelRequest)
+}
+
+::google::protobuf::uint8* SetDmLogLevelRequest::InternalSerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // @@protoc_insertion_point(serialize_to_array_start:dmi.SetDmLogLevelRequest)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  // .dmi.LogLevel level = 1;
+  if (this->level() != 0) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->level(), target);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:dmi.SetDmLogLevelRequest)
+  return target;
+}
+
+size_t SetDmLogLevelRequest::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:dmi.SetDmLogLevelRequest)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  // .dmi.LogLevel level = 1;
+  if (this->level() != 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->level());
+  }
+
+  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
+  SetCachedSize(cached_size);
+  return total_size;
+}
+
+void SetDmLogLevelRequest::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:dmi.SetDmLogLevelRequest)
+  GOOGLE_DCHECK_NE(&from, this);
+  const SetDmLogLevelRequest* source =
+      ::google::protobuf::DynamicCastToGenerated<SetDmLogLevelRequest>(
+          &from);
+  if (source == nullptr) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:dmi.SetDmLogLevelRequest)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:dmi.SetDmLogLevelRequest)
+    MergeFrom(*source);
+  }
+}
+
+void SetDmLogLevelRequest::MergeFrom(const SetDmLogLevelRequest& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:dmi.SetDmLogLevelRequest)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  if (from.level() != 0) {
+    set_level(from.level());
+  }
+}
+
+void SetDmLogLevelRequest::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:dmi.SetDmLogLevelRequest)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void SetDmLogLevelRequest::CopyFrom(const SetDmLogLevelRequest& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:dmi.SetDmLogLevelRequest)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool SetDmLogLevelRequest::IsInitialized() const {
+  return true;
+}
+
+void SetDmLogLevelRequest::Swap(SetDmLogLevelRequest* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void SetDmLogLevelRequest::InternalSwap(SetDmLogLevelRequest* other) {
+  using std::swap;
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  swap(level_, other->level_);
+}
+
+::google::protobuf::Metadata SetDmLogLevelRequest::GetMetadata() const {
+  ::google::protobuf::internal::AssignDescriptors(&::assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto);
+  return ::file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto[kIndexInFileMessages];
+}
+
+
+// ===================================================================
+
+void SetDmLogLevelResponse::InitAsDefaultInstance() {
+}
+class SetDmLogLevelResponse::HasBitSetters {
+ public:
+};
+
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int SetDmLogLevelResponse::kStatusFieldNumber;
+const int SetDmLogLevelResponse::kReasonFieldNumber;
+const int SetDmLogLevelResponse::kReasonDetailFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+SetDmLogLevelResponse::SetDmLogLevelResponse()
+  : ::google::protobuf::Message(), _internal_metadata_(nullptr) {
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:dmi.SetDmLogLevelResponse)
+}
+SetDmLogLevelResponse::SetDmLogLevelResponse(const SetDmLogLevelResponse& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(nullptr) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  reason_detail_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  if (from.reason_detail().size() > 0) {
+    reason_detail_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.reason_detail_);
+  }
+  ::memcpy(&status_, &from.status_,
+    static_cast<size_t>(reinterpret_cast<char*>(&reason_) -
+    reinterpret_cast<char*>(&status_)) + sizeof(reason_));
+  // @@protoc_insertion_point(copy_constructor:dmi.SetDmLogLevelResponse)
+}
+
+void SetDmLogLevelResponse::SharedCtor() {
+  ::google::protobuf::internal::InitSCC(
+      &scc_info_SetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  reason_detail_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  ::memset(&status_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&reason_) -
+      reinterpret_cast<char*>(&status_)) + sizeof(reason_));
+}
+
+SetDmLogLevelResponse::~SetDmLogLevelResponse() {
+  // @@protoc_insertion_point(destructor:dmi.SetDmLogLevelResponse)
+  SharedDtor();
+}
+
+void SetDmLogLevelResponse::SharedDtor() {
+  reason_detail_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+
+void SetDmLogLevelResponse::SetCachedSize(int size) const {
+  _cached_size_.Set(size);
+}
+const SetDmLogLevelResponse& SetDmLogLevelResponse::default_instance() {
+  ::google::protobuf::internal::InitSCC(&::scc_info_SetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  return *internal_default_instance();
+}
+
+
+void SetDmLogLevelResponse::Clear() {
+// @@protoc_insertion_point(message_clear_start:dmi.SetDmLogLevelResponse)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  reason_detail_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  ::memset(&status_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&reason_) -
+      reinterpret_cast<char*>(&status_)) + sizeof(reason_));
+  _internal_metadata_.Clear();
+}
+
+#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+const char* SetDmLogLevelResponse::_InternalParse(const char* begin, const char* end, void* object,
+                  ::google::protobuf::internal::ParseContext* ctx) {
+  auto msg = static_cast<SetDmLogLevelResponse*>(object);
+  ::google::protobuf::int32 size; (void)size;
+  int depth; (void)depth;
+  ::google::protobuf::uint32 tag;
+  ::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
+  auto ptr = begin;
+  while (ptr < end) {
+    ptr = ::google::protobuf::io::Parse32(ptr, &tag);
+    GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+    switch (tag >> 3) {
+      // .dmi.Status status = 1;
+      case 1: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 8) goto handle_unusual;
+        ::google::protobuf::uint64 val = ::google::protobuf::internal::ReadVarint(&ptr);
+        msg->set_status(static_cast<::dmi::Status>(val));
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        break;
+      }
+      // .dmi.SetDmLogLevelResponse.Reason reason = 2;
+      case 2: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 16) goto handle_unusual;
+        ::google::protobuf::uint64 val = ::google::protobuf::internal::ReadVarint(&ptr);
+        msg->set_reason(static_cast<::dmi::SetDmLogLevelResponse_Reason>(val));
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        break;
+      }
+      // string reason_detail = 3;
+      case 3: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 26) goto handle_unusual;
+        ptr = ::google::protobuf::io::ReadSize(ptr, &size);
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        ctx->extra_parse_data().SetFieldName("dmi.SetDmLogLevelResponse.reason_detail");
+        object = msg->mutable_reason_detail();
+        if (size > end - ptr + ::google::protobuf::internal::ParseContext::kSlopBytes) {
+          parser_till_end = ::google::protobuf::internal::GreedyStringParserUTF8;
+          goto string_till_end;
+        }
+        GOOGLE_PROTOBUF_PARSER_ASSERT(::google::protobuf::internal::StringCheckUTF8(ptr, size, ctx));
+        ::google::protobuf::internal::InlineGreedyStringParser(object, ptr, size, ctx);
+        ptr += size;
+        break;
+      }
+      default: {
+      handle_unusual:
+        if ((tag & 7) == 4 || tag == 0) {
+          ctx->EndGroup(tag);
+          return ptr;
+        }
+        auto res = UnknownFieldParse(tag, {_InternalParse, msg},
+          ptr, end, msg->_internal_metadata_.mutable_unknown_fields(), ctx);
+        ptr = res.first;
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr);
+        if (res.second) return ptr;
+      }
+    }  // switch
+  }  // while
+  return ptr;
+string_till_end:
+  static_cast<::std::string*>(object)->clear();
+  static_cast<::std::string*>(object)->reserve(size);
+  goto len_delim_till_end;
+len_delim_till_end:
+  return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg},
+                               {parser_till_end, object}, size);
+}
+#else  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+bool SetDmLogLevelResponse::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::google::protobuf::uint32 tag;
+  // @@protoc_insertion_point(parse_start:dmi.SetDmLogLevelResponse)
+  for (;;) {
+    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // .dmi.Status status = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (8 & 0xFF)) {
+          int value = 0;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          set_status(static_cast< ::dmi::Status >(value));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // .dmi.SetDmLogLevelResponse.Reason reason = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (16 & 0xFF)) {
+          int value = 0;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          set_reason(static_cast< ::dmi::SetDmLogLevelResponse_Reason >(value));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // string reason_detail = 3;
+      case 3: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (26 & 0xFF)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_reason_detail()));
+          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+            this->reason_detail().data(), static_cast<int>(this->reason_detail().length()),
+            ::google::protobuf::internal::WireFormatLite::PARSE,
+            "dmi.SetDmLogLevelResponse.reason_detail"));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      default: {
+      handle_unusual:
+        if (tag == 0) {
+          goto success;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, _internal_metadata_.mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+success:
+  // @@protoc_insertion_point(parse_success:dmi.SetDmLogLevelResponse)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:dmi.SetDmLogLevelResponse)
+  return false;
+#undef DO_
+}
+#endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+
+void SetDmLogLevelResponse::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:dmi.SetDmLogLevelResponse)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  // .dmi.Status status = 1;
+  if (this->status() != 0) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->status(), output);
+  }
+
+  // .dmi.SetDmLogLevelResponse.Reason reason = 2;
+  if (this->reason() != 0) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      2, this->reason(), output);
+  }
+
+  // string reason_detail = 3;
+  if (this->reason_detail().size() > 0) {
+    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+      this->reason_detail().data(), static_cast<int>(this->reason_detail().length()),
+      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
+      "dmi.SetDmLogLevelResponse.reason_detail");
+    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+      3, this->reason_detail(), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:dmi.SetDmLogLevelResponse)
+}
+
+::google::protobuf::uint8* SetDmLogLevelResponse::InternalSerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // @@protoc_insertion_point(serialize_to_array_start:dmi.SetDmLogLevelResponse)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  // .dmi.Status status = 1;
+  if (this->status() != 0) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->status(), target);
+  }
+
+  // .dmi.SetDmLogLevelResponse.Reason reason = 2;
+  if (this->reason() != 0) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      2, this->reason(), target);
+  }
+
+  // string reason_detail = 3;
+  if (this->reason_detail().size() > 0) {
+    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+      this->reason_detail().data(), static_cast<int>(this->reason_detail().length()),
+      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
+      "dmi.SetDmLogLevelResponse.reason_detail");
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        3, this->reason_detail(), target);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:dmi.SetDmLogLevelResponse)
+  return target;
+}
+
+size_t SetDmLogLevelResponse::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:dmi.SetDmLogLevelResponse)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  // string reason_detail = 3;
+  if (this->reason_detail().size() > 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::StringSize(
+        this->reason_detail());
+  }
+
+  // .dmi.Status status = 1;
+  if (this->status() != 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->status());
+  }
+
+  // .dmi.SetDmLogLevelResponse.Reason reason = 2;
+  if (this->reason() != 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->reason());
+  }
+
+  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
+  SetCachedSize(cached_size);
+  return total_size;
+}
+
+void SetDmLogLevelResponse::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:dmi.SetDmLogLevelResponse)
+  GOOGLE_DCHECK_NE(&from, this);
+  const SetDmLogLevelResponse* source =
+      ::google::protobuf::DynamicCastToGenerated<SetDmLogLevelResponse>(
+          &from);
+  if (source == nullptr) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:dmi.SetDmLogLevelResponse)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:dmi.SetDmLogLevelResponse)
+    MergeFrom(*source);
+  }
+}
+
+void SetDmLogLevelResponse::MergeFrom(const SetDmLogLevelResponse& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:dmi.SetDmLogLevelResponse)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  if (from.reason_detail().size() > 0) {
+
+    reason_detail_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.reason_detail_);
+  }
+  if (from.status() != 0) {
+    set_status(from.status());
+  }
+  if (from.reason() != 0) {
+    set_reason(from.reason());
+  }
+}
+
+void SetDmLogLevelResponse::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:dmi.SetDmLogLevelResponse)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void SetDmLogLevelResponse::CopyFrom(const SetDmLogLevelResponse& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:dmi.SetDmLogLevelResponse)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool SetDmLogLevelResponse::IsInitialized() const {
+  return true;
+}
+
+void SetDmLogLevelResponse::Swap(SetDmLogLevelResponse* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void SetDmLogLevelResponse::InternalSwap(SetDmLogLevelResponse* other) {
+  using std::swap;
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  reason_detail_.Swap(&other->reason_detail_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+    GetArenaNoVirtual());
+  swap(status_, other->status_);
+  swap(reason_, other->reason_);
+}
+
+::google::protobuf::Metadata SetDmLogLevelResponse::GetMetadata() const {
+  ::google::protobuf::internal::AssignDescriptors(&::assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto);
+  return ::file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto[kIndexInFileMessages];
+}
+
+
+// ===================================================================
+
+void GetDmLogLevelRequest::InitAsDefaultInstance() {
+}
+class GetDmLogLevelRequest::HasBitSetters {
+ public:
+};
+
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+GetDmLogLevelRequest::GetDmLogLevelRequest()
+  : ::google::protobuf::Message(), _internal_metadata_(nullptr) {
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:dmi.GetDmLogLevelRequest)
+}
+GetDmLogLevelRequest::GetDmLogLevelRequest(const GetDmLogLevelRequest& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(nullptr) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  // @@protoc_insertion_point(copy_constructor:dmi.GetDmLogLevelRequest)
+}
+
+void GetDmLogLevelRequest::SharedCtor() {
+}
+
+GetDmLogLevelRequest::~GetDmLogLevelRequest() {
+  // @@protoc_insertion_point(destructor:dmi.GetDmLogLevelRequest)
+  SharedDtor();
+}
+
+void GetDmLogLevelRequest::SharedDtor() {
+}
+
+void GetDmLogLevelRequest::SetCachedSize(int size) const {
+  _cached_size_.Set(size);
+}
+const GetDmLogLevelRequest& GetDmLogLevelRequest::default_instance() {
+  ::google::protobuf::internal::InitSCC(&::scc_info_GetDmLogLevelRequest_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  return *internal_default_instance();
+}
+
+
+void GetDmLogLevelRequest::Clear() {
+// @@protoc_insertion_point(message_clear_start:dmi.GetDmLogLevelRequest)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  _internal_metadata_.Clear();
+}
+
+#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+const char* GetDmLogLevelRequest::_InternalParse(const char* begin, const char* end, void* object,
+                  ::google::protobuf::internal::ParseContext* ctx) {
+  auto msg = static_cast<GetDmLogLevelRequest*>(object);
+  ::google::protobuf::int32 size; (void)size;
+  int depth; (void)depth;
+  ::google::protobuf::uint32 tag;
+  ::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
+  auto ptr = begin;
+  while (ptr < end) {
+    ptr = ::google::protobuf::io::Parse32(ptr, &tag);
+    GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+    switch (tag >> 3) {
+      default: {
+        if ((tag & 7) == 4 || tag == 0) {
+          ctx->EndGroup(tag);
+          return ptr;
+        }
+        auto res = UnknownFieldParse(tag, {_InternalParse, msg},
+          ptr, end, msg->_internal_metadata_.mutable_unknown_fields(), ctx);
+        ptr = res.first;
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr);
+        if (res.second) return ptr;
+      }
+    }  // switch
+  }  // while
+  return ptr;
+}
+#else  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+bool GetDmLogLevelRequest::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::google::protobuf::uint32 tag;
+  // @@protoc_insertion_point(parse_start:dmi.GetDmLogLevelRequest)
+  for (;;) {
+    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+  handle_unusual:
+    if (tag == 0) {
+      goto success;
+    }
+    DO_(::google::protobuf::internal::WireFormat::SkipField(
+          input, tag, _internal_metadata_.mutable_unknown_fields()));
+  }
+success:
+  // @@protoc_insertion_point(parse_success:dmi.GetDmLogLevelRequest)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:dmi.GetDmLogLevelRequest)
+  return false;
+#undef DO_
+}
+#endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+
+void GetDmLogLevelRequest::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:dmi.GetDmLogLevelRequest)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:dmi.GetDmLogLevelRequest)
+}
+
+::google::protobuf::uint8* GetDmLogLevelRequest::InternalSerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // @@protoc_insertion_point(serialize_to_array_start:dmi.GetDmLogLevelRequest)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:dmi.GetDmLogLevelRequest)
+  return target;
+}
+
+size_t GetDmLogLevelRequest::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:dmi.GetDmLogLevelRequest)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
+  SetCachedSize(cached_size);
+  return total_size;
+}
+
+void GetDmLogLevelRequest::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:dmi.GetDmLogLevelRequest)
+  GOOGLE_DCHECK_NE(&from, this);
+  const GetDmLogLevelRequest* source =
+      ::google::protobuf::DynamicCastToGenerated<GetDmLogLevelRequest>(
+          &from);
+  if (source == nullptr) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:dmi.GetDmLogLevelRequest)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:dmi.GetDmLogLevelRequest)
+    MergeFrom(*source);
+  }
+}
+
+void GetDmLogLevelRequest::MergeFrom(const GetDmLogLevelRequest& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:dmi.GetDmLogLevelRequest)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+}
+
+void GetDmLogLevelRequest::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:dmi.GetDmLogLevelRequest)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void GetDmLogLevelRequest::CopyFrom(const GetDmLogLevelRequest& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:dmi.GetDmLogLevelRequest)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool GetDmLogLevelRequest::IsInitialized() const {
+  return true;
+}
+
+void GetDmLogLevelRequest::Swap(GetDmLogLevelRequest* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void GetDmLogLevelRequest::InternalSwap(GetDmLogLevelRequest* other) {
+  using std::swap;
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+}
+
+::google::protobuf::Metadata GetDmLogLevelRequest::GetMetadata() const {
+  ::google::protobuf::internal::AssignDescriptors(&::assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto);
+  return ::file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto[kIndexInFileMessages];
+}
+
+
+// ===================================================================
+
+void GetDmLogLevelResponse::InitAsDefaultInstance() {
+}
+class GetDmLogLevelResponse::HasBitSetters {
+ public:
+};
+
+#if !defined(_MSC_VER) || _MSC_VER >= 1900
+const int GetDmLogLevelResponse::kLevelFieldNumber;
+const int GetDmLogLevelResponse::kStatusFieldNumber;
+const int GetDmLogLevelResponse::kReasonFieldNumber;
+const int GetDmLogLevelResponse::kReasonDetailFieldNumber;
+#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900
+
+GetDmLogLevelResponse::GetDmLogLevelResponse()
+  : ::google::protobuf::Message(), _internal_metadata_(nullptr) {
+  SharedCtor();
+  // @@protoc_insertion_point(constructor:dmi.GetDmLogLevelResponse)
+}
+GetDmLogLevelResponse::GetDmLogLevelResponse(const GetDmLogLevelResponse& from)
+  : ::google::protobuf::Message(),
+      _internal_metadata_(nullptr) {
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  reason_detail_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  if (from.reason_detail().size() > 0) {
+    reason_detail_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.reason_detail_);
+  }
+  ::memcpy(&level_, &from.level_,
+    static_cast<size_t>(reinterpret_cast<char*>(&reason_) -
+    reinterpret_cast<char*>(&level_)) + sizeof(reason_));
+  // @@protoc_insertion_point(copy_constructor:dmi.GetDmLogLevelResponse)
+}
+
+void GetDmLogLevelResponse::SharedCtor() {
+  ::google::protobuf::internal::InitSCC(
+      &scc_info_GetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  reason_detail_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  ::memset(&level_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&reason_) -
+      reinterpret_cast<char*>(&level_)) + sizeof(reason_));
+}
+
+GetDmLogLevelResponse::~GetDmLogLevelResponse() {
+  // @@protoc_insertion_point(destructor:dmi.GetDmLogLevelResponse)
+  SharedDtor();
+}
+
+void GetDmLogLevelResponse::SharedDtor() {
+  reason_detail_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+
+void GetDmLogLevelResponse::SetCachedSize(int size) const {
+  _cached_size_.Set(size);
+}
+const GetDmLogLevelResponse& GetDmLogLevelResponse::default_instance() {
+  ::google::protobuf::internal::InitSCC(&::scc_info_GetDmLogLevelResponse_dmi_2fhw_5fmanagement_5fservice_2eproto.base);
+  return *internal_default_instance();
+}
+
+
+void GetDmLogLevelResponse::Clear() {
+// @@protoc_insertion_point(message_clear_start:dmi.GetDmLogLevelResponse)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  reason_detail_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+  ::memset(&level_, 0, static_cast<size_t>(
+      reinterpret_cast<char*>(&reason_) -
+      reinterpret_cast<char*>(&level_)) + sizeof(reason_));
+  _internal_metadata_.Clear();
+}
+
+#if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+const char* GetDmLogLevelResponse::_InternalParse(const char* begin, const char* end, void* object,
+                  ::google::protobuf::internal::ParseContext* ctx) {
+  auto msg = static_cast<GetDmLogLevelResponse*>(object);
+  ::google::protobuf::int32 size; (void)size;
+  int depth; (void)depth;
+  ::google::protobuf::uint32 tag;
+  ::google::protobuf::internal::ParseFunc parser_till_end; (void)parser_till_end;
+  auto ptr = begin;
+  while (ptr < end) {
+    ptr = ::google::protobuf::io::Parse32(ptr, &tag);
+    GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+    switch (tag >> 3) {
+      // .dmi.LogLevel level = 1;
+      case 1: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 8) goto handle_unusual;
+        ::google::protobuf::uint64 val = ::google::protobuf::internal::ReadVarint(&ptr);
+        msg->set_level(static_cast<::dmi::LogLevel>(val));
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        break;
+      }
+      // .dmi.Status status = 2;
+      case 2: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 16) goto handle_unusual;
+        ::google::protobuf::uint64 val = ::google::protobuf::internal::ReadVarint(&ptr);
+        msg->set_status(static_cast<::dmi::Status>(val));
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        break;
+      }
+      // .dmi.GetDmLogLevelResponse.Reason reason = 3;
+      case 3: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 24) goto handle_unusual;
+        ::google::protobuf::uint64 val = ::google::protobuf::internal::ReadVarint(&ptr);
+        msg->set_reason(static_cast<::dmi::GetDmLogLevelResponse_Reason>(val));
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        break;
+      }
+      // string reason_detail = 4;
+      case 4: {
+        if (static_cast<::google::protobuf::uint8>(tag) != 34) goto handle_unusual;
+        ptr = ::google::protobuf::io::ReadSize(ptr, &size);
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
+        ctx->extra_parse_data().SetFieldName("dmi.GetDmLogLevelResponse.reason_detail");
+        object = msg->mutable_reason_detail();
+        if (size > end - ptr + ::google::protobuf::internal::ParseContext::kSlopBytes) {
+          parser_till_end = ::google::protobuf::internal::GreedyStringParserUTF8;
+          goto string_till_end;
+        }
+        GOOGLE_PROTOBUF_PARSER_ASSERT(::google::protobuf::internal::StringCheckUTF8(ptr, size, ctx));
+        ::google::protobuf::internal::InlineGreedyStringParser(object, ptr, size, ctx);
+        ptr += size;
+        break;
+      }
+      default: {
+      handle_unusual:
+        if ((tag & 7) == 4 || tag == 0) {
+          ctx->EndGroup(tag);
+          return ptr;
+        }
+        auto res = UnknownFieldParse(tag, {_InternalParse, msg},
+          ptr, end, msg->_internal_metadata_.mutable_unknown_fields(), ctx);
+        ptr = res.first;
+        GOOGLE_PROTOBUF_PARSER_ASSERT(ptr != nullptr);
+        if (res.second) return ptr;
+      }
+    }  // switch
+  }  // while
+  return ptr;
+string_till_end:
+  static_cast<::std::string*>(object)->clear();
+  static_cast<::std::string*>(object)->reserve(size);
+  goto len_delim_till_end;
+len_delim_till_end:
+  return ctx->StoreAndTailCall(ptr, end, {_InternalParse, msg},
+                               {parser_till_end, object}, size);
+}
+#else  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+bool GetDmLogLevelResponse::MergePartialFromCodedStream(
+    ::google::protobuf::io::CodedInputStream* input) {
+#define DO_(EXPRESSION) if (!PROTOBUF_PREDICT_TRUE(EXPRESSION)) goto failure
+  ::google::protobuf::uint32 tag;
+  // @@protoc_insertion_point(parse_start:dmi.GetDmLogLevelResponse)
+  for (;;) {
+    ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
+    tag = p.first;
+    if (!p.second) goto handle_unusual;
+    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
+      // .dmi.LogLevel level = 1;
+      case 1: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (8 & 0xFF)) {
+          int value = 0;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          set_level(static_cast< ::dmi::LogLevel >(value));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // .dmi.Status status = 2;
+      case 2: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (16 & 0xFF)) {
+          int value = 0;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          set_status(static_cast< ::dmi::Status >(value));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // .dmi.GetDmLogLevelResponse.Reason reason = 3;
+      case 3: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (24 & 0xFF)) {
+          int value = 0;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          set_reason(static_cast< ::dmi::GetDmLogLevelResponse_Reason >(value));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      // string reason_detail = 4;
+      case 4: {
+        if (static_cast< ::google::protobuf::uint8>(tag) == (34 & 0xFF)) {
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_reason_detail()));
+          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+            this->reason_detail().data(), static_cast<int>(this->reason_detail().length()),
+            ::google::protobuf::internal::WireFormatLite::PARSE,
+            "dmi.GetDmLogLevelResponse.reason_detail"));
+        } else {
+          goto handle_unusual;
+        }
+        break;
+      }
+
+      default: {
+      handle_unusual:
+        if (tag == 0) {
+          goto success;
+        }
+        DO_(::google::protobuf::internal::WireFormat::SkipField(
+              input, tag, _internal_metadata_.mutable_unknown_fields()));
+        break;
+      }
+    }
+  }
+success:
+  // @@protoc_insertion_point(parse_success:dmi.GetDmLogLevelResponse)
+  return true;
+failure:
+  // @@protoc_insertion_point(parse_failure:dmi.GetDmLogLevelResponse)
+  return false;
+#undef DO_
+}
+#endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+
+void GetDmLogLevelResponse::SerializeWithCachedSizes(
+    ::google::protobuf::io::CodedOutputStream* output) const {
+  // @@protoc_insertion_point(serialize_start:dmi.GetDmLogLevelResponse)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  // .dmi.LogLevel level = 1;
+  if (this->level() != 0) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      1, this->level(), output);
+  }
+
+  // .dmi.Status status = 2;
+  if (this->status() != 0) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      2, this->status(), output);
+  }
+
+  // .dmi.GetDmLogLevelResponse.Reason reason = 3;
+  if (this->reason() != 0) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      3, this->reason(), output);
+  }
+
+  // string reason_detail = 4;
+  if (this->reason_detail().size() > 0) {
+    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+      this->reason_detail().data(), static_cast<int>(this->reason_detail().length()),
+      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
+      "dmi.GetDmLogLevelResponse.reason_detail");
+    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
+      4, this->reason_detail(), output);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
+        _internal_metadata_.unknown_fields(), output);
+  }
+  // @@protoc_insertion_point(serialize_end:dmi.GetDmLogLevelResponse)
+}
+
+::google::protobuf::uint8* GetDmLogLevelResponse::InternalSerializeWithCachedSizesToArray(
+    ::google::protobuf::uint8* target) const {
+  // @@protoc_insertion_point(serialize_to_array_start:dmi.GetDmLogLevelResponse)
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  // .dmi.LogLevel level = 1;
+  if (this->level() != 0) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      1, this->level(), target);
+  }
+
+  // .dmi.Status status = 2;
+  if (this->status() != 0) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      2, this->status(), target);
+  }
+
+  // .dmi.GetDmLogLevelResponse.Reason reason = 3;
+  if (this->reason() != 0) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      3, this->reason(), target);
+  }
+
+  // string reason_detail = 4;
+  if (this->reason_detail().size() > 0) {
+    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
+      this->reason_detail().data(), static_cast<int>(this->reason_detail().length()),
+      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
+      "dmi.GetDmLogLevelResponse.reason_detail");
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        4, this->reason_detail(), target);
+  }
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
+        _internal_metadata_.unknown_fields(), target);
+  }
+  // @@protoc_insertion_point(serialize_to_array_end:dmi.GetDmLogLevelResponse)
+  return target;
+}
+
+size_t GetDmLogLevelResponse::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:dmi.GetDmLogLevelResponse)
+  size_t total_size = 0;
+
+  if (_internal_metadata_.have_unknown_fields()) {
+    total_size +=
+      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
+        _internal_metadata_.unknown_fields());
+  }
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  // Prevent compiler warnings about cached_has_bits being unused
+  (void) cached_has_bits;
+
+  // string reason_detail = 4;
+  if (this->reason_detail().size() > 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::StringSize(
+        this->reason_detail());
+  }
+
+  // .dmi.LogLevel level = 1;
+  if (this->level() != 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->level());
+  }
+
+  // .dmi.Status status = 2;
+  if (this->status() != 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->status());
+  }
+
+  // .dmi.GetDmLogLevelResponse.Reason reason = 3;
+  if (this->reason() != 0) {
+    total_size += 1 +
+      ::google::protobuf::internal::WireFormatLite::EnumSize(this->reason());
+  }
+
+  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
+  SetCachedSize(cached_size);
+  return total_size;
+}
+
+void GetDmLogLevelResponse::MergeFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:dmi.GetDmLogLevelResponse)
+  GOOGLE_DCHECK_NE(&from, this);
+  const GetDmLogLevelResponse* source =
+      ::google::protobuf::DynamicCastToGenerated<GetDmLogLevelResponse>(
+          &from);
+  if (source == nullptr) {
+  // @@protoc_insertion_point(generalized_merge_from_cast_fail:dmi.GetDmLogLevelResponse)
+    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
+  } else {
+  // @@protoc_insertion_point(generalized_merge_from_cast_success:dmi.GetDmLogLevelResponse)
+    MergeFrom(*source);
+  }
+}
+
+void GetDmLogLevelResponse::MergeFrom(const GetDmLogLevelResponse& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:dmi.GetDmLogLevelResponse)
+  GOOGLE_DCHECK_NE(&from, this);
+  _internal_metadata_.MergeFrom(from._internal_metadata_);
+  ::google::protobuf::uint32 cached_has_bits = 0;
+  (void) cached_has_bits;
+
+  if (from.reason_detail().size() > 0) {
+
+    reason_detail_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.reason_detail_);
+  }
+  if (from.level() != 0) {
+    set_level(from.level());
+  }
+  if (from.status() != 0) {
+    set_status(from.status());
+  }
+  if (from.reason() != 0) {
+    set_reason(from.reason());
+  }
+}
+
+void GetDmLogLevelResponse::CopyFrom(const ::google::protobuf::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:dmi.GetDmLogLevelResponse)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+void GetDmLogLevelResponse::CopyFrom(const GetDmLogLevelResponse& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:dmi.GetDmLogLevelResponse)
+  if (&from == this) return;
+  Clear();
+  MergeFrom(from);
+}
+
+bool GetDmLogLevelResponse::IsInitialized() const {
+  return true;
+}
+
+void GetDmLogLevelResponse::Swap(GetDmLogLevelResponse* other) {
+  if (other == this) return;
+  InternalSwap(other);
+}
+void GetDmLogLevelResponse::InternalSwap(GetDmLogLevelResponse* other) {
+  using std::swap;
+  _internal_metadata_.Swap(&other->_internal_metadata_);
+  reason_detail_.Swap(&other->reason_detail_, &::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+    GetArenaNoVirtual());
+  swap(level_, other->level_);
+  swap(status_, other->status_);
+  swap(reason_, other->reason_);
+}
+
+::google::protobuf::Metadata GetDmLogLevelResponse::GetMetadata() const {
+  ::google::protobuf::internal::AssignDescriptors(&::assign_descriptors_table_dmi_2fhw_5fmanagement_5fservice_2eproto);
+  return ::file_level_metadata_dmi_2fhw_5fmanagement_5fservice_2eproto[kIndexInFileMessages];
+}
+
+
+// ===================================================================
+
 void Heartbeat::InitAsDefaultInstance() {
 }
 class Heartbeat::HasBitSetters {
@@ -11270,6 +12751,18 @@
 template<> PROTOBUF_NOINLINE ::dmi::GetLoggableEntitiesRequest* Arena::CreateMaybeMessage< ::dmi::GetLoggableEntitiesRequest >(Arena* arena) {
   return Arena::CreateInternal< ::dmi::GetLoggableEntitiesRequest >(arena);
 }
+template<> PROTOBUF_NOINLINE ::dmi::SetDmLogLevelRequest* Arena::CreateMaybeMessage< ::dmi::SetDmLogLevelRequest >(Arena* arena) {
+  return Arena::CreateInternal< ::dmi::SetDmLogLevelRequest >(arena);
+}
+template<> PROTOBUF_NOINLINE ::dmi::SetDmLogLevelResponse* Arena::CreateMaybeMessage< ::dmi::SetDmLogLevelResponse >(Arena* arena) {
+  return Arena::CreateInternal< ::dmi::SetDmLogLevelResponse >(arena);
+}
+template<> PROTOBUF_NOINLINE ::dmi::GetDmLogLevelRequest* Arena::CreateMaybeMessage< ::dmi::GetDmLogLevelRequest >(Arena* arena) {
+  return Arena::CreateInternal< ::dmi::GetDmLogLevelRequest >(arena);
+}
+template<> PROTOBUF_NOINLINE ::dmi::GetDmLogLevelResponse* Arena::CreateMaybeMessage< ::dmi::GetDmLogLevelResponse >(Arena* arena) {
+  return Arena::CreateInternal< ::dmi::GetDmLogLevelResponse >(arena);
+}
 template<> PROTOBUF_NOINLINE ::dmi::Heartbeat* Arena::CreateMaybeMessage< ::dmi::Heartbeat >(Arena* arena) {
   return Arena::CreateInternal< ::dmi::Heartbeat >(arena);
 }
diff --git a/cpp/dmi/hw_management_service.pb.h b/cpp/dmi/hw_management_service.pb.h
index 57c82a7..7f502f3 100644
--- a/cpp/dmi/hw_management_service.pb.h
+++ b/cpp/dmi/hw_management_service.pb.h
@@ -45,7 +45,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::google::protobuf::internal::AuxillaryParseTableField aux[]
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
-  static const ::google::protobuf::internal::ParseTable schema[25]
+  static const ::google::protobuf::internal::ParseTable schema[29]
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::google::protobuf::internal::FieldMetadata field_metadata[];
   static const ::google::protobuf::internal::SerializationTable serialization_table[];
@@ -56,6 +56,12 @@
 class EntitiesLogLevel;
 class EntitiesLogLevelDefaultTypeInternal;
 extern EntitiesLogLevelDefaultTypeInternal _EntitiesLogLevel_default_instance_;
+class GetDmLogLevelRequest;
+class GetDmLogLevelRequestDefaultTypeInternal;
+extern GetDmLogLevelRequestDefaultTypeInternal _GetDmLogLevelRequest_default_instance_;
+class GetDmLogLevelResponse;
+class GetDmLogLevelResponseDefaultTypeInternal;
+extern GetDmLogLevelResponseDefaultTypeInternal _GetDmLogLevelResponse_default_instance_;
 class GetLogLevelRequest;
 class GetLogLevelRequestDefaultTypeInternal;
 extern GetLogLevelRequestDefaultTypeInternal _GetLogLevelRequest_default_instance_;
@@ -104,6 +110,12 @@
 class RebootDeviceResponse;
 class RebootDeviceResponseDefaultTypeInternal;
 extern RebootDeviceResponseDefaultTypeInternal _RebootDeviceResponse_default_instance_;
+class SetDmLogLevelRequest;
+class SetDmLogLevelRequestDefaultTypeInternal;
+extern SetDmLogLevelRequestDefaultTypeInternal _SetDmLogLevelRequest_default_instance_;
+class SetDmLogLevelResponse;
+class SetDmLogLevelResponseDefaultTypeInternal;
+extern SetDmLogLevelResponseDefaultTypeInternal _SetDmLogLevelResponse_default_instance_;
 class SetLogLevelRequest;
 class SetLogLevelRequestDefaultTypeInternal;
 extern SetLogLevelRequestDefaultTypeInternal _SetLogLevelRequest_default_instance_;
@@ -132,6 +144,8 @@
 namespace google {
 namespace protobuf {
 template<> ::dmi::EntitiesLogLevel* Arena::CreateMaybeMessage<::dmi::EntitiesLogLevel>(Arena*);
+template<> ::dmi::GetDmLogLevelRequest* Arena::CreateMaybeMessage<::dmi::GetDmLogLevelRequest>(Arena*);
+template<> ::dmi::GetDmLogLevelResponse* Arena::CreateMaybeMessage<::dmi::GetDmLogLevelResponse>(Arena*);
 template<> ::dmi::GetLogLevelRequest* Arena::CreateMaybeMessage<::dmi::GetLogLevelRequest>(Arena*);
 template<> ::dmi::GetLogLevelResponse* Arena::CreateMaybeMessage<::dmi::GetLogLevelResponse>(Arena*);
 template<> ::dmi::GetLoggableEntitiesRequest* Arena::CreateMaybeMessage<::dmi::GetLoggableEntitiesRequest>(Arena*);
@@ -148,6 +162,8 @@
 template<> ::dmi::PhysicalInventoryResponse* Arena::CreateMaybeMessage<::dmi::PhysicalInventoryResponse>(Arena*);
 template<> ::dmi::RebootDeviceRequest* Arena::CreateMaybeMessage<::dmi::RebootDeviceRequest>(Arena*);
 template<> ::dmi::RebootDeviceResponse* Arena::CreateMaybeMessage<::dmi::RebootDeviceResponse>(Arena*);
+template<> ::dmi::SetDmLogLevelRequest* Arena::CreateMaybeMessage<::dmi::SetDmLogLevelRequest>(Arena*);
+template<> ::dmi::SetDmLogLevelResponse* Arena::CreateMaybeMessage<::dmi::SetDmLogLevelResponse>(Arena*);
 template<> ::dmi::SetLogLevelRequest* Arena::CreateMaybeMessage<::dmi::SetLogLevelRequest>(Arena*);
 template<> ::dmi::SetLogLevelResponse* Arena::CreateMaybeMessage<::dmi::SetLogLevelResponse>(Arena*);
 template<> ::dmi::SetLoggingEndpointRequest* Arena::CreateMaybeMessage<::dmi::SetLoggingEndpointRequest>(Arena*);
@@ -421,6 +437,49 @@
   return ::google::protobuf::internal::ParseNamedEnum<GetLogLevelResponse_Reason>(
     GetLogLevelResponse_Reason_descriptor(), name, value);
 }
+enum SetDmLogLevelResponse_Reason {
+  SetDmLogLevelResponse_Reason_UNDEFINED_REASON = 0,
+  SetDmLogLevelResponse_Reason_INTERNAL_ERROR = 1,
+  SetDmLogLevelResponse_Reason_UNKNOWN_LOG_LEVEL = 2,
+  SetDmLogLevelResponse_Reason_SetDmLogLevelResponse_Reason_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::google::protobuf::int32>::min(),
+  SetDmLogLevelResponse_Reason_SetDmLogLevelResponse_Reason_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::google::protobuf::int32>::max()
+};
+bool SetDmLogLevelResponse_Reason_IsValid(int value);
+const SetDmLogLevelResponse_Reason SetDmLogLevelResponse_Reason_Reason_MIN = SetDmLogLevelResponse_Reason_UNDEFINED_REASON;
+const SetDmLogLevelResponse_Reason SetDmLogLevelResponse_Reason_Reason_MAX = SetDmLogLevelResponse_Reason_UNKNOWN_LOG_LEVEL;
+const int SetDmLogLevelResponse_Reason_Reason_ARRAYSIZE = SetDmLogLevelResponse_Reason_Reason_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* SetDmLogLevelResponse_Reason_descriptor();
+inline const ::std::string& SetDmLogLevelResponse_Reason_Name(SetDmLogLevelResponse_Reason value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    SetDmLogLevelResponse_Reason_descriptor(), value);
+}
+inline bool SetDmLogLevelResponse_Reason_Parse(
+    const ::std::string& name, SetDmLogLevelResponse_Reason* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<SetDmLogLevelResponse_Reason>(
+    SetDmLogLevelResponse_Reason_descriptor(), name, value);
+}
+enum GetDmLogLevelResponse_Reason {
+  GetDmLogLevelResponse_Reason_UNDEFINED_REASON = 0,
+  GetDmLogLevelResponse_Reason_INTERNAL_ERROR = 1,
+  GetDmLogLevelResponse_Reason_GetDmLogLevelResponse_Reason_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::google::protobuf::int32>::min(),
+  GetDmLogLevelResponse_Reason_GetDmLogLevelResponse_Reason_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::google::protobuf::int32>::max()
+};
+bool GetDmLogLevelResponse_Reason_IsValid(int value);
+const GetDmLogLevelResponse_Reason GetDmLogLevelResponse_Reason_Reason_MIN = GetDmLogLevelResponse_Reason_UNDEFINED_REASON;
+const GetDmLogLevelResponse_Reason GetDmLogLevelResponse_Reason_Reason_MAX = GetDmLogLevelResponse_Reason_INTERNAL_ERROR;
+const int GetDmLogLevelResponse_Reason_Reason_ARRAYSIZE = GetDmLogLevelResponse_Reason_Reason_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* GetDmLogLevelResponse_Reason_descriptor();
+inline const ::std::string& GetDmLogLevelResponse_Reason_Name(GetDmLogLevelResponse_Reason value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    GetDmLogLevelResponse_Reason_descriptor(), value);
+}
+inline bool GetDmLogLevelResponse_Reason_Parse(
+    const ::std::string& name, GetDmLogLevelResponse_Reason* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<GetDmLogLevelResponse_Reason>(
+    GetDmLogLevelResponse_Reason_descriptor(), name, value);
+}
 enum RebootDeviceResponse_Reason {
   RebootDeviceResponse_Reason_UNDEFINED_REASON = 0,
   RebootDeviceResponse_Reason_UNKNOWN_DEVICE = 1,
@@ -3804,6 +3863,552 @@
 };
 // -------------------------------------------------------------------
 
+class SetDmLogLevelRequest final :
+    public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dmi.SetDmLogLevelRequest) */ {
+ public:
+  SetDmLogLevelRequest();
+  virtual ~SetDmLogLevelRequest();
+
+  SetDmLogLevelRequest(const SetDmLogLevelRequest& from);
+
+  inline SetDmLogLevelRequest& operator=(const SetDmLogLevelRequest& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  SetDmLogLevelRequest(SetDmLogLevelRequest&& from) noexcept
+    : SetDmLogLevelRequest() {
+    *this = ::std::move(from);
+  }
+
+  inline SetDmLogLevelRequest& operator=(SetDmLogLevelRequest&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  static const ::google::protobuf::Descriptor* descriptor() {
+    return default_instance().GetDescriptor();
+  }
+  static const SetDmLogLevelRequest& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const SetDmLogLevelRequest* internal_default_instance() {
+    return reinterpret_cast<const SetDmLogLevelRequest*>(
+               &_SetDmLogLevelRequest_default_instance_);
+  }
+  static constexpr int kIndexInFileMessages =
+    22;
+
+  void Swap(SetDmLogLevelRequest* other);
+  friend void swap(SetDmLogLevelRequest& a, SetDmLogLevelRequest& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline SetDmLogLevelRequest* New() const final {
+    return CreateMaybeMessage<SetDmLogLevelRequest>(nullptr);
+  }
+
+  SetDmLogLevelRequest* New(::google::protobuf::Arena* arena) const final {
+    return CreateMaybeMessage<SetDmLogLevelRequest>(arena);
+  }
+  void CopyFrom(const ::google::protobuf::Message& from) final;
+  void MergeFrom(const ::google::protobuf::Message& from) final;
+  void CopyFrom(const SetDmLogLevelRequest& from);
+  void MergeFrom(const SetDmLogLevelRequest& from);
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
+
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
+  ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
+  #else
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const final;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      ::google::protobuf::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const final;
+  void InternalSwap(SetDmLogLevelRequest* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return nullptr;
+  }
+  inline void* MaybeArenaPtr() const {
+    return nullptr;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const final;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // .dmi.LogLevel level = 1;
+  void clear_level();
+  static const int kLevelFieldNumber = 1;
+  ::dmi::LogLevel level() const;
+  void set_level(::dmi::LogLevel value);
+
+  // @@protoc_insertion_point(class_scope:dmi.SetDmLogLevelRequest)
+ private:
+  class HasBitSetters;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  int level_;
+  mutable ::google::protobuf::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_dmi_2fhw_5fmanagement_5fservice_2eproto;
+};
+// -------------------------------------------------------------------
+
+class SetDmLogLevelResponse final :
+    public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dmi.SetDmLogLevelResponse) */ {
+ public:
+  SetDmLogLevelResponse();
+  virtual ~SetDmLogLevelResponse();
+
+  SetDmLogLevelResponse(const SetDmLogLevelResponse& from);
+
+  inline SetDmLogLevelResponse& operator=(const SetDmLogLevelResponse& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  SetDmLogLevelResponse(SetDmLogLevelResponse&& from) noexcept
+    : SetDmLogLevelResponse() {
+    *this = ::std::move(from);
+  }
+
+  inline SetDmLogLevelResponse& operator=(SetDmLogLevelResponse&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  static const ::google::protobuf::Descriptor* descriptor() {
+    return default_instance().GetDescriptor();
+  }
+  static const SetDmLogLevelResponse& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const SetDmLogLevelResponse* internal_default_instance() {
+    return reinterpret_cast<const SetDmLogLevelResponse*>(
+               &_SetDmLogLevelResponse_default_instance_);
+  }
+  static constexpr int kIndexInFileMessages =
+    23;
+
+  void Swap(SetDmLogLevelResponse* other);
+  friend void swap(SetDmLogLevelResponse& a, SetDmLogLevelResponse& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline SetDmLogLevelResponse* New() const final {
+    return CreateMaybeMessage<SetDmLogLevelResponse>(nullptr);
+  }
+
+  SetDmLogLevelResponse* New(::google::protobuf::Arena* arena) const final {
+    return CreateMaybeMessage<SetDmLogLevelResponse>(arena);
+  }
+  void CopyFrom(const ::google::protobuf::Message& from) final;
+  void MergeFrom(const ::google::protobuf::Message& from) final;
+  void CopyFrom(const SetDmLogLevelResponse& from);
+  void MergeFrom(const SetDmLogLevelResponse& from);
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
+
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
+  ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
+  #else
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const final;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      ::google::protobuf::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const final;
+  void InternalSwap(SetDmLogLevelResponse* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return nullptr;
+  }
+  inline void* MaybeArenaPtr() const {
+    return nullptr;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const final;
+
+  // nested types ----------------------------------------------------
+
+  typedef SetDmLogLevelResponse_Reason Reason;
+  static const Reason UNDEFINED_REASON =
+    SetDmLogLevelResponse_Reason_UNDEFINED_REASON;
+  static const Reason INTERNAL_ERROR =
+    SetDmLogLevelResponse_Reason_INTERNAL_ERROR;
+  static const Reason UNKNOWN_LOG_LEVEL =
+    SetDmLogLevelResponse_Reason_UNKNOWN_LOG_LEVEL;
+  static inline bool Reason_IsValid(int value) {
+    return SetDmLogLevelResponse_Reason_IsValid(value);
+  }
+  static const Reason Reason_MIN =
+    SetDmLogLevelResponse_Reason_Reason_MIN;
+  static const Reason Reason_MAX =
+    SetDmLogLevelResponse_Reason_Reason_MAX;
+  static const int Reason_ARRAYSIZE =
+    SetDmLogLevelResponse_Reason_Reason_ARRAYSIZE;
+  static inline const ::google::protobuf::EnumDescriptor*
+  Reason_descriptor() {
+    return SetDmLogLevelResponse_Reason_descriptor();
+  }
+  static inline const ::std::string& Reason_Name(Reason value) {
+    return SetDmLogLevelResponse_Reason_Name(value);
+  }
+  static inline bool Reason_Parse(const ::std::string& name,
+      Reason* value) {
+    return SetDmLogLevelResponse_Reason_Parse(name, value);
+  }
+
+  // accessors -------------------------------------------------------
+
+  // string reason_detail = 3;
+  void clear_reason_detail();
+  static const int kReasonDetailFieldNumber = 3;
+  const ::std::string& reason_detail() const;
+  void set_reason_detail(const ::std::string& value);
+  #if LANG_CXX11
+  void set_reason_detail(::std::string&& value);
+  #endif
+  void set_reason_detail(const char* value);
+  void set_reason_detail(const char* value, size_t size);
+  ::std::string* mutable_reason_detail();
+  ::std::string* release_reason_detail();
+  void set_allocated_reason_detail(::std::string* reason_detail);
+
+  // .dmi.Status status = 1;
+  void clear_status();
+  static const int kStatusFieldNumber = 1;
+  ::dmi::Status status() const;
+  void set_status(::dmi::Status value);
+
+  // .dmi.SetDmLogLevelResponse.Reason reason = 2;
+  void clear_reason();
+  static const int kReasonFieldNumber = 2;
+  ::dmi::SetDmLogLevelResponse_Reason reason() const;
+  void set_reason(::dmi::SetDmLogLevelResponse_Reason value);
+
+  // @@protoc_insertion_point(class_scope:dmi.SetDmLogLevelResponse)
+ private:
+  class HasBitSetters;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::ArenaStringPtr reason_detail_;
+  int status_;
+  int reason_;
+  mutable ::google::protobuf::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_dmi_2fhw_5fmanagement_5fservice_2eproto;
+};
+// -------------------------------------------------------------------
+
+class GetDmLogLevelRequest final :
+    public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dmi.GetDmLogLevelRequest) */ {
+ public:
+  GetDmLogLevelRequest();
+  virtual ~GetDmLogLevelRequest();
+
+  GetDmLogLevelRequest(const GetDmLogLevelRequest& from);
+
+  inline GetDmLogLevelRequest& operator=(const GetDmLogLevelRequest& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  GetDmLogLevelRequest(GetDmLogLevelRequest&& from) noexcept
+    : GetDmLogLevelRequest() {
+    *this = ::std::move(from);
+  }
+
+  inline GetDmLogLevelRequest& operator=(GetDmLogLevelRequest&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  static const ::google::protobuf::Descriptor* descriptor() {
+    return default_instance().GetDescriptor();
+  }
+  static const GetDmLogLevelRequest& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const GetDmLogLevelRequest* internal_default_instance() {
+    return reinterpret_cast<const GetDmLogLevelRequest*>(
+               &_GetDmLogLevelRequest_default_instance_);
+  }
+  static constexpr int kIndexInFileMessages =
+    24;
+
+  void Swap(GetDmLogLevelRequest* other);
+  friend void swap(GetDmLogLevelRequest& a, GetDmLogLevelRequest& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline GetDmLogLevelRequest* New() const final {
+    return CreateMaybeMessage<GetDmLogLevelRequest>(nullptr);
+  }
+
+  GetDmLogLevelRequest* New(::google::protobuf::Arena* arena) const final {
+    return CreateMaybeMessage<GetDmLogLevelRequest>(arena);
+  }
+  void CopyFrom(const ::google::protobuf::Message& from) final;
+  void MergeFrom(const ::google::protobuf::Message& from) final;
+  void CopyFrom(const GetDmLogLevelRequest& from);
+  void MergeFrom(const GetDmLogLevelRequest& from);
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
+
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
+  ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
+  #else
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const final;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      ::google::protobuf::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const final;
+  void InternalSwap(GetDmLogLevelRequest* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return nullptr;
+  }
+  inline void* MaybeArenaPtr() const {
+    return nullptr;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const final;
+
+  // nested types ----------------------------------------------------
+
+  // accessors -------------------------------------------------------
+
+  // @@protoc_insertion_point(class_scope:dmi.GetDmLogLevelRequest)
+ private:
+  class HasBitSetters;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  mutable ::google::protobuf::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_dmi_2fhw_5fmanagement_5fservice_2eproto;
+};
+// -------------------------------------------------------------------
+
+class GetDmLogLevelResponse final :
+    public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dmi.GetDmLogLevelResponse) */ {
+ public:
+  GetDmLogLevelResponse();
+  virtual ~GetDmLogLevelResponse();
+
+  GetDmLogLevelResponse(const GetDmLogLevelResponse& from);
+
+  inline GetDmLogLevelResponse& operator=(const GetDmLogLevelResponse& from) {
+    CopyFrom(from);
+    return *this;
+  }
+  #if LANG_CXX11
+  GetDmLogLevelResponse(GetDmLogLevelResponse&& from) noexcept
+    : GetDmLogLevelResponse() {
+    *this = ::std::move(from);
+  }
+
+  inline GetDmLogLevelResponse& operator=(GetDmLogLevelResponse&& from) noexcept {
+    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
+      if (this != &from) InternalSwap(&from);
+    } else {
+      CopyFrom(from);
+    }
+    return *this;
+  }
+  #endif
+  static const ::google::protobuf::Descriptor* descriptor() {
+    return default_instance().GetDescriptor();
+  }
+  static const GetDmLogLevelResponse& default_instance();
+
+  static void InitAsDefaultInstance();  // FOR INTERNAL USE ONLY
+  static inline const GetDmLogLevelResponse* internal_default_instance() {
+    return reinterpret_cast<const GetDmLogLevelResponse*>(
+               &_GetDmLogLevelResponse_default_instance_);
+  }
+  static constexpr int kIndexInFileMessages =
+    25;
+
+  void Swap(GetDmLogLevelResponse* other);
+  friend void swap(GetDmLogLevelResponse& a, GetDmLogLevelResponse& b) {
+    a.Swap(&b);
+  }
+
+  // implements Message ----------------------------------------------
+
+  inline GetDmLogLevelResponse* New() const final {
+    return CreateMaybeMessage<GetDmLogLevelResponse>(nullptr);
+  }
+
+  GetDmLogLevelResponse* New(::google::protobuf::Arena* arena) const final {
+    return CreateMaybeMessage<GetDmLogLevelResponse>(arena);
+  }
+  void CopyFrom(const ::google::protobuf::Message& from) final;
+  void MergeFrom(const ::google::protobuf::Message& from) final;
+  void CopyFrom(const GetDmLogLevelResponse& from);
+  void MergeFrom(const GetDmLogLevelResponse& from);
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+  bool IsInitialized() const final;
+
+  size_t ByteSizeLong() const final;
+  #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  static const char* _InternalParse(const char* begin, const char* end, void* object, ::google::protobuf::internal::ParseContext* ctx);
+  ::google::protobuf::internal::ParseFunc _ParseFunc() const final { return _InternalParse; }
+  #else
+  bool MergePartialFromCodedStream(
+      ::google::protobuf::io::CodedInputStream* input) final;
+  #endif  // GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+  void SerializeWithCachedSizes(
+      ::google::protobuf::io::CodedOutputStream* output) const final;
+  ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
+      ::google::protobuf::uint8* target) const final;
+  int GetCachedSize() const final { return _cached_size_.Get(); }
+
+  private:
+  void SharedCtor();
+  void SharedDtor();
+  void SetCachedSize(int size) const final;
+  void InternalSwap(GetDmLogLevelResponse* other);
+  private:
+  inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
+    return nullptr;
+  }
+  inline void* MaybeArenaPtr() const {
+    return nullptr;
+  }
+  public:
+
+  ::google::protobuf::Metadata GetMetadata() const final;
+
+  // nested types ----------------------------------------------------
+
+  typedef GetDmLogLevelResponse_Reason Reason;
+  static const Reason UNDEFINED_REASON =
+    GetDmLogLevelResponse_Reason_UNDEFINED_REASON;
+  static const Reason INTERNAL_ERROR =
+    GetDmLogLevelResponse_Reason_INTERNAL_ERROR;
+  static inline bool Reason_IsValid(int value) {
+    return GetDmLogLevelResponse_Reason_IsValid(value);
+  }
+  static const Reason Reason_MIN =
+    GetDmLogLevelResponse_Reason_Reason_MIN;
+  static const Reason Reason_MAX =
+    GetDmLogLevelResponse_Reason_Reason_MAX;
+  static const int Reason_ARRAYSIZE =
+    GetDmLogLevelResponse_Reason_Reason_ARRAYSIZE;
+  static inline const ::google::protobuf::EnumDescriptor*
+  Reason_descriptor() {
+    return GetDmLogLevelResponse_Reason_descriptor();
+  }
+  static inline const ::std::string& Reason_Name(Reason value) {
+    return GetDmLogLevelResponse_Reason_Name(value);
+  }
+  static inline bool Reason_Parse(const ::std::string& name,
+      Reason* value) {
+    return GetDmLogLevelResponse_Reason_Parse(name, value);
+  }
+
+  // accessors -------------------------------------------------------
+
+  // string reason_detail = 4;
+  void clear_reason_detail();
+  static const int kReasonDetailFieldNumber = 4;
+  const ::std::string& reason_detail() const;
+  void set_reason_detail(const ::std::string& value);
+  #if LANG_CXX11
+  void set_reason_detail(::std::string&& value);
+  #endif
+  void set_reason_detail(const char* value);
+  void set_reason_detail(const char* value, size_t size);
+  ::std::string* mutable_reason_detail();
+  ::std::string* release_reason_detail();
+  void set_allocated_reason_detail(::std::string* reason_detail);
+
+  // .dmi.LogLevel level = 1;
+  void clear_level();
+  static const int kLevelFieldNumber = 1;
+  ::dmi::LogLevel level() const;
+  void set_level(::dmi::LogLevel value);
+
+  // .dmi.Status status = 2;
+  void clear_status();
+  static const int kStatusFieldNumber = 2;
+  ::dmi::Status status() const;
+  void set_status(::dmi::Status value);
+
+  // .dmi.GetDmLogLevelResponse.Reason reason = 3;
+  void clear_reason();
+  static const int kReasonFieldNumber = 3;
+  ::dmi::GetDmLogLevelResponse_Reason reason() const;
+  void set_reason(::dmi::GetDmLogLevelResponse_Reason value);
+
+  // @@protoc_insertion_point(class_scope:dmi.GetDmLogLevelResponse)
+ private:
+  class HasBitSetters;
+
+  ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
+  ::google::protobuf::internal::ArenaStringPtr reason_detail_;
+  int level_;
+  int status_;
+  int reason_;
+  mutable ::google::protobuf::internal::CachedSize _cached_size_;
+  friend struct ::TableStruct_dmi_2fhw_5fmanagement_5fservice_2eproto;
+};
+// -------------------------------------------------------------------
+
 class Heartbeat final :
     public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:dmi.Heartbeat) */ {
  public:
@@ -3842,7 +4447,7 @@
                &_Heartbeat_default_instance_);
   }
   static constexpr int kIndexInFileMessages =
-    22;
+    26;
 
   void Swap(Heartbeat* other);
   friend void swap(Heartbeat& a, Heartbeat& b) {
@@ -3954,7 +4559,7 @@
                &_RebootDeviceRequest_default_instance_);
   }
   static constexpr int kIndexInFileMessages =
-    23;
+    27;
 
   void Swap(RebootDeviceRequest* other);
   friend void swap(RebootDeviceRequest& a, RebootDeviceRequest& b) {
@@ -4069,7 +4674,7 @@
                &_RebootDeviceResponse_default_instance_);
   }
   static constexpr int kIndexInFileMessages =
-    24;
+    28;
 
   void Swap(RebootDeviceResponse* other);
   friend void swap(RebootDeviceResponse& a, RebootDeviceResponse& b) {
@@ -6614,6 +7219,212 @@
 
 // -------------------------------------------------------------------
 
+// SetDmLogLevelRequest
+
+// .dmi.LogLevel level = 1;
+inline void SetDmLogLevelRequest::clear_level() {
+  level_ = 0;
+}
+inline ::dmi::LogLevel SetDmLogLevelRequest::level() const {
+  // @@protoc_insertion_point(field_get:dmi.SetDmLogLevelRequest.level)
+  return static_cast< ::dmi::LogLevel >(level_);
+}
+inline void SetDmLogLevelRequest::set_level(::dmi::LogLevel value) {
+  
+  level_ = value;
+  // @@protoc_insertion_point(field_set:dmi.SetDmLogLevelRequest.level)
+}
+
+// -------------------------------------------------------------------
+
+// SetDmLogLevelResponse
+
+// .dmi.Status status = 1;
+inline void SetDmLogLevelResponse::clear_status() {
+  status_ = 0;
+}
+inline ::dmi::Status SetDmLogLevelResponse::status() const {
+  // @@protoc_insertion_point(field_get:dmi.SetDmLogLevelResponse.status)
+  return static_cast< ::dmi::Status >(status_);
+}
+inline void SetDmLogLevelResponse::set_status(::dmi::Status value) {
+  
+  status_ = value;
+  // @@protoc_insertion_point(field_set:dmi.SetDmLogLevelResponse.status)
+}
+
+// .dmi.SetDmLogLevelResponse.Reason reason = 2;
+inline void SetDmLogLevelResponse::clear_reason() {
+  reason_ = 0;
+}
+inline ::dmi::SetDmLogLevelResponse_Reason SetDmLogLevelResponse::reason() const {
+  // @@protoc_insertion_point(field_get:dmi.SetDmLogLevelResponse.reason)
+  return static_cast< ::dmi::SetDmLogLevelResponse_Reason >(reason_);
+}
+inline void SetDmLogLevelResponse::set_reason(::dmi::SetDmLogLevelResponse_Reason value) {
+  
+  reason_ = value;
+  // @@protoc_insertion_point(field_set:dmi.SetDmLogLevelResponse.reason)
+}
+
+// string reason_detail = 3;
+inline void SetDmLogLevelResponse::clear_reason_detail() {
+  reason_detail_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline const ::std::string& SetDmLogLevelResponse::reason_detail() const {
+  // @@protoc_insertion_point(field_get:dmi.SetDmLogLevelResponse.reason_detail)
+  return reason_detail_.GetNoArena();
+}
+inline void SetDmLogLevelResponse::set_reason_detail(const ::std::string& value) {
+  
+  reason_detail_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:dmi.SetDmLogLevelResponse.reason_detail)
+}
+#if LANG_CXX11
+inline void SetDmLogLevelResponse::set_reason_detail(::std::string&& value) {
+  
+  reason_detail_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:dmi.SetDmLogLevelResponse.reason_detail)
+}
+#endif
+inline void SetDmLogLevelResponse::set_reason_detail(const char* value) {
+  GOOGLE_DCHECK(value != nullptr);
+  
+  reason_detail_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:dmi.SetDmLogLevelResponse.reason_detail)
+}
+inline void SetDmLogLevelResponse::set_reason_detail(const char* value, size_t size) {
+  
+  reason_detail_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast<const char*>(value), size));
+  // @@protoc_insertion_point(field_set_pointer:dmi.SetDmLogLevelResponse.reason_detail)
+}
+inline ::std::string* SetDmLogLevelResponse::mutable_reason_detail() {
+  
+  // @@protoc_insertion_point(field_mutable:dmi.SetDmLogLevelResponse.reason_detail)
+  return reason_detail_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* SetDmLogLevelResponse::release_reason_detail() {
+  // @@protoc_insertion_point(field_release:dmi.SetDmLogLevelResponse.reason_detail)
+  
+  return reason_detail_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void SetDmLogLevelResponse::set_allocated_reason_detail(::std::string* reason_detail) {
+  if (reason_detail != nullptr) {
+    
+  } else {
+    
+  }
+  reason_detail_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), reason_detail);
+  // @@protoc_insertion_point(field_set_allocated:dmi.SetDmLogLevelResponse.reason_detail)
+}
+
+// -------------------------------------------------------------------
+
+// GetDmLogLevelRequest
+
+// -------------------------------------------------------------------
+
+// GetDmLogLevelResponse
+
+// .dmi.LogLevel level = 1;
+inline void GetDmLogLevelResponse::clear_level() {
+  level_ = 0;
+}
+inline ::dmi::LogLevel GetDmLogLevelResponse::level() const {
+  // @@protoc_insertion_point(field_get:dmi.GetDmLogLevelResponse.level)
+  return static_cast< ::dmi::LogLevel >(level_);
+}
+inline void GetDmLogLevelResponse::set_level(::dmi::LogLevel value) {
+  
+  level_ = value;
+  // @@protoc_insertion_point(field_set:dmi.GetDmLogLevelResponse.level)
+}
+
+// .dmi.Status status = 2;
+inline void GetDmLogLevelResponse::clear_status() {
+  status_ = 0;
+}
+inline ::dmi::Status GetDmLogLevelResponse::status() const {
+  // @@protoc_insertion_point(field_get:dmi.GetDmLogLevelResponse.status)
+  return static_cast< ::dmi::Status >(status_);
+}
+inline void GetDmLogLevelResponse::set_status(::dmi::Status value) {
+  
+  status_ = value;
+  // @@protoc_insertion_point(field_set:dmi.GetDmLogLevelResponse.status)
+}
+
+// .dmi.GetDmLogLevelResponse.Reason reason = 3;
+inline void GetDmLogLevelResponse::clear_reason() {
+  reason_ = 0;
+}
+inline ::dmi::GetDmLogLevelResponse_Reason GetDmLogLevelResponse::reason() const {
+  // @@protoc_insertion_point(field_get:dmi.GetDmLogLevelResponse.reason)
+  return static_cast< ::dmi::GetDmLogLevelResponse_Reason >(reason_);
+}
+inline void GetDmLogLevelResponse::set_reason(::dmi::GetDmLogLevelResponse_Reason value) {
+  
+  reason_ = value;
+  // @@protoc_insertion_point(field_set:dmi.GetDmLogLevelResponse.reason)
+}
+
+// string reason_detail = 4;
+inline void GetDmLogLevelResponse::clear_reason_detail() {
+  reason_detail_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline const ::std::string& GetDmLogLevelResponse::reason_detail() const {
+  // @@protoc_insertion_point(field_get:dmi.GetDmLogLevelResponse.reason_detail)
+  return reason_detail_.GetNoArena();
+}
+inline void GetDmLogLevelResponse::set_reason_detail(const ::std::string& value) {
+  
+  reason_detail_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
+  // @@protoc_insertion_point(field_set:dmi.GetDmLogLevelResponse.reason_detail)
+}
+#if LANG_CXX11
+inline void GetDmLogLevelResponse::set_reason_detail(::std::string&& value) {
+  
+  reason_detail_.SetNoArena(
+    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
+  // @@protoc_insertion_point(field_set_rvalue:dmi.GetDmLogLevelResponse.reason_detail)
+}
+#endif
+inline void GetDmLogLevelResponse::set_reason_detail(const char* value) {
+  GOOGLE_DCHECK(value != nullptr);
+  
+  reason_detail_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
+  // @@protoc_insertion_point(field_set_char:dmi.GetDmLogLevelResponse.reason_detail)
+}
+inline void GetDmLogLevelResponse::set_reason_detail(const char* value, size_t size) {
+  
+  reason_detail_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
+      ::std::string(reinterpret_cast<const char*>(value), size));
+  // @@protoc_insertion_point(field_set_pointer:dmi.GetDmLogLevelResponse.reason_detail)
+}
+inline ::std::string* GetDmLogLevelResponse::mutable_reason_detail() {
+  
+  // @@protoc_insertion_point(field_mutable:dmi.GetDmLogLevelResponse.reason_detail)
+  return reason_detail_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline ::std::string* GetDmLogLevelResponse::release_reason_detail() {
+  // @@protoc_insertion_point(field_release:dmi.GetDmLogLevelResponse.reason_detail)
+  
+  return reason_detail_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
+}
+inline void GetDmLogLevelResponse::set_allocated_reason_detail(::std::string* reason_detail) {
+  if (reason_detail != nullptr) {
+    
+  } else {
+    
+  }
+  reason_detail_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), reason_detail);
+  // @@protoc_insertion_point(field_set_allocated:dmi.GetDmLogLevelResponse.reason_detail)
+}
+
+// -------------------------------------------------------------------
+
 // Heartbeat
 
 // fixed32 heartbeat_signature = 1;
@@ -6815,6 +7626,14 @@
 
 // -------------------------------------------------------------------
 
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
+// -------------------------------------------------------------------
+
 
 // @@protoc_insertion_point(namespace_scope)
 
@@ -6878,6 +7697,16 @@
 inline const EnumDescriptor* GetEnumDescriptor< ::dmi::GetLogLevelResponse_Reason>() {
   return ::dmi::GetLogLevelResponse_Reason_descriptor();
 }
+template <> struct is_proto_enum< ::dmi::SetDmLogLevelResponse_Reason> : ::std::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::dmi::SetDmLogLevelResponse_Reason>() {
+  return ::dmi::SetDmLogLevelResponse_Reason_descriptor();
+}
+template <> struct is_proto_enum< ::dmi::GetDmLogLevelResponse_Reason> : ::std::true_type {};
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::dmi::GetDmLogLevelResponse_Reason>() {
+  return ::dmi::GetDmLogLevelResponse_Reason_descriptor();
+}
 template <> struct is_proto_enum< ::dmi::RebootDeviceResponse_Reason> : ::std::true_type {};
 template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::dmi::RebootDeviceResponse_Reason>() {
