diff --git a/netbox/dcim/constants.py b/netbox/dcim/constants.py index 94b879e2c..2a4e2e88e 100644 --- a/netbox/dcim/constants.py +++ b/netbox/dcim/constants.py @@ -1,9 +1,5 @@ from .choices import InterfaceTypeChoices -# BGP ASN bounds -BGP_ASN_MIN = 1 -BGP_ASN_MAX = 2**32 - 1 - # # Rack elevation rendering diff --git a/netbox/dcim/fields.py b/netbox/dcim/fields.py index f2bafc7a8..3acd0d4a1 100644 --- a/netbox/dcim/fields.py +++ b/netbox/dcim/fields.py @@ -3,7 +3,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models 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): @@ -14,7 +14,10 @@ class ASNField(models.BigIntegerField): ] 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) return super().formfield(**defaults) diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 5144cb1c6..599da828a 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -16,7 +16,8 @@ from circuits.models import Circuit, Provider from extras.forms import ( 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.models import Tenant, TenantGroup from utilities.forms import ( diff --git a/netbox/ipam/constants.py b/netbox/ipam/constants.py index 0a42d82dc..cf6eb2a2a 100644 --- a/netbox/ipam/constants.py +++ b/netbox/ipam/constants.py @@ -1,5 +1,13 @@ from .choices import IPAddressRoleChoices +# BGP ASN bounds +BGP_ASN_MIN = 1 +BGP_ASN_MAX = 2**32 - 1 + +# +# IP addresses +# + IPADDRESS_ROLES_NONUNIQUE = ( # IPAddress roles which are exempt from unique address enforcement IPAddressRoleChoices.ROLE_ANYCAST,