VOL-766 openOLT disable and reenable with propagation to child devices.
This is a soft disable which disables the ports and then the flows. It
sets the OLT and it's child devices to AdminState.DISABLED,
OperStatus.UNKNOWN, and ConnectStatus.UNREACHABLE. It includes a
reenable that reverses the effect.
Change-Id: Iffcd22a3e8242bf7acff328625cea246489b60c5
diff --git a/voltha/adapters/openolt/openolt.py b/voltha/adapters/openolt/openolt.py
index ab415d5..a5cb3bb 100644
--- a/voltha/adapters/openolt/openolt.py
+++ b/voltha/adapters/openolt/openolt.py
@@ -109,11 +109,13 @@
def disable_device(self, device):
log.info('disable-device', device=device)
- raise NotImplementedError()
+ handler = self.devices[device.id]
+ handler.disable()
def reenable_device(self, device):
log.info('reenable-device', device=device)
- raise NotImplementedError()
+ handler = self.devices[device.id]
+ handler.reenable()
def reboot_device(self, device):
log.info('reboot_device', device=device)
@@ -145,7 +147,9 @@
def delete_device(self, device):
log.info('delete-device', device=device)
- raise NotImplementedError()
+ handler = self.devices[device.id]
+ handler.delete()
+ del self.devices[device.id]
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 28d99d5..efbe641 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -756,3 +756,46 @@
def stringify_serial_number(self, serial_number):
return ''.join([serial_number.vendor_id,
self.stringify_vendor_specific(serial_number.vendor_specific)])
+
+ def disable(self):
+ self.log.info('sending-deactivate-olt-message', device_id=self.device_id)
+
+ # Send grpc call
+ #self.stub.DeactivateOlt(openolt_pb2.Empty())
+
+ # Soft deactivate. Turning down hardware should remove flows, but we are not doing that presently
+
+ # Bring OLT down
+ self.olt_down(oper_state=OperStatus.UNKNOWN, admin_state=AdminState.DISABLED,
+ connect_state = ConnectStatus.UNREACHABLE)
+
+
+ def delete(self):
+ self.log.info('delete-olt', device_id=self.device_id)
+
+ # Stop the grpc communication threads
+ self.log.info('stopping-grpc-threads', device_id=self.device_id)
+ self.indications_thread_active = False
+ self.heartbeat_thread_active = False
+
+ # Close the grpc channel
+ # self.log.info('unsubscribing-grpc-channel', device_id=self.device_id)
+ # self.channel.unsubscribe()
+
+ self.log.info('successfully-deleted-olt', device_id=self.device_id)
+
+ def reenable(self):
+ self.log.info('reenable-olt', device_id=self.device_id)
+
+ # Bring up OLT
+ self.olt_up()
+
+ # Enable all child devices
+ self.log.info('enabling-child-devices', device_id=self.device_id)
+ self.log.info('enabling-child-devices', olt_device_id=self.device_id)
+ self.adapter_agent.update_child_devices_state(parent_device_id=self.device_id,
+ admin_state=AdminState.ENABLED)
+
+ # Set all ports to enabled
+ self.log.info('enabling-all-ports', device_id=self.device_id)
+ self.adapter_agent.enable_all_ports(self.device_id)
\ No newline at end of file