constants.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. from .choices import IPAddressRoleChoices
  2. # BGP ASN bounds
  3. BGP_ASN_MIN = 1
  4. BGP_ASN_MAX = 2**32 - 1
  5. #
  6. # VRFs
  7. #
  8. # Per RFC 4364 section 4.2, a route distinguisher may be encoded as one of the following:
  9. # * Type 0 (16-bit AS number : 32-bit integer)
  10. # * Type 1 (32-bit IPv4 address : 16-bit integer)
  11. # * Type 2 (32-bit AS number : 16-bit integer)
  12. # 21 characters are sufficient to convey the longest possible string value (255.255.255.255:65535)
  13. VRF_RD_MAX_LENGTH = 21
  14. #
  15. # Prefixes
  16. #
  17. PREFIX_LENGTH_MIN = 1
  18. PREFIX_LENGTH_MAX = 127 # IPv6
  19. #
  20. # IPAddresses
  21. #
  22. IPADDRESS_MASK_LENGTH_MIN = 1
  23. IPADDRESS_MASK_LENGTH_MAX = 128 # IPv6
  24. IPADDRESS_ROLES_NONUNIQUE = (
  25. # IPAddress roles which are exempt from unique address enforcement
  26. IPAddressRoleChoices.ROLE_ANYCAST,
  27. IPAddressRoleChoices.ROLE_VIP,
  28. IPAddressRoleChoices.ROLE_VRRP,
  29. IPAddressRoleChoices.ROLE_HSRP,
  30. IPAddressRoleChoices.ROLE_GLBP,
  31. IPAddressRoleChoices.ROLE_CARP,
  32. )
  33. #
  34. # VLANs
  35. #
  36. # 12-bit VLAN ID (values 0 and 4095 are reserved)
  37. VLAN_VID_MIN = 1
  38. VLAN_VID_MAX = 4094
  39. #
  40. # Services
  41. #
  42. # 16-bit port number
  43. SERVICE_PORT_MIN = 1
  44. SERVICE_PORT_MAX = 65535