blob: 536695249383dd6906344479aea53cd5729ef327 [file] [log] [blame]
Sapan Bhatiaa46cc4d2017-04-21 14:57:54 +02001def __init__(self, *args, **kwargs):
2 onos_services = ONOSService.get_service_objects().all()
3 if onos_services:
4 self._meta.get_field("provider_service").default = onos_services[0].id
5 super(ONOSApp, self).__init__(*args, **kwargs)
6
7def save(self, *args, **kwargs):
8 if not self.creator:
9 if not getattr(self, "caller", None):
10 # caller must be set when creating a vCPE since it creates a slice
11 raise XOSProgrammingError("ONOSApp's self.caller was not set")
12 self.creator = self.caller
13 if not self.creator:
14 raise XOSProgrammingError("ONOSApp's self.creator was not set")
15
16 super(ONOSApp, self).save(*args, **kwargs)
17