VOL-491 Delete of ONU device should not be allowed either in CLI or CURL since it is 1-1 with VOntAni
Create and Delete of ONU device takes place only when VOntAni object is created and deleted respectively.
In order to create ONU device, creation of VOntAni is required as follows:
vont_ani create -n "VOntAni Name" -d "Description" -a up -p "Parent Reference (Channel Partition)" -s "SERIAL_NUMBER" -r "Preferred Channel Pair" -o 1
The above command will create ONU device with the serial number "SERIAL_NUMBER".
Note that VOntAni must reference existing channel partition. For VOLTHA 1.0, it also must reference preferred Channel Pair.
Deletion of this ONU device is not allowed with following command:
delete SERIAL_NUMBER
In order to delete ONU device, delete of VOntAni is required as follows:
vont_ani delete -n "VOntAni Name"
The above commands deletes ONU device as well.
Change-Id: I09ae6287114ad6b1bc8ef0720d637ce38764b56c
diff --git a/voltha/core/local_handler.py b/voltha/core/local_handler.py
index 70f3ecd..4f5d09c 100644
--- a/voltha/core/local_handler.py
+++ b/voltha/core/local_handler.py
@@ -648,6 +648,9 @@
assert device.admin_state == AdminState.DISABLED, \
'Device to delete cannot be ' \
'in admin state \'{}\''.format(device.admin_state)
+ assert not device.type.endswith("_onu"), \
+ 'ONU device cannot be deleted. ' \
+ 'Please consider deleting VOntAni to delete ONU device.'
self.root.remove(path)