1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Move BGP_ASN_MIN and BGP_ASN_MAX to ipam.constants

This commit is contained in:
Jeremy Stretch
2020-01-15 14:53:46 -05:00
parent caf7d02637
commit 88267e9d05
4 changed files with 15 additions and 7 deletions

View File

@ -1,9 +1,5 @@
from .choices import InterfaceTypeChoices from .choices import InterfaceTypeChoices
# BGP ASN bounds
BGP_ASN_MIN = 1
BGP_ASN_MAX = 2**32 - 1
# #
# Rack elevation rendering # Rack elevation rendering

View File

@ -3,7 +3,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models from django.db import models
from netaddr import AddrFormatError, EUI, mac_unix_expanded from netaddr import AddrFormatError, EUI, mac_unix_expanded
from .constants import * from ipam.constants import BGP_ASN_MAX, BGP_ASN_MIN
class ASNField(models.BigIntegerField): class ASNField(models.BigIntegerField):
@ -14,7 +14,10 @@ class ASNField(models.BigIntegerField):
] ]
def formfield(self, **kwargs): def formfield(self, **kwargs):
defaults = {'min_value': BGP_ASN_MIN, 'max_value': BGP_ASN_MAX} defaults = {
'min_value': BGP_ASN_MIN,
'max_value': BGP_ASN_MAX,
}
defaults.update(**kwargs) defaults.update(**kwargs)
return super().formfield(**defaults) return super().formfield(**defaults)

View File

@ -16,7 +16,8 @@ from circuits.models import Circuit, Provider
from extras.forms import ( from extras.forms import (
AddRemoveTagsForm, CustomFieldForm, CustomFieldBulkEditForm, CustomFieldFilterForm, LocalConfigContextFilterForm AddRemoveTagsForm, CustomFieldForm, CustomFieldBulkEditForm, CustomFieldFilterForm, LocalConfigContextFilterForm
) )
from ipam.models import IPAddress, VLAN, VLANGroup from ipam.constants import BGP_ASN_MAX, BGP_ASN_MIN
from ipam.models import IPAddress, VLAN
from tenancy.forms import TenancyFilterForm, TenancyForm from tenancy.forms import TenancyFilterForm, TenancyForm
from tenancy.models import Tenant, TenantGroup from tenancy.models import Tenant, TenantGroup
from utilities.forms import ( from utilities.forms import (

View File

@ -1,5 +1,13 @@
from .choices import IPAddressRoleChoices from .choices import IPAddressRoleChoices
# BGP ASN bounds
BGP_ASN_MIN = 1
BGP_ASN_MAX = 2**32 - 1
#
# IP addresses
#
IPADDRESS_ROLES_NONUNIQUE = ( IPADDRESS_ROLES_NONUNIQUE = (
# IPAddress roles which are exempt from unique address enforcement # IPAddress roles which are exempt from unique address enforcement
IPAddressRoleChoices.ROLE_ANYCAST, IPAddressRoleChoices.ROLE_ANYCAST,