constants.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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_BORDER_WIDTH = 2
  8. RACK_ELEVATION_LEGEND_WIDTH_DEFAULT = 30
  9. #
  10. # RearPorts
  11. #
  12. REARPORT_POSITIONS_MIN = 1
  13. REARPORT_POSITIONS_MAX = 1024
  14. #
  15. # Interfaces
  16. #
  17. INTERFACE_MTU_MIN = 1
  18. INTERFACE_MTU_MAX = 32767 # Max value of a signed 16-bit integer
  19. VIRTUAL_IFACE_TYPES = [
  20. InterfaceTypeChoices.TYPE_VIRTUAL,
  21. InterfaceTypeChoices.TYPE_LAG,
  22. ]
  23. WIRELESS_IFACE_TYPES = [
  24. InterfaceTypeChoices.TYPE_80211A,
  25. InterfaceTypeChoices.TYPE_80211G,
  26. InterfaceTypeChoices.TYPE_80211N,
  27. InterfaceTypeChoices.TYPE_80211AC,
  28. InterfaceTypeChoices.TYPE_80211AD,
  29. ]
  30. NONCONNECTABLE_IFACE_TYPES = VIRTUAL_IFACE_TYPES + WIRELESS_IFACE_TYPES
  31. #
  32. # PowerFeeds
  33. #
  34. POWERFEED_VOLTAGE_DEFAULT = 120
  35. POWERFEED_AMPERAGE_DEFAULT = 20
  36. POWERFEED_MAX_UTILIZATION_DEFAULT = 80 # Percentage
  37. #
  38. # Cabling and connections
  39. #
  40. # Cable endpoint types
  41. CABLE_TERMINATION_MODELS = Q(
  42. Q(app_label='circuits', model__in=(
  43. 'circuittermination',
  44. )) |
  45. Q(app_label='dcim', model__in=(
  46. 'consoleport',
  47. 'consoleserverport',
  48. 'frontport',
  49. 'interface',
  50. 'powerfeed',
  51. 'poweroutlet',
  52. 'powerport',
  53. 'rearport',
  54. ))
  55. )
  56. COMPATIBLE_TERMINATION_TYPES = {
  57. 'circuittermination': ['interface', 'frontport', 'rearport', 'circuittermination'],
  58. 'consoleport': ['consoleserverport', 'frontport', 'rearport'],
  59. 'consoleserverport': ['consoleport', 'frontport', 'rearport'],
  60. 'interface': ['interface', 'circuittermination', 'frontport', 'rearport'],
  61. 'frontport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
  62. 'powerfeed': ['powerport'],
  63. 'poweroutlet': ['powerport'],
  64. 'powerport': ['poweroutlet', 'powerfeed'],
  65. 'rearport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
  66. }