CORD-2865 add creator to CordSubscriberRoot
Change-Id: I6a021750b2f3fa0935768bd251d317778f71de40
diff --git a/xos/synchronizer/models/models.py b/xos/synchronizer/models/models.py
index 11b0ad9..28244fa 100644
--- a/xos/synchronizer/models/models.py
+++ b/xos/synchronizer/models/models.py
@@ -44,6 +44,15 @@
except IndexError:
raise XOSValidationError("Service RCORD cannot be found, please make sure that the model exists.")
+ # VSGServiceInstance will extract the creator from the Subscriber, as it needs a creator to create its
+ # Instance.
+ if not self.creator:
+ # If we weren't passed an explicit creator, then we will assume the caller is the creator.
+ if not getattr(self, "caller", None):
+ raise XOSProgrammingError("CordSubscriberRoot's self.caller was not set")
+ self.creator = self.caller
+
+ # TODO: What is this for?
if (not hasattr(self, 'caller') or not self.caller.is_admin):
if (self.has_field_changed("service_specific_id")):
raise XOSPermissionDenied("You do not have permission to change service_specific_id")
diff --git a/xos/synchronizer/models/rcord.xproto b/xos/synchronizer/models/rcord.xproto
index 53499e9..cc2ddd3 100644
--- a/xos/synchronizer/models/rcord.xproto
+++ b/xos/synchronizer/models/rcord.xproto
@@ -20,4 +20,5 @@
optional int32 c_tag = 12 [null = True, db_index = False, blank = False];
required string olt_device = 13 [help_text = "VOLTDevice device_id", null = False, db_index = False, blank = False];
required string olt_port = 14 [help_text = "VOLTDevicePort port_id", null = False, db_index = False, blank = False];
+ optional manytoone creator->User:created_rcord_subscribers = 15 [db_index = True, null = True, blank = True];
}