Beispiel #1
0
class InternetExchangeBase(HandleRefModel):
    name = models.CharField(max_length=64, unique=True)
    name_long = models.CharField(max_length=254, blank=True)

    city = models.CharField(max_length=192)
    country = CountryField()

    notes = models.TextField(blank=True)

    region_continent = models.CharField(
        max_length=255, choices=const.REGIONS)
    media = models.CharField(max_length=128, choices=const.MEDIA)
    proto_unicast = models.BooleanField(default=False)
    proto_multicast = models.BooleanField(default=False)
    proto_ipv6 = models.BooleanField(default=False)

    website = URLField(blank=True)
    url_stats = URLField(blank=True)

    tech_email = models.EmailField(max_length=254, blank=True)
    tech_phone = models.CharField(max_length=192, blank=True)
    policy_email = models.EmailField(max_length=254, blank=True)
    policy_phone = models.CharField(max_length=192, blank=True)

    class Meta:
        abstract = True
        db_table = '%six' % settings.TABLE_PREFIX

    class HandleRef:
        tag = 'ix'
        delete_cascade = ["ixfac_set", "ixlan_set"]

    def __unicode__(self):
        return self.name
Beispiel #2
0
    def test_init(self):
        model = FullModel()

        new0 = URLField()
        new1 = URLField()
        assert 1 == len(new0.default_validators)
        assert 1 == len(new1.default_validators)

        new0 = ASNField()
        new1 = ASNField()
        assert 0 == len(new0.default_validators)
        assert 0 == len(new1.default_validators)

        new0 = IPAddressField()
        new1 = IPAddressField()
        assert_ip_validator(new0)
        assert_ip_validator(new1)

        new0 = IPPrefixField()
        new1 = IPPrefixField()
        assert_ip_validator(new0)
        assert_ip_validator(new1)

        new0 = MacAddressField()
        new1 = MacAddressField()
        assert 1 == len(new0.default_validators)
        assert 1 == len(new1.default_validators)
Beispiel #3
0
class NetworkBase(HandleRefModel):
    asn = ASNField(unique=True)
    name = models.CharField(max_length=255, unique=True)
    aka = models.CharField(max_length=255, blank=True)
    irr_as_set = models.CharField(max_length=255, blank=True)

    website = URLField(blank=True)
    looking_glass = URLField(blank=True)
    route_server = URLField(blank=True)

    notes = models.TextField(blank=True)
    notes_private = models.TextField(blank=True)

    info_traffic = models.CharField(
        max_length=39, blank=True, choices=const.TRAFFIC)
    info_ratio = models.CharField(max_length=45, blank=True, choices=const.RATIOS,
                                  default='Not Disclosed')
    info_scope = models.CharField(max_length=39, blank=True, choices=const.SCOPES,
                                  default='Not Disclosed')
    info_type = models.CharField(max_length=60, blank=True, choices=const.NET_TYPES,
                                 default='Not Disclosed')
    info_prefixes4 = models.PositiveIntegerField(null=True, blank=True)
    info_prefixes6 = models.PositiveIntegerField(null=True, blank=True)
    info_unicast = models.BooleanField(default=False)
    info_multicast = models.BooleanField(default=False)
    info_ipv6 = models.BooleanField(default=False)

    policy_url = URLField(blank=True)
    policy_general = models.CharField(max_length=72, blank=True,
                                      choices=const.POLICY_GENERAL)
    policy_locations = models.CharField(max_length=72, blank=True,
                                        choices=const.POLICY_LOCATIONS)
    policy_ratio = models.BooleanField(default=False)
    policy_contracts = models.CharField(max_length=36, blank=True,
                                        choices=const.POLICY_CONTRACTS)

    class Meta:
        abstract = True
        db_table = '%snetwork' % settings.TABLE_PREFIX;
        verbose_name_plural = "Networks"

    class HandleRef:
        tag = 'net'
        delete_cascade = ["poc_set", "netfac_set", "netixlan_set"]

    def __unicode__(self):
        return self.name
Beispiel #4
0
class FullModel(models.Model):
    url = URLField(null=True, blank=True)
    asn = ASNField(null=True, blank=True)
    ipv4 = IPAddressField(version=4, null=True, blank=True)
    ipv6 = IPAddressField(version=6, null=True, blank=True)
    ip_address = IPAddressField(null=True, blank=True)

    prefix = IPPrefixField(null=True, blank=True)
    prefix4 = IPPrefixField(version=4, null=True, blank=True)
    prefix6 = IPPrefixField(version=6, null=True, blank=True)
    mac = MacAddressField(null=True, blank=True)

    class Meta:
        app_label = 'django_inet.tests'
Beispiel #5
0
class ContactBase(HandleRefModel):
    role = models.CharField(max_length=27, choices=const.POC_ROLES)
    visible = models.CharField(
        max_length=64, choices=const.VISIBILITY, default='Public')
    name = models.CharField(max_length=254, blank=True)
    phone = models.CharField(max_length=100, blank=True)
    email = models.EmailField(max_length=254, blank=True)
    url = URLField(blank=True)

    class Meta:
        abstract = True
        db_table = '%snetwork_contact' % settings.TABLE_PREFIX

    class HandleRef:
        tag = 'poc'
Beispiel #6
0
class OrganizationBase(HandleRefModel, AddressModel):
    name = models.CharField(max_length=255, unique=True)
    website = URLField(blank=True)
    notes = models.TextField(blank=True)

    class Meta:
        abstract = True
        db_table = '%sorganization' % settings.TABLE_PREFIX
        verbose_name_plural = "Organizations"

    class HandleRef:
        tag = 'org'
        delete_cascade = ["net_set", "fac_set", "ix_set"]

    def __unicode__(self):
        return self.name
Beispiel #7
0
class FacilityBase(HandleRefModel, AddressModel):
    name = models.CharField(max_length=255, unique=True)
    website = URLField(blank=True)

    clli = models.CharField(max_length=18, blank=True)
    rencode = models.CharField(max_length=18, blank=True)
    npanxx = models.CharField(max_length=21, blank=True)

    notes = models.TextField(blank=True)

    class Meta:
        abstract = True
        db_table = '%sfacility' % settings.TABLE_PREFIX
        verbose_name_plural = "Facilities"

    class HandleRef:
        tag = 'fac'
        delete_cascade = ["ixfac_set", "netfac_set"]

    def __unicode__(self):
        return self.name