[CORD-3084] Attaching a subscriber to an ONU

Change-Id: I377116873761e2193ada9640a4d13690da771c53
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
index 80294d9..dd6c57f 100644
--- a/xos/synchronizer/models/models.py
+++ b/xos/synchronizer/models/models.py
@@ -70,20 +70,11 @@
         self.set_owner()
 
         if hasattr(self.owner.leaf_model, "access") and self.owner.leaf_model.access == "voltha":
-            # if the access network is managed by voltha, validate that olt_device and olt_port actually exists
+            # 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
 
-            try:
-                olt_device = [d for d in volt_service.volt_devices.all() if d.name == self.olt_device][0]
-            except IndexError, e:
-                raise XOSValidationError("The olt_device you specified (%s) does not exists" % self.olt_device)
-
-            try:
-                olt_port = [p for p in olt_device.ports.all() if p.name == self.olt_port][0]
-            except IndexError, e:
-                raise XOSValidationError("The olt_port you specified (%s) does not exists on OLTDevice %s" % (self.olt_port, olt_device.name))
-
-
+            if not volt_service.has_access_device(self.onu_device):
+                raise XOSValidationError("The onu_device you specified (%s) does not exists" % self.onu_device)
 
         super(RCORDSubscriber, self).save(*args, **kwargs)
         self.invalidate_related_objects()
diff --git a/xos/synchronizer/models/rcord.xproto b/xos/synchronizer/models/rcord.xproto
index 8fe2f67..122b80c 100644
--- a/xos/synchronizer/models/rcord.xproto
+++ b/xos/synchronizer/models/rcord.xproto
@@ -24,8 +24,7 @@
     required bool enable_uverse = 10 [default = True, null = False, db_index = False, blank = True];
     required string status = 11 [default = "enabled", choices = "(('enabled', 'Enabled'), ('suspended', 'Suspended'), ('delinquent', 'Delinquent'), ('copyrightviolation', 'Copyright Violation'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
     optional int32 c_tag = 12 [null = True, db_index = False, blank = False];
-    required string olt_device = 13 [help_text = "OLTDevice name", null = False, db_index = False, blank = False];
-    required string olt_port = 14 [help_text = "OLTDevicePort name", null = False, db_index = False, blank = False];
+    required string onu_device = 13 [help_text = "ONUDevice serial number", null = False, db_index = False, blank = False, unique = True];
     optional manytoone creator->User:created_rcord_subscribers = 15 [db_index = True, null = True, blank = True];
 
     optional int32 uni_port_id = 16 [help_text = "UNI PORT ID in VOLTHA", null = True, db_index = False, blank = False];