Просмотр исходного кода

Add explanatory text for constants

Jeremy Stretch 6 лет назад
Родитель
Сommit
c6473d654d
2 измененных файлов с 10 добавлено и 1 удалено
  1. 3 1
      netbox/dcim/constants.py
  2. 7 0
      netbox/ipam/constants.py

+ 3 - 1
netbox/dcim/constants.py

@@ -26,7 +26,7 @@ REARPORT_POSITIONS_MAX = 64
 #
 
 INTERFACE_MTU_MIN = 1
-INTERFACE_MTU_MAX = 32767
+INTERFACE_MTU_MAX = 32767  # Max value of a signed 16-bit integer
 
 VIRTUAL_IFACE_TYPES = [
     InterfaceTypeChoices.TYPE_VIRTUAL,
@@ -49,7 +49,9 @@ NONCONNECTABLE_IFACE_TYPES = VIRTUAL_IFACE_TYPES + WIRELESS_IFACE_TYPES
 #
 
 POWERFEED_VOLTAGE_DEFAULT = 120
+
 POWERFEED_AMPERAGE_DEFAULT = 20
+
 POWERFEED_MAX_UTILIZATION_DEFAULT = 80  # Percentage
 
 

+ 7 - 0
netbox/ipam/constants.py

@@ -9,6 +9,11 @@ BGP_ASN_MAX = 2**32 - 1
 # VRFs
 #
 
+# Per RFC 4364 section 4.2, a route distinguisher may be encoded as one of the following:
+#   * Type 0 (16-bit AS number : 32-bit integer)
+#   * Type 1 (32-bit IPv4 address : 16-bit integer)
+#   * Type 2 (32-bit AS number : 16-bit integer)
+# 21 characters are sufficient to convey the longest possible string value (255.255.255.255:65535)
 VRF_RD_MAX_LENGTH = 21
 
 
@@ -42,6 +47,7 @@ IPADDRESS_ROLES_NONUNIQUE = (
 # VLANs
 #
 
+# 12-bit VLAN ID (values 0 and 4095 are reserved)
 VLAN_VID_MIN = 1
 VLAN_VID_MAX = 4094
 
@@ -50,5 +56,6 @@ VLAN_VID_MAX = 4094
 # Services
 #
 
+# 16-bit port number
 SERVICE_PORT_MIN = 1
 SERVICE_PORT_MAX = 65535