SEBA-237 Add simulate_alarm CLI command and plumb through
Change-Id: I3e146bf2d2d4a4b2ee7e491fb62cb762e884e233
diff --git a/voltha/core/global_handler.py b/voltha/core/global_handler.py
index 54c2d28..098e145 100644
--- a/voltha/core/global_handler.py
+++ b/voltha/core/global_handler.py
@@ -1778,4 +1778,26 @@
returnValue(AlarmDeviceData())
else:
log.debug('grpc-success-response', response=response)
+ returnValue(response)
+
+ @twisted_async
+ @inlineCallbacks
+ def SimulateAlarm(self, request, context):
+ try:
+ log.debug('grpc-request', request=request)
+ response = yield self.dispatcher.dispatch('SimulateAlarm',
+ request,
+ context,
+ id=request.id)
+ log.debug('grpc-response', response=response)
+ except Exception as e:
+ log.exception('grpc-exception', e=e)
+
+ if isinstance(response, DispatchError):
+ log.warn('grpc-error-response', error=response.error_code)
+ context.set_details('Device \'{}\' error'.format(request.id))
+ context.set_code(response.error_code)
+ returnValue(OperationResp(code=OperationResp.OPERATION_FAILURE))
+ else:
+ log.debug('grpc-success-response', response=response)
returnValue(response)
\ No newline at end of file