|
@@ -6,6 +6,7 @@ from django.core.validators import MaxValueValidator, MinValueValidator
|
|
|
from django.db import models
|
|
from django.db import models
|
|
|
|
|
|
|
|
from dcim.models import Interface
|
|
from dcim.models import Interface
|
|
|
|
|
+from utilities.models import CreatedUpdatedModel
|
|
|
|
|
|
|
|
from .fields import IPNetworkField, IPAddressField
|
|
from .fields import IPNetworkField, IPAddressField
|
|
|
|
|
|
|
@@ -36,7 +37,7 @@ STATUS_CHOICE_CLASSES = {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-class VRF(models.Model):
|
|
|
|
|
|
|
+class VRF(CreatedUpdatedModel):
|
|
|
"""
|
|
"""
|
|
|
A virtual routing and forwarding (VRF) table represents a discrete layer three forwarding domain (e.g. a routing
|
|
A virtual routing and forwarding (VRF) table represents a discrete layer three forwarding domain (e.g. a routing
|
|
|
table). Prefixes and IPAddresses can optionally be assigned to VRFs. (Prefixes and IPAddresses not assigned to a VRF
|
|
table). Prefixes and IPAddresses can optionally be assigned to VRFs. (Prefixes and IPAddresses not assigned to a VRF
|
|
@@ -85,7 +86,7 @@ class RIR(models.Model):
|
|
|
return "{}?rir={}".format(reverse('ipam:aggregate_list'), self.slug)
|
|
return "{}?rir={}".format(reverse('ipam:aggregate_list'), self.slug)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class Aggregate(models.Model):
|
|
|
|
|
|
|
+class Aggregate(CreatedUpdatedModel):
|
|
|
"""
|
|
"""
|
|
|
An aggregate exists at the root level of the IP address space hierarchy in NetBox. Aggregates are used to organize
|
|
An aggregate exists at the root level of the IP address space hierarchy in NetBox. Aggregates are used to organize
|
|
|
the hierarchy and track the overall utilization of available address space. Each Aggregate is assigned to a RIR.
|
|
the hierarchy and track the overall utilization of available address space. Each Aggregate is assigned to a RIR.
|
|
@@ -206,7 +207,7 @@ class PrefixQuerySet(models.QuerySet):
|
|
|
return filter(lambda p: p.depth <= limit, queryset)
|
|
return filter(lambda p: p.depth <= limit, queryset)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class Prefix(models.Model):
|
|
|
|
|
|
|
+class Prefix(CreatedUpdatedModel):
|
|
|
"""
|
|
"""
|
|
|
A Prefix represents an IPv4 or IPv6 network, including mask length. Prefixes can optionally be assigned to Sites and
|
|
A Prefix represents an IPv4 or IPv6 network, including mask length. Prefixes can optionally be assigned to Sites and
|
|
|
VRFs. A Prefix must be assigned a status and may optionally be assigned a used-define Role. A Prefix can also be
|
|
VRFs. A Prefix must be assigned a status and may optionally be assigned a used-define Role. A Prefix can also be
|
|
@@ -268,7 +269,7 @@ class Prefix(models.Model):
|
|
|
return STATUS_CHOICE_CLASSES[self.status]
|
|
return STATUS_CHOICE_CLASSES[self.status]
|
|
|
|
|
|
|
|
|
|
|
|
|
-class IPAddress(models.Model):
|
|
|
|
|
|
|
+class IPAddress(CreatedUpdatedModel):
|
|
|
"""
|
|
"""
|
|
|
An IPAddress represents an individual IPV4 or IPv6 address and its mask. The mask length should match what is
|
|
An IPAddress represents an individual IPV4 or IPv6 address and its mask. The mask length should match what is
|
|
|
configured in the real world. (Typically, only loopback interfaces are configured with /32 or /128 masks.) Like
|
|
configured in the real world. (Typically, only loopback interfaces are configured with /32 or /128 masks.) Like
|
|
@@ -323,7 +324,7 @@ class IPAddress(models.Model):
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
-class VLAN(models.Model):
|
|
|
|
|
|
|
+class VLAN(CreatedUpdatedModel):
|
|
|
"""
|
|
"""
|
|
|
A VLAN is a distinct layer two forwarding domain identified by a 12-bit integer (1-4094). Each VLAN must be assigned
|
|
A VLAN is a distinct layer two forwarding domain identified by a 12-bit integer (1-4094). Each VLAN must be assigned
|
|
|
to a Site, however VLAN IDs need not be unique within a Site. Like Prefixes, each VLAN is assigned an operational
|
|
to a Site, however VLAN IDs need not be unique within a Site. Like Prefixes, each VLAN is assigned an operational
|