SEBA-749 Implemented on demand api test action code in openonu adapter
Change-Id: I8c580a2f1c60811cc11ddac4e153ea0dd66e6355
diff --git a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_adapter.py b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_adapter.py
index 087e15b..11de8ca 100644
--- a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_adapter.py
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_adapter.py
@@ -277,3 +277,14 @@
to_topic=msg.header.to_topic, to_device_id=msg.header.to_device_id)
handler = self.devices_handlers[msg.header.to_device_id]
handler.process_inter_adapter_message(msg)
+
+ def start_omci_test(self, device, uuid):
+ """
+
+ :param device:
+ :return:
+ """
+ self.log.info('Omci-test-action-request-On', request=device)
+ handler = self.devices_handlers[device.id]
+ result = handler.start_omci_test_action(device, uuid)
+ return result
diff --git a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
index 0e05a51..da4de57 100644
--- a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
@@ -70,6 +70,7 @@
from pyvoltha.adapters.extensions.omci.tasks.omci_test_request import OmciTestRequest
from pyvoltha.adapters.extensions.omci.omci_entities import AniG
from pyvoltha.adapters.extensions.omci.omci_defs import EntityOperations, ReasonCodes
+from voltha_protos.voltha_pb2 import TestResponse
OP = EntityOperations
RC = ReasonCodes
@@ -1772,3 +1773,27 @@
# tp_path is of the format <technology>/<table_id>/<uni_port_name>
tp_id = int(tp_path.split(_PATH_SEPERATOR)[1])
return tp_id
+
+ def start_omci_test_action(self, device, uuid):
+ """
+
+ :param device:
+ :return:
+ """
+ # Code to Run OMCI Test Action
+ self.log.info('Omci-test-action-request-On', request=device.id)
+ kwargs_omci_test_action = {
+ OmciTestRequest.DEFAULT_FREQUENCY_KEY:
+ OmciTestRequest.DEFAULT_COLLECTION_FREQUENCY
+ }
+ serial_number = device.serial_number
+ if device.connect_status != ConnectStatus.REACHABLE or device.admin_state != AdminState.ENABLED:
+ return (TestResponse(result=TestResponse.FAILURE))
+ test_request = OmciTestRequest(self.core_proxy,
+ self.omci_agent, self.device_id, AniG,
+ serial_number,
+ self.logical_device_id, exclusive=False,
+ uuid=uuid,
+ **kwargs_omci_test_action)
+ test_request.perform_test_omci()
+ return (TestResponse(result=TestResponse.SUCCESS))
diff --git a/python/requirements.txt b/python/requirements.txt
index c82e1a4..4738bcf 100644
--- a/python/requirements.txt
+++ b/python/requirements.txt
@@ -1,2 +1,2 @@
-voltha-protos==3.2.7
-pyvoltha==2.3.22
+voltha-protos==3.2.8
+pyvoltha==2.3.23