VOL-1385 VOL-2524: Implement delete device
Cleanup and remove openomci resources and tasks. Stop
looping collectors
Also remove unused functions that core will never call
Change-Id: If9f00531a58e053ed4093776e55aeeb7e99cb779
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 99efcd8..0ce8389 100644
--- a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_adapter.py
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_adapter.py
@@ -264,24 +264,3 @@
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 create_interface(self, device, data):
- self.log.debug('create-interface', device_id=device.id)
- if device.id in self.devices_handlers:
- handler = self.devices_handlers[device.id]
- if handler is not None:
- handler.create_interface(data)
-
- def update_interface(self, device, data):
- self.log.debug('update-interface', device_id=device.id)
- if device.id in self.devices_handlers:
- handler = self.devices_handlers[device.id]
- if handler is not None:
- handler.update_interface(data)
-
- def remove_interface(self, device, data):
- self.log.debug('remove-interface', device_id=device.id)
- if device.id in self.devices_handlers:
- handler = self.devices_handlers[device.id]
- if handler is not None:
- handler.remove_interface(data)
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 074f39e..8bb599d 100644
--- a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
@@ -82,13 +82,9 @@
self.adapter = adapter
self.core_proxy = adapter.core_proxy
self.adapter_proxy = adapter.adapter_proxy
- self.parent_adapter = None
self.parent_id = None
self.device_id = device_id
- self.incoming_messages = DeferredQueue()
- self.event_messages = DeferredQueue()
self.proxy_address = None
- self.tx_id = 0
self._enabled = False
self.events = None
self._pm_metrics = None
@@ -103,7 +99,6 @@
self._unis = dict() # Port # -> UniPort
self._pon = None
- # TODO: probably shouldnt be hardcoded, determine from olt maybe?
self._pon_port_number = 100
self.logical_device_id = None
@@ -360,13 +355,12 @@
def delete(self, device):
self.log.info('delete-onu', device_id=device.id, serial_number=device.serial_number)
- if self.parent_adapter:
- try:
- self.parent_adapter.delete_child_device(self.parent_id, device)
- except AttributeError:
- self.log.debug('parent-device-delete-child-not-implemented')
- else:
- self.log.debug("parent-adapter-not-available")
+
+ self._deferred.cancel()
+ self._test_request.stop_collector()
+ self._pm_metrics.stop_collector()
+ self.log.debug('removing-openomci-statemachine')
+ self.omci_agent.remove_device(device.id, cleanup=True)
def _create_tconts(self, uni_id, us_scheduler):
alloc_id = us_scheduler['alloc_id']
@@ -869,11 +863,6 @@
"set_vlan_vid": _set_vlan_vid,
"tp_id": tp_id}
- def get_tx_id(self):
- self.log.debug('get-tx-id')
- self.tx_id += 1
- return self.tx_id
-
def process_inter_adapter_message(self, request):
self.log.debug('process-inter-adapter-message', type=request.header.type, from_topic=request.header.from_topic,
to_topic=request.header.to_topic, to_device_id=request.header.to_device_id)
@@ -949,8 +938,7 @@
yield self.core_proxy.device_reason_update(self.device_id, onu_device.reason)
self._heartbeat.enabled = True
- # Currently called each time there is an onu "down" indication from the olt handler
- # TODO: possibly other reasons to "update" from the olt?
+ # Called each time there is an onu "down" indication from the olt handler
@inlineCallbacks
def update_interface(self, onu_indication):
self.log.info('update-interface', onu_id=onu_indication.onu_id,
@@ -973,23 +961,6 @@
else:
self.log.debug('not-changing-openomci-statemachine')
- # Not currently called by olt or anything else
- @inlineCallbacks
- def remove_interface(self, data):
- self.log.info('remove-interface', data=data)
-
- self.log.debug('stopping-openomci-statemachine')
- reactor.callLater(0, self._onu_omci_device.stop)
-
- # Let TP download happen again
- for uni_id in self._tp_service_specific_task:
- self._tp_service_specific_task[uni_id].clear()
- for uni_id in self._tech_profile_download_done:
- self._tech_profile_download_done[uni_id].clear()
-
- yield self.disable_ports(lock_ports=False)
- yield self.core_proxy.device_reason_update(self.device_id, "stopping-openomci")
-
@inlineCallbacks
def disable(self, device):
self.log.info('disable', device_id=device.id, serial_number=device.serial_number)
diff --git a/python/requirements.txt b/python/requirements.txt
index a23f841..d78506e 100644
--- a/python/requirements.txt
+++ b/python/requirements.txt
@@ -1,2 +1,2 @@
voltha-protos==3.0.0
-pyvoltha==2.3.11
+pyvoltha==2.3.12