constants.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. from .choices import InterfaceTypeChoices
  2. #
  3. # Interface type groups
  4. #
  5. VIRTUAL_IFACE_TYPES = [
  6. InterfaceTypeChoices.TYPE_VIRTUAL,
  7. InterfaceTypeChoices.TYPE_LAG,
  8. ]
  9. WIRELESS_IFACE_TYPES = [
  10. InterfaceTypeChoices.TYPE_80211A,
  11. InterfaceTypeChoices.TYPE_80211G,
  12. InterfaceTypeChoices.TYPE_80211N,
  13. InterfaceTypeChoices.TYPE_80211AC,
  14. InterfaceTypeChoices.TYPE_80211AD,
  15. ]
  16. NONCONNECTABLE_IFACE_TYPES = VIRTUAL_IFACE_TYPES + WIRELESS_IFACE_TYPES
  17. # Bootstrap CSS classes for device/rack statuses
  18. STATUS_CLASSES = {
  19. 0: 'warning',
  20. 1: 'success',
  21. 2: 'info',
  22. 3: 'primary',
  23. 4: 'danger',
  24. 5: 'default',
  25. 6: 'warning',
  26. }
  27. # Console/power/interface connection statuses
  28. CONNECTION_STATUS_PLANNED = False
  29. CONNECTION_STATUS_CONNECTED = True
  30. CONNECTION_STATUS_CHOICES = [
  31. [CONNECTION_STATUS_PLANNED, 'Planned'],
  32. [CONNECTION_STATUS_CONNECTED, 'Connected'],
  33. ]
  34. # Cable endpoint types
  35. CABLE_TERMINATION_TYPES = [
  36. 'consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport',
  37. 'circuittermination',
  38. ]
  39. CABLE_TERMINATION_TYPE_CHOICES = {
  40. # (API endpoint, human-friendly name)
  41. 'consoleport': ('console-ports', 'Console port'),
  42. 'consoleserverport': ('console-server-ports', 'Console server port'),
  43. 'powerport': ('power-ports', 'Power port'),
  44. 'poweroutlet': ('power-outlets', 'Power outlet'),
  45. 'interface': ('interfaces', 'Interface'),
  46. 'frontport': ('front-ports', 'Front panel port'),
  47. 'rearport': ('rear-ports', 'Rear panel port'),
  48. }
  49. COMPATIBLE_TERMINATION_TYPES = {
  50. 'consoleport': ['consoleserverport', 'frontport', 'rearport'],
  51. 'consoleserverport': ['consoleport', 'frontport', 'rearport'],
  52. 'powerport': ['poweroutlet', 'powerfeed'],
  53. 'poweroutlet': ['powerport'],
  54. 'interface': ['interface', 'circuittermination', 'frontport', 'rearport'],
  55. 'frontport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
  56. 'rearport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
  57. 'circuittermination': ['interface', 'frontport', 'rearport'],
  58. }
  59. # Power feeds
  60. POWERFEED_SUPPLY_AC = 1
  61. POWERFEED_SUPPLY_DC = 2
  62. POWERFEED_SUPPLY_CHOICES = (
  63. (POWERFEED_SUPPLY_AC, 'AC'),
  64. (POWERFEED_SUPPLY_DC, 'DC'),
  65. )
  66. POWERFEED_PHASE_SINGLE = 1
  67. POWERFEED_PHASE_3PHASE = 3
  68. POWERFEED_PHASE_CHOICES = (
  69. (POWERFEED_PHASE_SINGLE, 'Single phase'),
  70. (POWERFEED_PHASE_3PHASE, 'Three-phase'),
  71. )
  72. POWERFEED_STATUS_OFFLINE = 0
  73. POWERFEED_STATUS_ACTIVE = 1
  74. POWERFEED_STATUS_PLANNED = 2
  75. POWERFEED_STATUS_FAILED = 4
  76. POWERFEED_STATUS_CHOICES = (
  77. (POWERFEED_STATUS_ACTIVE, 'Active'),
  78. (POWERFEED_STATUS_OFFLINE, 'Offline'),
  79. (POWERFEED_STATUS_PLANNED, 'Planned'),
  80. (POWERFEED_STATUS_FAILED, 'Failed'),
  81. )
  82. POWERFEED_LEG_A = 1
  83. POWERFEED_LEG_B = 2
  84. POWERFEED_LEG_C = 3
  85. POWERFEED_LEG_CHOICES = (
  86. (POWERFEED_LEG_A, 'A'),
  87. (POWERFEED_LEG_B, 'B'),
  88. (POWERFEED_LEG_C, 'C'),
  89. )