class UUIDModel(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) history = HistoricalRecords(history_id_field=models.UUIDField(default=uuid.uuid4))
class UUIDRegisterModel(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
class BinaryTree(TimeStampedModel, models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) parent = models.ForeignKey('self', null=True, blank=True, related_name='children', db_index=True, on_delete=models.DO_NOTHING) position = models.CharField(max_length=1, choices=POSITION_CHOICES, default=POSITION_CHOICES.O) value = models.DecimalField(max_digits=20, decimal_places=8, default=Decimal('0.00')) user = models.ForeignKey('exchange_core.Users', on_delete=models.DO_NOTHING) class Meta: unique_together = (("parent", "position"), ) verbose_name = _("Binary tree") verbose_name_plural = _("Binary tree") @property def left_value(self): node = BinaryTree.objects.filter(parent__pk=self.pk, position=POSITION_CHOICES.L) if not node.exists(): return Decimal('0.00') l_sum = Report.objects.filter( lower_side=POSITION_CHOICES.L, statement__user=self.user).aggregate( discount=Sum('left_value'))['discount'] or Decimal('0.00') r_sum = Report.objects.filter( lower_side=POSITION_CHOICES.R, statement__user=self.user).aggregate( discount=Sum('right_value'))['discount'] or Decimal('0.00') discount_value = l_sum + r_sum node = node.first() with connection.cursor() as cursor: cursor.execute( BINARY_value_IN_TREE_RAW_QUERY.format(user_id=node.user.pk, depth=5)) rows = dictfetchall(cursor) return rows[0]['value'] - discount_value @property def right_value(self): node = BinaryTree.objects.filter(parent__pk=self.pk, position=POSITION_CHOICES.R) if not node.exists(): return Decimal('0.00') l_sum = Report.objects.filter( lower_side=POSITION_CHOICES.L, statement__user=self.user).aggregate( discount=Sum('left_value'))['discount'] or Decimal('0.00') r_sum = Report.objects.filter( lower_side=POSITION_CHOICES.R, statement__user=self.user).aggregate( discount=Sum('right_value'))['discount'] or Decimal('0.00') discount_value = l_sum + r_sum node = node.first() with connection.cursor() as cursor: cursor.execute( BINARY_value_IN_TREE_RAW_QUERY.format(user_id=node.user.pk, depth=5)) rows = dictfetchall(cursor) return rows[0]['value'] - discount_value @property def total_left_value(self): node = BinaryTree.objects.filter(parent__pk=self.pk, position=POSITION_CHOICES.L) if not node.exists(): return Decimal('0.00') node = node.first() with connection.cursor() as cursor: cursor.execute( BINARY_value_IN_TREE_RAW_QUERY.format(user_id=node.user.pk, depth=5)) rows = dictfetchall(cursor) return rows[0]['value'] @property def lower_side_value(self): if self.total_left_value > self.total_right_value: lower_side_value = self.total_right_value else: lower_side_value = self.total_left_value return lower_side_value @property def total_right_value(self): node = BinaryTree.objects.filter(parent__pk=self.pk, position=POSITION_CHOICES.R) if not node.exists(): return Decimal('0.00') node = node.first() with connection.cursor() as cursor: cursor.execute( BINARY_value_IN_TREE_RAW_QUERY.format(user_id=node.user.pk, depth=5)) rows = dictfetchall(cursor) return rows[0]['value'] @property def family(self): with connection.cursor() as cursor: cursor.execute( GET_TREE_FAMILY_RAW_QUERY.format(user_id=self.user.pk)) family = dictfetchall(cursor) return family @property def descendants(self): return self.family[1:] @property def next_position(self): if self.children.count() < 2: return self.pk level = self.get_level() if not level: level = self.descendants[-1]['level'] descendants = self.get_nodes(level) return descendants[0].get('id') return self.get_position(level) def has_children(self): return len(self.family) > 1 def get_level(self): descendants = Counter(node.get('level') for node in self.descendants) descendants = OrderedDict(sorted(descendants.items())) for level, qty in descendants.items(): if not qty == (2**level): return level def get_position(self, level): for descendant in self.descendants: if descendant.get('level') != (level - 1): continue parent = BinaryTree.objects.get(id=descendant.get('id')) if parent.children.count() < 2: return parent.id def get_nodes(self, level): return [ children for children in self.descendants if children.get('level') == level ] def node_exists(self, search_user): with connection.cursor() as cursor: cursor.execute( SEARCH_USER_IN_TREE_RAW_QUERY.format( user_id=self.user.pk, search_user_id=search_user.pk)) if len(dictfetchall(cursor)) > 0: return True return False def save(self, *args, **kwargs): owner = BinaryTree.objects.filter(position=POSITION_CHOICES.O) if self.position != POSITION_CHOICES.O and not self.parent: raise NodeMustHaveParent() if self.position == POSITION_CHOICES.O and owner: raise TreeUniqueOwner() super().save(*args, **kwargs)
BucketDataRegisterRequestUser, user_model=BucketMember, get_user=get_bucket_member_request_user, ) class UUIDModel(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) history = HistoricalRecords(history_id_field=models.UUIDField(default=uuid.uuid4)) class UUIDRegisterModel(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) register(UUIDRegisterModel, history_id_field=models.UUIDField(default=uuid.uuid4)) # Set the SIMPLE_HISTORY_HISTORY_ID_USE_UUID setattr(settings, "SIMPLE_HISTORY_HISTORY_ID_USE_UUID", True) class UUIDDefaultModel(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) history = HistoricalRecords() # Clear the SIMPLE_HISTORY_HISTORY_ID_USE_UUID delattr(settings, "SIMPLE_HISTORY_HISTORY_ID_USE_UUID")
class UUIDTag(TagBase): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name='CpGroupInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('forwardingBehaviour', models.TextField(blank=True, null=True)), ], ), migrations.CreateModel( name='ExtLinkPortInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('cpInstanceId', models.TextField(blank=True, null=True)), ], ), migrations.CreateModel( name='ExtManagedVirtualLinkInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('vnfVirtualLinkDescId', models.TextField()), ], ), migrations.CreateModel( name='ExtVirtualLinkInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ], ), migrations.CreateModel( name='NfpInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('nfpdId', models.TextField(blank=True, null=True)), ('nfpName', models.TextField(blank=True, null=True)), ('description', models.TextField(blank=True, null=True)), ('totalCp', models.TextField(blank=True, null=True)), ('nfpState', models.TextField()), ], ), migrations.CreateModel( name='NfpRule', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('etherDestinationAddress', models.TextField(blank=True, null=True)), ('etherSourceAddress', models.TextField(blank=True, null=True)), ('etherType', models.TextField(blank=True, null=True)), ('vlanTag', models.TextField(blank=True, null=True)), ('protocol', models.TextField(blank=True, null=True)), ('dscp', models.TextField(blank=True, null=True)), ('sourceIpAddressPrefix', models.TextField(blank=True, null=True)), ('destinationIpAddressPrefix', models.TextField(blank=True, null=True)), ('nfpRule', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, related_name='NfpInfo_nfpRule', to='NSLifecycleManagement.NfpInfo')), ], ), migrations.CreateModel( name='NsInstance', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('nsInstanceName', models.TextField()), ('nsInstanceDescription', models.TextField()), ('nsdId', models.TextField()), ('nsdInfoId', models.TextField()), ('flavourId', models.TextField(blank=True, null=True)), ('nestedNsInstanceId', models.TextField(blank=True, null=True)), ('nsState', models.TextField(default='NOT_INSTANTIATED')), ], ), migrations.CreateModel( name='NsLinkPortInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ], ), migrations.CreateModel( name='NsVirtualLinkInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('nsVirtualLinkDescId', models.TextField()), ('nsVirtualLinkProfileld', models.TextField()), ('virtualLinkInfo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsInstance_virtualLinkInfo', to='NSLifecycleManagement.NsInstance')), ], ), migrations.CreateModel( name='VnfcResourceInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('vduId', models.TextField()), ('storageResourceIds', models.TextField()), ('reservationId', models.TextField()), ('metadata', models.TextField()), ], ), migrations.CreateModel( name='VnfExtCpInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('cpdId', models.TextField()), ('extLinkPortId', models.TextField()), ('metadata', models.TextField()), ('associatedVnfcCpId', models.TextField()), ('associatedVnfVirtualLinkId', models.TextField()), ], ), migrations.CreateModel( name='VnfVirtualLinkResourceInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('vnfVirtualLinkDescId', models.TextField()), ('reservationId', models.TextField()), ('metadata', models.TextField()), ], ), migrations.CreateModel( name='VnfInstance', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('vnfInstanceName', models.TextField(blank=True, null=True)), ('vnfInstanceDescription', models.TextField(blank=True, null=True)), ('vnfdId', models.TextField()), ('vnfProvider', models.TextField()), ('vnfProductName', models.TextField()), ('vnfSoftwareVersion', models.TextField()), ('vnfdVersion', models.TextField()), ('vnfPkgId', models.TextField()), ('vnfConfigurableProperties', models.TextField(blank=True, null=True)), ('vimId', models.TextField(blank=True, null=True)), ('instantiationState', models.TextField(default='NOT_INSTANTIATED')), ('metadata', models.TextField(blank=True, null=True)), ('extensions', models.TextField(blank=True, null=True)), ('vnfInstance', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsInstance_VnfInstance', to='NSLifecycleManagement.NsInstance')), ], ), migrations.CreateModel( name='SapInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('sapdId', models.TextField()), ('sapName', models.TextField()), ('description', models.TextField()), ('vnfInstance', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsInstance_SapInfo', to='NSLifecycleManagement.NsInstance')), ], ), migrations.CreateModel( name='VnfcCpInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('cpdId', models.TextField()), ('vnfExtCpId', models.TextField(blank=True, null=True)), ('vnfLinkPortId', models.TextField(blank=True, null=True)), ('metadata', models.TextField(blank=True, null=True)), ('vnfcCpInfo', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnfcResourceInfo_vnfcResourceInfo', to='NSLifecycleManagement.VnfcResourceInfo')), ], ), migrations.CreateModel( name='CpProtocolInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('layerProtocol', models.TextField()), ('sapInfo_cpProtocolInfo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='SapInfo_CpProtocolInfo', to='NSLifecycleManagement.SapInfo')), ('vnfExtCpInfo_cpProtocolInfo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnfExtCpInfo_CpProtocolInfo', to='NSLifecycleManagement.VnfExtCpInfo')), ('vnfcCpInfo_cpProtocolInfo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnfcCpInfo_CpProtocolInfo', to='NSLifecycleManagement.VnfcCpInfo')), ], ), migrations.CreateModel( name='IpOverEthernetAddressInfo', fields=[ ('ipOverEthernet', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='CpProtocolInfo_IpOverEthernetAddressInfo', serialize=False, to='NSLifecycleManagement.CpProtocolInfo')), ('macAddress', models.TextField(blank=True, null=True)), ], ), migrations.CreateModel( name='IpAddresses', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('type', models.TextField()), ('addresses', models.TextField(blank=True, null=True)), ('isDynamic', models.BooleanField(blank=True, null=True)), ('subnetId', models.TextField(blank=True, null=True)), ('ipAddresses', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='IpOverEthernetAddressInfo_IpAddresses', to='NSLifecycleManagement.IpOverEthernetAddressInfo')), ], ), migrations.CreateModel( name='AddressRange', fields=[ ('addressRange', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='IpAddresses_AddressRange', serialize=False, to='NSLifecycleManagement.IpAddresses')), ('minAddress', models.TextField()), ('maxAddress', models.TextField()), ], ), migrations.CreateModel( name='ForwardingBehaviourInputParameters', fields=[ ('nsLinkPortInfo_nsCpHandle', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name= 'CpGroupInfo_ForwardingBehaviourInputParameters', serialize=False, to='NSLifecycleManagement.CpGroupInfo')), ('algortihmName', models.TextField(blank=True, null=True)), ('algorithmWeights', models.IntegerField(blank=True, null=True)), ], ), migrations.CreateModel( name='InstantiatedVnfInfo', fields=[ ('instantiatedVnfInfo', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='VnfInstance_instantiatedVnfInfo', serialize=False, to='NSLifecycleManagement.VnfInstance')), ('flavourId', models.TextField(blank=True, null=True)), ('vnfState', models.TextField(default='STOPPED')), ('localizationLanguage', models.TextField(blank=True, null=True)), ], ), migrations.CreateModel( name='NsInstanceLinks', fields=[ ('_links', models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='NsInstance_links', serialize=False, to='NSLifecycleManagement.NsInstance')), ('link_self', models.URLField()), ('nestedNsInstances', models.TextField(blank=True, null=True)), ('instantiate', models.URLField(blank=True, null=True)), ('terminate', models.URLField(blank=True, null=True)), ('update', models.URLField(blank=True, null=True)), ('scale', models.URLField(blank=True, null=True)), ('heal', models.URLField(blank=True, null=True)), ], ), migrations.CreateModel( name='VnfLinkPortInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('cpInstanceId', models.TextField(blank=True, null=True)), ('cpInstanceType', models.TextField(blank=True, null=True)), ('extManagedVirtualLinkInfo_vnfLinkPorts', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ExtManagedVirtualLinkInfo_VnfLinkPortInfo', to='NSLifecycleManagement.ExtManagedVirtualLinkInfo')), ('vnfVirtualLinkResourceInfo_vnfLinkPorts', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnfVirtualLinkResourceInfo_VnfLinkPortInfo', to='NSLifecycleManagement.VnfVirtualLinkResourceInfo')), ], ), migrations.CreateModel( name='VnffgInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('vnffgdId', models.TextField()), ('vnfInstanceId', models.TextField(blank=True, null=True)), ('nsVirtualLinkInfoId', models.TextField(blank=True, null=True)), ('vnffgInfo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsInstance_VnffgInfo', to='NSLifecycleManagement.NsInstance')), ], ), migrations.CreateModel( name='ResourceHandle', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('vimId', models.TextField(blank=True, null=True)), ('resourceProviderId', models.TextField(blank=True, null=True)), ('resourceId', models.TextField()), ('vimLevelResourceType', models.TextField(blank=True, null=True)), ('extLinkPortInfo_resourceHandle', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ExtLinkPortInfo_ResourceHandle', to='NSLifecycleManagement.ExtLinkPortInfo')), ('extManagedVirtualLinkInfo_networkResource', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ExtManagedVirtualLinkInfo_ResourceHandle', to='NSLifecycleManagement.ExtManagedVirtualLinkInfo')), ('extVirtualLinkInfo_resourceHandle', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ExtVirtualLinkInfo_ResourceHandle', to='NSLifecycleManagement.ExtVirtualLinkInfo')), ('nsLinkPortInfo_resourceHandle', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsLinkPortInfo_ResourceHandle', to='NSLifecycleManagement.NsLinkPortInfo')), ('nsVirtualLinkInfo_resourceHandle', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsVirtualLinkInfo_ResourceHandle', to='NSLifecycleManagement.NsVirtualLinkInfo')), ('virtualStorageResourceInfo_storageResource', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VirtualStorageResourceInfo_ResourceHandle', to='NSLifecycleManagement.VnfLinkPortInfo')), ('vnfLinkPortInfo_resourceHandle', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnfLinkPortInfo_ResourceHandle', to='NSLifecycleManagement.VnfLinkPortInfo')), ('vnfVirtualLinkResourceInfo_networkResource', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnfVirtualLinkResourceInfo_ResourceHandle', to='NSLifecycleManagement.VnfLinkPortInfo')), ('vnfcResourceInfo_computeResource', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnfcResourceInfo_ResourceHandle', to='NSLifecycleManagement.VnfLinkPortInfo')), ], ), migrations.CreateModel( name='PortRange', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('lowerPort', models.IntegerField()), ('upperPort', models.IntegerField()), ('destinationPortRange', models.OneToOneField( null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NfpRule_DestinationPortRange', to='NSLifecycleManagement.NfpRule')), ('sourcePortRange', models.OneToOneField( null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NfpRule_SourcePortRange', to='NSLifecycleManagement.NfpRule')), ], ), migrations.CreateModel( name='NsScaleInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('nsScalingAspectId', models.TextField()), ('nsScaleLevelId', models.TextField()), ('nsScaleStatus', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsInstance_NsScaleInfo', to='NSLifecycleManagement.NsInstance')), ], ), migrations.CreateModel( name='NsMonitoringParame', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('name', models.TextField(blank=True, null=True)), ('performanceMetric', models.TextField()), ('monitoringParameter', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsInstance_NsMonitoringParame', to='NSLifecycleManagement.NsInstance')), ], ), migrations.AddField( model_name='nslinkportinfo', name='linkPort', field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsVirtualLinkInfo_NsLinkPortInfo', to='NSLifecycleManagement.NsVirtualLinkInfo'), ), migrations.CreateModel( name='NsCpHandle', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('vnfInstanceId', models.TextField(blank=True, null=True)), ('vnfExtCpInstanceId', models.TextField(blank=True, null=True)), ('nsInstanceId', models.TextField(blank=True, null=True)), ('nsSapInstanceId', models.TextField(blank=True, null=True)), ('nsLinkPortInfo_nsCpHandle', models.OneToOneField( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsLinkPortInfo_NsCpHandle', to='NSLifecycleManagement.NsLinkPortInfo')), ('vnffgInfo_nsCpHandle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='VnffgInfo_NsCpHandle', to='NSLifecycleManagement.VnffgInfo')), ], ), migrations.AddField( model_name='nfpinfo', name='nfpInfo', field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='VnffgInfo_NfpInfo', to='NSLifecycleManagement.VnffgInfo'), ), migrations.CreateModel( name='Mask', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('startingPoint', models.IntegerField()), ('length', models.IntegerField()), ('value', models.TextField()), ('extendedCriteria', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='NfpInfo_Mask', to='NSLifecycleManagement.NfpRule')), ], ), migrations.AddField( model_name='extlinkportinfo', name='extLinkPorts', field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ExtVirtualLinkInfo_ExtLinkPortInfo', to='NSLifecycleManagement.ExtVirtualLinkInfo'), ), migrations.CreateModel( name='CpPairInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('vnfExtCpIds', models.TextField(blank=True, null=True)), ('sapIds', models.TextField(blank=True, null=True)), ('cpGroup', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='CpGroupInfo_CpPairInfo', to='NSLifecycleManagement.CpGroupInfo')), ], ), migrations.AddField( model_name='cpgroupinfo', name='cpGroup', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name='NfpInfo_CpGroupInfo', to='NSLifecycleManagement.NfpInfo'), ), migrations.CreateModel( name='AffinityOrAntiAffinityRule', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('vnfdId', models.TextField(blank=True, null=True)), ('vnfProfiledld', models.TextField()), ('vnfInstancedId', models.TextField(blank=True, null=True)), ('affinityOrAntiAffinity', models.TextField()), ('scope', models.TextField()), ('additionalAffinityOrAntiAffinityRule', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='NsInstance_AffinityOrAntiAffinityRule', to='NSLifecycleManagement.NsInstance')), ], ), migrations.AddField( model_name='vnfvirtuallinkresourceinfo', name='vnfVirtualLinkResourceInfo', field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='InstantiatedVnfInfo_VnfVirtualLinkResourceInfo', to='NSLifecycleManagement.InstantiatedVnfInfo'), ), migrations.CreateModel( name='VnfScaleInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('aspectlId', models.TextField()), ('scaleLevel', models.TextField()), ('scaleStatus', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='InstantiatedVnfInfo_VnfScaleInfo', to='NSLifecycleManagement.InstantiatedVnfInfo')), ], ), migrations.CreateModel( name='VnfMonitoringParamet', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('name', models.TextField(blank=True, null=True)), ('performanceMetric', models.TextField()), ('monitoringParameters', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='InstantiatedVnfInfo_VnfMonitoringParamet', to='NSLifecycleManagement.InstantiatedVnfInfo')), ], ), migrations.AddField( model_name='vnfextcpinfo', name='extCpInfo', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name='InstantiatedVnfInfo_VnfExtCpInfo', to='NSLifecycleManagement.InstantiatedVnfInfo'), ), migrations.AddField( model_name='vnfcresourceinfo', name='vnfcResourceInfo', field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='InstantiatedVnfInfo_VnfcResourceInfo', to='NSLifecycleManagement.InstantiatedVnfInfo'), ), migrations.CreateModel( name='VirtualStorageResourceInfo', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('virtualStorageDescId', models.TextField()), ('reservationId', models.TextField(blank=True, null=True)), ('metadata', models.TextField(blank=True, null=True)), ('virtualStorageResourceInfo', models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name= 'InstantiatedVnfInfo_VirtualStorageResourceInfo', to='NSLifecycleManagement.InstantiatedVnfInfo')), ], ), migrations.AddField( model_name='extvirtuallinkinfo', name='extVirtualLinkInfo', field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='InstantiatedVnfInfo_ExtVirtualLinkInfo', to='NSLifecycleManagement.InstantiatedVnfInfo'), ), migrations.AddField( model_name='extmanagedvirtuallinkinfo', name='extManagedVirtualLinkInfo', field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='InstantiatedVnfInfo_ExtManagedVirtualLinkInfo', to='NSLifecycleManagement.InstantiatedVnfInfo'), ), ]
class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("contenttypes", "0002_remove_content_type_name"), ] operations = [ migrations.CreateModel( name="Post", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "uuid", models.UUIDField(default=uuid.uuid4, editable=False, unique=True), ), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ("title", models.CharField(max_length=128)), ("body", models.CharField(max_length=10000)), ( "author", models.ForeignKey( null=True, on_delete=django.db.models.deletion.PROTECT, related_name="posts", to=settings.AUTH_USER_MODEL, ), ), ], options={"db_table": "posts",}, ), migrations.CreateModel( name="Comment", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "uuid", models.UUIDField(default=uuid.uuid4, editable=False, unique=True), ), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ("comment", models.CharField(max_length=2000)), ( "author", models.ForeignKey( on_delete=django.db.models.deletion.PROTECT, related_name="comments", to=settings.AUTH_USER_MODEL, ), ), ( "parent", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="children", to="posts.Comment", ), ), ( "post", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="comments", to="posts.Post", ), ), ], options={"db_table": "posts_comments",}, ), migrations.CreateModel( name="Vote", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "uuid", models.UUIDField(default=uuid.uuid4, editable=False, unique=True), ), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ( "vote", models.CharField( choices=[("LIKE", "Like"), ("DISLIKE", "Dislike")], max_length=32, ), ), ("object_id", models.PositiveIntegerField()), ( "content_type", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="contenttypes.ContentType", ), ), ( "user", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="votes", to=settings.AUTH_USER_MODEL, ), ), ], options={ "db_table": "posts_votes", "unique_together": {("user_id", "content_type_id", "object_id")}, }, ), ]
class ClusterCephStorage(models.Model): cluster_id = models.UUIDField(default=uuid.uuid4) ceph_storage_id = models.UUIDField(default=uuid.uuid4)
class CephStorage(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4) name = models.CharField(max_length=255, null=False, unique=True, blank=False) vars = common_models.JsonDictTextField() date_created = models.DateTimeField(auto_now_add=True)
class GenericUUIDTaggedItemBase(CommonGenericTaggedItemBase): object_id = models.UUIDField(verbose_name=_('Object id'), db_index=True) class Meta: abstract = True
class Migration(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name="Player", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "uuid", models.UUIDField( db_index=True, default=uuid.uuid4, editable=False, unique=True ), ), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ("name", models.CharField(max_length=255, verbose_name="Player Name")), ( "slug", autoslug.fields.AutoSlugField( editable=False, populate_from="name", unique=True, verbose_name="Player Slug", ), ), ( "country", django_countries.fields.CountryField( blank=True, max_length=2, verbose_name="Player Country" ), ), ( "position", models.CharField( blank=True, choices=[ ("Forward", "Forward"), ("Defender", "Defender"), ("Midfielder", "Midfielder"), ("Goalkeeper", "Goalkeeper"), ("Head Coach", "Head Coach"), ("Assistant Coach", "Assistant Coach"), ("Goalkeeper Coach", "Goalkeeper Coach"), ("Technical Director", "Technical Director"), ("Associate Head Coach", "Associate Head Coach"), ], max_length=50, verbose_name="Position", ), ), ( "squad_number", models.IntegerField(blank=True, verbose_name="Players Number"), ), ( "team", models.CharField( blank=True, max_length=255, null=True, verbose_name="Player's Team", ), ), ( "twitter", models.CharField( blank=True, max_length=255, verbose_name="Twitter" ), ), ( "instagram", models.CharField( blank=True, max_length=255, verbose_name="Instagram" ), ), ( "thumbnail", sorl.thumbnail.fields.ImageField( blank=True, upload_to=sghymnal.players.models.thumnail_upload_path, verbose_name="Player Thumbnail", ), ), ], options={"abstract": False,}, ), migrations.CreateModel( name="PlayerImage", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "image", sorl.thumbnail.fields.ImageField( upload_to=sghymnal.players.models.image_upload_path, verbose_name="Player Image", ), ), ( "player", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="images", to="players.Player", ), ), ], ), migrations.CreateModel( name="Bio", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("lang", models.CharField(max_length=50, verbose_name="Language")), ("bio", models.TextField(verbose_name="Bio")), ( "player", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="bios", to="players.Player", ), ), ], ), ]