mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #268: Added support for full 32-bit ASN space
This commit is contained in:
@ -0,0 +1,21 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.7 on 2016-07-13 19:24
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import dcim.fields
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('circuits', '0002_auto_20160622_1821'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='provider',
|
||||||
|
name='asn',
|
||||||
|
field=dcim.fields.ASNField(blank=True, null=True, verbose_name=b'ASN'),
|
||||||
|
),
|
||||||
|
]
|
@ -1,6 +1,7 @@
|
|||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
from dcim.fields import ASNField
|
||||||
from dcim.models import Site, Interface
|
from dcim.models import Site, Interface
|
||||||
from utilities.models import CreatedUpdatedModel
|
from utilities.models import CreatedUpdatedModel
|
||||||
|
|
||||||
@ -12,7 +13,7 @@ class Provider(CreatedUpdatedModel):
|
|||||||
"""
|
"""
|
||||||
name = models.CharField(max_length=50, unique=True)
|
name = models.CharField(max_length=50, unique=True)
|
||||||
slug = models.SlugField(unique=True)
|
slug = models.SlugField(unique=True)
|
||||||
asn = models.PositiveIntegerField(blank=True, null=True, verbose_name='ASN')
|
asn = ASNField(blank=True, null=True, verbose_name='ASN')
|
||||||
account = models.CharField(max_length=30, blank=True, verbose_name='Account number')
|
account = models.CharField(max_length=30, blank=True, verbose_name='Account number')
|
||||||
portal_url = models.URLField(blank=True, verbose_name='Portal')
|
portal_url = models.URLField(blank=True, verbose_name='Portal')
|
||||||
noc_contact = models.TextField(blank=True, verbose_name='NOC contact')
|
noc_contact = models.TextField(blank=True, verbose_name='NOC contact')
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
from netaddr import EUI, mac_unix_expanded
|
from netaddr import EUI, mac_unix_expanded
|
||||||
|
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.core.validators import MinValueValidator, MaxValueValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from .formfields import MACAddressFormField
|
from .formfields import MACAddressFormField
|
||||||
|
|
||||||
|
|
||||||
|
class ASNField(models.BigIntegerField):
|
||||||
|
description = "32-bit ASN field"
|
||||||
|
default_validators = [
|
||||||
|
MinValueValidator(1),
|
||||||
|
MaxValueValidator(4294967295),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class mac_unix_expanded_uppercase(mac_unix_expanded):
|
class mac_unix_expanded_uppercase(mac_unix_expanded):
|
||||||
word_fmt = '%.2X'
|
word_fmt = '%.2X'
|
||||||
|
|
||||||
|
21
netbox/dcim/migrations/0009_site_32bit_asn_support.py
Normal file
21
netbox/dcim/migrations/0009_site_32bit_asn_support.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.7 on 2016-07-13 19:24
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import dcim.fields
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('dcim', '0008_device_remove_primary_ip'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='site',
|
||||||
|
name='asn',
|
||||||
|
field=dcim.fields.ASNField(blank=True, null=True, verbose_name=b'ASN'),
|
||||||
|
),
|
||||||
|
]
|
@ -11,7 +11,7 @@ from extras.rpc import RPC_CLIENTS
|
|||||||
from utilities.fields import NullableCharField
|
from utilities.fields import NullableCharField
|
||||||
from utilities.models import CreatedUpdatedModel
|
from utilities.models import CreatedUpdatedModel
|
||||||
|
|
||||||
from .fields import MACAddressField
|
from .fields import ASNField, MACAddressField
|
||||||
|
|
||||||
RACK_FACE_FRONT = 0
|
RACK_FACE_FRONT = 0
|
||||||
RACK_FACE_REAR = 1
|
RACK_FACE_REAR = 1
|
||||||
@ -145,7 +145,7 @@ class Site(CreatedUpdatedModel):
|
|||||||
name = models.CharField(max_length=50, unique=True)
|
name = models.CharField(max_length=50, unique=True)
|
||||||
slug = models.SlugField(unique=True)
|
slug = models.SlugField(unique=True)
|
||||||
facility = models.CharField(max_length=50, blank=True)
|
facility = models.CharField(max_length=50, blank=True)
|
||||||
asn = models.PositiveIntegerField(blank=True, null=True, verbose_name='ASN')
|
asn = ASNField(blank=True, null=True, verbose_name='ASN')
|
||||||
physical_address = models.CharField(max_length=200, blank=True)
|
physical_address = models.CharField(max_length=200, blank=True)
|
||||||
shipping_address = models.CharField(max_length=200, blank=True)
|
shipping_address = models.CharField(max_length=200, blank=True)
|
||||||
comments = models.TextField(blank=True)
|
comments = models.TextField(blank=True)
|
||||||
|
Reference in New Issue
Block a user