VOL-492 Provide a way for VOntAni admin state to be updated until (VOL-314)
VontAni admin state reflects the admin state of the ONU device that has been created.
Without implementation of VOL-314, the ONU device admin state does not get updated.
Temporary fix is required until VOL-314 is implemented. To update admin state of ONU advice:
vont_ani update -n "VOntAni Name" -d "Descriptions" -a up -p "Parent reference (Channel Partition)" -s "SERIAL_NUMBER" -r "Preferred Channel Pair" -o 1
Note that existing parameters are required although they may not change. Otherwise, if not specified other parameters will be set to their default values.
Change-Id: Id6cb8f20488a26f868b26df618c7d70730eb0d15
diff --git a/voltha/core/xpon_agent.py b/voltha/core/xpon_agent.py
index f78b765..5236999 100644
--- a/voltha/core/xpon_agent.py
+++ b/voltha/core/xpon_agent.py
@@ -442,6 +442,8 @@
log.info('xpon-agent-updating-interface-at-onu-device:',
onu_device_id=onu_device.id, data=data)
self.update_interface_in_device(onu_device, data)
+ if isinstance(data, VOntaniConfig):
+ self.update_onu_device(olt_device, onu_device, data)
def remove_interface(self, data, device_id=None):
if not self.is_valid_interface(data):
@@ -694,6 +696,20 @@
else AdminState.PREPROVISIONED)
return
+ def update_onu_device(self, olt_device, onu_device, v_ont_ani):
+ log.info('update-onu-device', olt_device_id=olt_device.id,
+ onu_device_id=onu_device.id, v_ont_ani=v_ont_ani)
+ adapter_agent = self.get_device_adapter_agent(olt_device)
+ new_admin_state = AdminState.ENABLED if v_ont_ani.interface.enabled \
+ else AdminState.DISABLED
+ if onu_device.admin_state != new_admin_state:
+ log.info('update-onu-device-admin-state',
+ onu_device_id=onu_device.id,
+ new_admin_state=new_admin_state)
+ onu_device.admin_state = new_admin_state
+ self.core.get_proxy('/').update('/devices/{}'.format(onu_device.id),
+ onu_device)
+
def delete_onu_device(self, olt_device, onu_device):
log.info('delete-onu-device', olt_device_id=olt_device.id,
onu_device_id=onu_device.id)