constants.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. from django.db.models import Q
  2. from .choices import InterfaceTypeChoices
  3. #
  4. # Racks
  5. #
  6. RACK_U_HEIGHT_DEFAULT = 42
  7. RACK_ELEVATION_LEGEND_WIDTH_DEFAULT = 30
  8. RACK_ELEVATION_UNIT_WIDTH_DEFAULT = 230
  9. RACK_ELEVATION_UNIT_HEIGHT_DEFAULT = 20
  10. #
  11. # RearPorts
  12. #
  13. REARPORT_POSITIONS_MIN = 1
  14. REARPORT_POSITIONS_MAX = 64
  15. #
  16. # Interfaces
  17. #
  18. INTERFACE_MTU_MIN = 1
  19. INTERFACE_MTU_MAX = 32767 # Max value of a signed 16-bit integer
  20. VIRTUAL_IFACE_TYPES = [
  21. InterfaceTypeChoices.TYPE_VIRTUAL,
  22. InterfaceTypeChoices.TYPE_LAG,
  23. ]
  24. WIRELESS_IFACE_TYPES = [
  25. InterfaceTypeChoices.TYPE_80211A,
  26. InterfaceTypeChoices.TYPE_80211G,
  27. InterfaceTypeChoices.TYPE_80211N,
  28. InterfaceTypeChoices.TYPE_80211AC,
  29. InterfaceTypeChoices.TYPE_80211AD,
  30. ]
  31. NONCONNECTABLE_IFACE_TYPES = VIRTUAL_IFACE_TYPES + WIRELESS_IFACE_TYPES
  32. #
  33. # PowerFeeds
  34. #
  35. POWERFEED_VOLTAGE_DEFAULT = 120
  36. POWERFEED_AMPERAGE_DEFAULT = 20
  37. POWERFEED_MAX_UTILIZATION_DEFAULT = 80 # Percentage
  38. #
  39. # Cabling and connections
  40. #
  41. # TODO: Replace with CableStatusChoices?
  42. # Console/power/interface connection statuses
  43. CONNECTION_STATUS_PLANNED = False
  44. CONNECTION_STATUS_CONNECTED = True
  45. CONNECTION_STATUS_CHOICES = [
  46. [CONNECTION_STATUS_PLANNED, 'Planned'],
  47. [CONNECTION_STATUS_CONNECTED, 'Connected'],
  48. ]
  49. # Cable endpoint types
  50. CABLE_TERMINATION_MODELS = Q(
  51. Q(app_label='circuits', model__in=(
  52. 'circuittermination',
  53. )) |
  54. Q(app_label='dcim', model__in=(
  55. 'consoleport',
  56. 'consoleserverport',
  57. 'frontport',
  58. 'interface',
  59. 'powerfeed',
  60. 'poweroutlet',
  61. 'powerport',
  62. 'rearport',
  63. ))
  64. )
  65. COMPATIBLE_TERMINATION_TYPES = {
  66. 'consoleport': ['consoleserverport', 'frontport', 'rearport'],
  67. 'consoleserverport': ['consoleport', 'frontport', 'rearport'],
  68. 'powerport': ['poweroutlet', 'powerfeed'],
  69. 'poweroutlet': ['powerport'],
  70. 'interface': ['interface', 'circuittermination', 'frontport', 'rearport'],
  71. 'frontport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
  72. 'rearport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
  73. 'circuittermination': ['interface', 'frontport', 'rearport'],
  74. }