[SEBA-505] Do not check for existing ONU on subscriber delete
Change-Id: I4fa8cb00a327aefc37a5ef777d1f5dcff03e1056
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
index 9713ab4..a9fbace 100644
--- a/xos/synchronizer/models/models.py
+++ b/xos/synchronizer/models/models.py
@@ -115,7 +115,7 @@
self.set_owner()
- if self.status != "pre-provisioned" and hasattr(self.owner.leaf_model, "access") and self.owner.leaf_model.access == "voltha":
+ if self.status != "pre-provisioned" and hasattr(self.owner.leaf_model, "access") and self.owner.leaf_model.access == "voltha" and not self.deleted:
# if the access network is managed by voltha, validate that onu_device actually exist
volt_service = self.owner.provider_services[0].leaf_model # we assume RCORDService is connected only to the vOLTService
diff --git a/xos/synchronizer/models/test_models.py b/xos/synchronizer/models/test_models.py
index 3d3c3f2..406e607 100644
--- a/xos/synchronizer/models/test_models.py
+++ b/xos/synchronizer/models/test_models.py
@@ -67,6 +67,7 @@
self.rcord_subscriber_class = RCORDSubscriber
self.rcord_subscriber = RCORDSubscriber()
+ self.rcord_subscriber.deleted = False
self.rcord_subscriber.id = None # this is a new model
self.rcord_subscriber.is_new = True
self.rcord_subscriber.onu_device = "BRCM1234"
@@ -124,6 +125,12 @@
self.assertEqual(e.exception.message, "The onu_device you specified (BRCM1234) does not exists")
self.models_decl.RCORDSubscriber_decl.save.assert_not_called()
+ def test_missing_onu_device_on_delete(self):
+ self.volt.leaf_model.has_access_device.return_value = False
+ self.rcord_subscriber.deleted = True
+ self.rcord_subscriber.save()
+ self.models_decl.RCORDSubscriber_decl.save.assert_called()
+
def test_validate_c_tag_pass(self):
"""
check that other subscriber attached to the same ONU don't have the same c_tag
@@ -131,7 +138,6 @@
self.models_decl.RCORDSubscriber_decl.objects.filter.return_value = [self.rcord_subscriber]
-
self.rcord_subscriber.save()
self.models_decl.RCORDSubscriber_decl.save.assert_called()