adding start stop features to microsemi adaptor
Change-Id: If840d41387f84de95e99cfe75901293f02d04ac9
diff --git a/voltha/adapters/microsemi/microsemi.py b/voltha/adapters/microsemi/microsemi.py
index bd87ea7..418ec1e 100644
--- a/voltha/adapters/microsemi/microsemi.py
+++ b/voltha/adapters/microsemi/microsemi.py
@@ -58,6 +58,7 @@
def __init__(self, adaptor_agent, config):
self.adaptor_agent = adaptor_agent
self.config = config
+ self.olts = {}
self.descriptor = Adapter(
id=self.name,
vendor='Microsemi / Celestica',
@@ -74,7 +75,8 @@
def stop(self):
log.debug('stopping')
- # TODO Stop all OLTs
+ for target in self.olts.keys():
+ self._abandon(target)
log.info('stopped')
return self
@@ -101,13 +103,13 @@
reactor.callLater(0, self._init_olt, olt, activation)
log.info('adopted-device', device=device)
- # TODO store olt elements
+ self.olts[target] = (olt, activation)
def abandon_device(self, device):
- raise NotImplementedError(0)
+ self._abandon(device.mac_address)
def deactivate_device(self, device):
- raise NotImplementedError()
+ self._abandon(device.mac_address)
def update_flows_bulk(self, device, flows, groups):
log.debug('bulk-flow-update', device_id=device.id,
@@ -133,6 +135,11 @@
olt.runbg()
activation_watch.runbg()
+ def _abandon(self, target):
+ olt, activation = self.olts[target]
+ olt.stop()
+ activation.stop()
+