VOL-908 OpenOLT - delete OLT
Change-Id: I51f3e76e4a6d9f7a184d0b6168663949f541e53b
diff --git a/voltha/adapters/openolt/openolt.py b/voltha/adapters/openolt/openolt.py
index 634040d..288155c 100644
--- a/voltha/adapters/openolt/openolt.py
+++ b/voltha/adapters/openolt/openolt.py
@@ -178,6 +178,7 @@
handler = self.devices[device.id]
handler.delete()
del self.devices[device.id]
+ return device
def get_device_details(self, device):
log.debug('get_device_details', device=device)
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index ab312b2..f962513 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -912,8 +912,20 @@
def delete(self):
- self.log.info('delete-olt - Not implemented yet',
- device_id=self.device_id)
+ self.log.info('deleting-olt', device_id=self.device_id,
+ logical_device_id=self.logical_device_id)
+
+ try:
+ # Rebooting to reset the state
+ self.reboot()
+ # Removing logical device
+ self.proxy.remove('/logical_devices/{}'.
+ format(self.logical_device_id))
+ except Exception as e:
+ self.log.error('Failure to delete openolt device', error=e)
+ raise e
+ else:
+ self.log.info('successfully-deleted-olt', device_id=self.device_id)
def reenable(self):
diff --git a/voltha/core/adapter_agent.py b/voltha/core/adapter_agent.py
index 2ca627f..e3d05f6 100644
--- a/voltha/core/adapter_agent.py
+++ b/voltha/core/adapter_agent.py
@@ -202,7 +202,7 @@
def delete_device(self, device):
# Remove all child devices
self.delete_all_child_devices(device.id)
-
+ # Removing device
return self.adapter.delete_device(device)
def get_device_details(self, device):