VOL-1556 Added the neccessary function to fulfill AlarmSimulationRequest
simulate_alarm function is added to adapter_request_facade.py
Change-Id: Iad835a94f3190795b61eb5595afe31f40a3c0e6e
diff --git a/VERSION b/VERSION
index 699c6c6..385281e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.8
+0.1.9-dev
diff --git a/pyvoltha/adapters/kafka/adapter_request_facade.py b/pyvoltha/adapters/kafka/adapter_request_facade.py
old mode 100644
new mode 100755
index 98ba680..27dd5e7
--- a/pyvoltha/adapters/kafka/adapter_request_facade.py
+++ b/pyvoltha/adapters/kafka/adapter_request_facade.py
@@ -26,7 +26,7 @@
from afkak.consumer import OFFSET_LATEST, OFFSET_EARLIEST
from pyvoltha.adapters.interface import IAdapterInterface
from voltha_protos.inter_container_pb2 import IntType, InterAdapterMessage, StrType, Error, ErrorCode
-from voltha_protos.device_pb2 import Device, ImageDownload
+from voltha_protos.device_pb2 import Device, ImageDownload, SimulateAlarmRequest
from voltha_protos.openflow_13_pb2 import FlowChanges, FlowGroups, Flows, \
FlowGroupChanges, ofp_packet_out
from pyvoltha.adapters.kafka.kafka_inter_container_library import IKafkaMessagingProxy, \
@@ -343,4 +343,20 @@
return (True, self.adapter.receive_packet_out(d_id.val, op.val, p))
except Exception as e:
log.exception("error-processing-receive_packet_out", e=e)
+
+ def simulate_alarm(self, device, request, **kwargs):
+ d = Device()
+ if device:
+ device.Unpack(d)
+ else:
+ return False, Error(code=ErrorCode.INVALID_PARAMETERS,
+ reason="device-invalid")
+ req = SimulateAlarmRequest()
+ if request:
+ request.Unpack(req)
+ else:
+ return False, Error(code=ErrorCode.INVALID_PARAMETERS,
+ reason="simulate-alarm-request-invalid")
+
+ return True, self.adapter.simulate_alarm(d, req)