[ 3050 ] Fixing cut and paste error in voltha.proto.
This commit is an amendment to the previous commit with the
following changes:
1) Simplify the gRPC API to replace the activate_olt and re_enable apis
with only one enable api. Note the adapter interface remains
unchanged to keep the flexibility of operations between different
device adapters.
2) Small changes following the initial code review
This commit consits of the following updates:
1) Support for the following config changes:
1a) Reboot of an OLT/ONU
1b) Deletion of an OLT/ONU
1c) Disabling of an OLT/ONU
1d) Re-enabling of an OLT/ONU
2) Corresponding APIs are added to the voltha.proto file
3) The adapter interface has been augmented with the above
APIs
4) The ponsim_olt and ponsim_onu adapters have been updated to
implement the above APIs
TODOs:
1) Existing flows on the ponsim devices have not been updated
to reflect the above changes.
2) ponsim needs to be augmented to support the above APIs
3) integration tests
The above will be addressed in a separate commit
Change-Id: Ia7af7d773517df269cdc2b0c629d5ef8f1fb6e3a
diff --git a/voltha/core/device_agent.py b/voltha/core/device_agent.py
index 55feb14..2cb56ec 100644
--- a/voltha/core/device_agent.py
+++ b/voltha/core/device_agent.py
@@ -70,14 +70,31 @@
self.log.info('started')
returnValue(self)
- def stop(self):
- self.log.debug('stopping')
+ @inlineCallbacks
+ def stop(self, device):
+ self.log.debug('stopping', device=device)
+
+ # First, propagate this request to the device agents
+ yield self._delete_device(device)
+
self.proxy.unregister_callback(
CallbackType.PRE_UPDATE, self._validate_update)
self.proxy.unregister_callback(
CallbackType.POST_UPDATE, self._process_update)
self.log.info('stopped')
+ @inlineCallbacks
+ def reboot_device(self, device, dry_run=False):
+ self.log.info('reboot-device', device=device, dry_run=dry_run)
+ if not dry_run:
+ yield self.adapter_agent.reboot_device(device)
+
+ @inlineCallbacks
+ def get_device_details(self, device, dry_run=False):
+ self.log.info('get-device-details', device=device, dry_run=dry_run)
+ if not dry_run:
+ yield self.adapter_agent.get_device_details(device)
+
def _set_adapter_agent(self):
adapter_name = self._tmp_initial_data.adapter
if adapter_name == '':
@@ -144,9 +161,6 @@
self.last_data = device # so that we don't propagate back
self.proxy.update('/', device)
- def remove_device(self, device_id):
- raise NotImplementedError()
-
def _propagate_change(self, device, dry_run=False):
self.log.info('propagate-change', device=device, dry_run=dry_run)
if device != self.last_data:
@@ -158,13 +172,23 @@
self.log.info('abandon-device', device=device, dry_run=dry_run)
raise NotImplementedError()
+ @inlineCallbacks
def _disable_device(self, device, dry_run=False):
self.log.info('disable-device', device=device, dry_run=dry_run)
- raise NotImplementedError()
+ if not dry_run:
+ yield self.adapter_agent.disable_device(device)
+ @inlineCallbacks
def _reenable_device(self, device, dry_run=False):
self.log.info('reenable-device', device=device, dry_run=dry_run)
- raise NotImplementedError()
+ if not dry_run:
+ yield self.adapter_agent.reenable_device(device)
+
+ @inlineCallbacks
+ def _delete_device(self, device, dry_run=False):
+ self.log.info('delete-device', device=device, dry_run=dry_run)
+ if not dry_run:
+ yield self.adapter_agent.delete_device(device)
admin_state_fsm = {
@@ -204,7 +228,7 @@
# add ability to notify called when an flow update completes
# see https://jira.opencord.org/browse/CORD-839
- elif self.accepts_add_remove_flow_updates:
+ elif self.device_type.accepts_add_remove_flow_updates:
raise NotImplementedError()
else:
@@ -228,7 +252,7 @@
# add ability to notify called when an group update completes
# see https://jira.opencord.org/browse/CORD-839
- elif self.accepts_add_remove_flow_updates:
+ elif self.device_type.accepts_add_remove_flow_updates:
raise NotImplementedError()
else: