VOL-3616: Add support for GetSingleValue RPC
Change-Id: I87d0f3e5a158e2062ae15993db272aaf38c59765
diff --git a/VERSION b/VERSION
index 0cadbc1..da6b0a8 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.5.5
+2.5.6
diff --git a/pyvoltha/adapters/iadapter.py b/pyvoltha/adapters/iadapter.py
index b3b906f..7d0fad5 100644
--- a/pyvoltha/adapters/iadapter.py
+++ b/pyvoltha/adapters/iadapter.py
@@ -207,6 +207,12 @@
def unsuppress_alarm(self, filter):
raise NotImplementedError()
+ def single_get_value_request(self, request):
+ raise NotImplementedError()
+
+ def single_set_value_request(self, request):
+ raise NotImplementedError()
+
def _get_handler(self, device):
if device.id in self.devices_handlers:
handler = self.devices_handlers[device.id]
diff --git a/pyvoltha/adapters/interface.py b/pyvoltha/adapters/interface.py
index 647155a..2687549 100644
--- a/pyvoltha/adapters/interface.py
+++ b/pyvoltha/adapters/interface.py
@@ -282,6 +282,20 @@
:return: Proto Message Response
"""
+ def single_get_value_request(msg):
+ """
+ Retrive a single type of attribute from a device.
+ :param msg: Proto Message (any)
+ :return: Proto Message Response
+ """
+
+ def single_set_value_request(msg):
+ """
+ Set a single type of attribute of a device.
+ :param msg: Proto Message (any)
+ :return: Proto Message Response
+ """
+
class ICoreSouthBoundInterface(Interface):
"""
diff --git a/pyvoltha/adapters/kafka/adapter_request_facade.py b/pyvoltha/adapters/kafka/adapter_request_facade.py
index 1d9b57f..f59f213 100644
--- a/pyvoltha/adapters/kafka/adapter_request_facade.py
+++ b/pyvoltha/adapters/kafka/adapter_request_facade.py
@@ -20,7 +20,7 @@
"""
from __future__ import absolute_import
import structlog
-from twisted.internet.defer import inlineCallbacks
+from twisted.internet.defer import inlineCallbacks, returnValue
from zope.interface import implementer
from twisted.internet import reactor
@@ -30,6 +30,7 @@
from voltha_protos.device_pb2 import Device, Port, ImageDownload, SimulateAlarmRequest, PmConfigs
from voltha_protos.openflow_13_pb2 import FlowChanges, FlowGroups, Flows, \
FlowGroupChanges, ofp_packet_out
+from voltha_protos.extensions_pb2 import SingleGetValueRequest
from voltha_protos.voltha_pb2 import OmciTestRequest
from pyvoltha.adapters.kafka.kafka_inter_container_library import IKafkaMessagingProxy, \
get_messaging_proxy, KAFKA_OFFSET_LATEST, KAFKA_OFFSET_EARLIEST, ARG_FROM_TOPIC
@@ -409,5 +410,16 @@
return False, Error(code=ErrorCode.INVALID_PARAMETERS,
reason="simulate-alarm-request-invalid")
- return True, self.adapter.simulate_alarm(d, req)
+ return True, self.adapter.simulate_alarm(d, req)
+ @inlineCallbacks
+ def single_get_value_request(self, request, **kwargs):
+ req = SingleGetValueRequest()
+ if request:
+ request.Unpack(req)
+ else:
+ return False, Error(code=ErrorCode.INVALID_PARAMETERS,
+ reason="request-invalid")
+ result = yield self.adapter.single_get_value_request(req)
+ res = yield result
+ return (True, res)