diff --git a/whoisdb/LAYOUT b/whoisdb/LAYOUT new file mode 100644 index 0000000..7a86a18 --- /dev/null +++ b/whoisdb/LAYOUT @@ -0,0 +1,35 @@ +All Objects + handle / some type of auto generated identifier + generated from primary object names + can be defined by user + FOO23-(objectname)? + created / last modified + can be auto, at least for add + + +MNT - Maintainer; Access control for Objects in Database + + +PERSON/ROLE - Contact; Person or Role data, provides contact data + +ASNUM - AS-Number (MNTd); Holds an AS Number + validators: in darknet ranges? + number, unique + mnt_by + lower_mnt_by (can change everything except for as number) + + volatile, bool, check if as is not online 24/7 + +INET(6)NUM - IPv4/IPv6 prefix + address + netmask (cidr) + + +----- LIR PART +ASBlock + asno start + asno end + +IPRange + range start + range end diff --git a/whoisdb/models.py b/whoisdb/models.py index f3c7265..c2cd3e2 100644 --- a/whoisdb/models.py +++ b/whoisdb/models.py @@ -3,16 +3,9 @@ from django.db import models from dncore.models import User from .validators import HandleValidator -class ExtraFields(models.Model): - name = models.CharField(max_length=64) - value = models.CharField(max_length=128) - - order = models.PositiveSmallIntegerField() class WhoisObject(models.Model): handle_suffix = None - whois_fields = None - whois_extra_field_names = None handle = models.SlugField(max_length='32', unique=True, validators=[HandleValidator()]) created = models.DateTimeField(auto_add_now=True) @@ -38,30 +31,26 @@ class Contact(MntdObject): name = models.CharField(max_length=128) -class MntdCObject(MntdObject) - admin_c = models.ManyToManyField("Contact") - - class Meta: - abstract = True - -class MntdObject(WhoisObject): - admin_c = models.ManyToManyField(Contact) - mnt_by = models - - class Meta: - abstract = True - +class ASBlock(MntdObject): + parent_block = models.ForeignKey("ASBlock", models.CASCADE, null=True, blank=True, default=None) + description = models.CharField(max_length=64, blank=True) - - -class ASNumber(WhoisObject): +class ASNumber(MntdObject): number = models.PositiveIntegerField(unique=True, db_index=True) + volatile = models.BooleanField(default=False) + asblock = models.ForeignKey(ASBlock, models.CASCADE) + description = models.CharField(max_length=64, blank=True) + + mnt_lower = models.ManyToManyField(Maintainer) +#class Route(MntObject): +# class InetNum(WhoisObject): PROTO = (('ipv4', 'ipv4'), ('ipv6', 'ipv6')) protocol = models.CharField(max_length=4, choices=PROTO) netmask = models.PositiveIntegerField() + parent_range = models.ForeignKey("InetNum", models.CASCADE, null=True, blank=True, default=None) + description = models.CharField(max_length=64, blank=True) -#class ASBlock(WhoisObject): -# pass + mnt_lower = models.ManyToManyField(Maintainer) diff --git a/whoisdb/models_crap.py b/whoisdb/models_crap.py new file mode 100644 index 0000000..f3c7265 --- /dev/null +++ b/whoisdb/models_crap.py @@ -0,0 +1,67 @@ +from django.db import models + +from dncore.models import User +from .validators import HandleValidator + +class ExtraFields(models.Model): + name = models.CharField(max_length=64) + value = models.CharField(max_length=128) + + order = models.PositiveSmallIntegerField() + +class WhoisObject(models.Model): + handle_suffix = None + whois_fields = None + whois_extra_field_names = None + + handle = models.SlugField(max_length='32', unique=True, validators=[HandleValidator()]) + created = models.DateTimeField(auto_add_now=True) + last_modified = models.DateTimeField(auto_add_now=True) + + class Meta: + abstract = True + +class Maintainer(WhoisObject): + auth = models.ManyToManyField(User) + + admin_c = models.ManyToManyField("Contact") + +class MntdObject(WhoisObject): + mnt_by = models.ManyToManyField(Maintainer) + + class Meta: + abstract = True + + +class Contact(MntdObject): + TYPE = (('person', 'person'), ('role', 'role')) + + name = models.CharField(max_length=128) + +class MntdCObject(MntdObject) + admin_c = models.ManyToManyField("Contact") + + class Meta: + abstract = True + +class MntdObject(WhoisObject): + admin_c = models.ManyToManyField(Contact) + mnt_by = models + + class Meta: + abstract = True + + + + +class ASNumber(WhoisObject): + number = models.PositiveIntegerField(unique=True, db_index=True) + + +class InetNum(WhoisObject): + PROTO = (('ipv4', 'ipv4'), ('ipv6', 'ipv6')) + protocol = models.CharField(max_length=4, choices=PROTO) + netmask = models.PositiveIntegerField() + +#class ASBlock(WhoisObject): +# pass