VOL-1548 Fixed errors in openolt adapter when executing a delete command.
Change-Id: Ib629052d6c37495e6d168f45e25c9111aac88ebe
diff --git a/python/adapters/openolt/openolt.py b/python/adapters/openolt/openolt.py
index 682b62c..9c5f799 100644
--- a/python/adapters/openolt/openolt.py
+++ b/python/adapters/openolt/openolt.py
@@ -212,7 +212,8 @@
handler = self.devices[device.id]
handler.delete()
del self.devices[device.id]
- del self.logical_device_id_to_root_device_id[device.parent_id]
+ if device.parent_id in self.logical_device_id_to_root_device_id.keys():
+ del self.logical_device_id_to_root_device_id[device.parent_id]
return device
def get_device_details(self, device):
diff --git a/python/adapters/openolt/openolt_device.py b/python/adapters/openolt/openolt_device.py
index 2394907..beea0c7 100644
--- a/python/adapters/openolt/openolt_device.py
+++ b/python/adapters/openolt/openolt_device.py
@@ -1061,8 +1061,6 @@
# Rebooting to reset the state
self.reboot()
# Removing logical device
- ld = self.adapter_agent.get_logical_device(self.logical_device_id)
- self.adapter_agent.delete_logical_device(ld)
except Exception as e:
self.log.error('Failure to delete openolt device', error=e)
raise e