constants.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. # Models which support custom fields
  2. CUSTOMFIELD_MODELS = [
  3. 'circuits.circuit',
  4. 'circuits.provider',
  5. 'dcim.device',
  6. 'dcim.devicetype',
  7. 'dcim.powerfeed',
  8. 'dcim.rack',
  9. 'dcim.site',
  10. 'ipam.aggregate',
  11. 'ipam.ipaddress',
  12. 'ipam.prefix',
  13. 'ipam.service',
  14. 'ipam.vlan',
  15. 'ipam.vrf',
  16. 'secrets.secret',
  17. 'tenancy.tenant',
  18. 'virtualization.cluster',
  19. 'virtualization.virtualmachine',
  20. ]
  21. # Custom links
  22. CUSTOMLINK_MODELS = [
  23. 'circuits.circuit',
  24. 'circuits.provider',
  25. 'dcim.cable',
  26. 'dcim.device',
  27. 'dcim.devicetype',
  28. 'dcim.powerpanel',
  29. 'dcim.powerfeed',
  30. 'dcim.rack',
  31. 'dcim.site',
  32. 'ipam.aggregate',
  33. 'ipam.ipaddress',
  34. 'ipam.prefix',
  35. 'ipam.service',
  36. 'ipam.vlan',
  37. 'ipam.vrf',
  38. 'secrets.secret',
  39. 'tenancy.tenant',
  40. 'virtualization.cluster',
  41. 'virtualization.virtualmachine',
  42. ]
  43. # Graph types
  44. GRAPH_TYPE_INTERFACE = 100
  45. GRAPH_TYPE_DEVICE = 150
  46. GRAPH_TYPE_PROVIDER = 200
  47. GRAPH_TYPE_SITE = 300
  48. GRAPH_TYPE_CHOICES = (
  49. (GRAPH_TYPE_INTERFACE, 'Interface'),
  50. (GRAPH_TYPE_DEVICE, 'Device'),
  51. (GRAPH_TYPE_PROVIDER, 'Provider'),
  52. (GRAPH_TYPE_SITE, 'Site'),
  53. )
  54. # Models which support export templates
  55. EXPORTTEMPLATE_MODELS = [
  56. 'circuits.circuit',
  57. 'circuits.provider',
  58. 'dcim.cable',
  59. 'dcim.consoleport',
  60. 'dcim.device',
  61. 'dcim.devicetype',
  62. 'dcim.interface',
  63. 'dcim.inventoryitem',
  64. 'dcim.manufacturer',
  65. 'dcim.powerpanel',
  66. 'dcim.powerport',
  67. 'dcim.powerfeed',
  68. 'dcim.rack',
  69. 'dcim.rackgroup',
  70. 'dcim.region',
  71. 'dcim.site',
  72. 'dcim.virtualchassis',
  73. 'ipam.aggregate',
  74. 'ipam.ipaddress',
  75. 'ipam.prefix',
  76. 'ipam.service',
  77. 'ipam.vlan',
  78. 'ipam.vrf',
  79. 'secrets.secret',
  80. 'tenancy.tenant',
  81. 'virtualization.cluster',
  82. 'virtualization.virtualmachine',
  83. ]
  84. # ExportTemplate language choices
  85. TEMPLATE_LANGUAGE_DJANGO = 10
  86. TEMPLATE_LANGUAGE_JINJA2 = 20
  87. TEMPLATE_LANGUAGE_CHOICES = (
  88. (TEMPLATE_LANGUAGE_DJANGO, 'Django'),
  89. (TEMPLATE_LANGUAGE_JINJA2, 'Jinja2'),
  90. )
  91. # User action types
  92. ACTION_CREATE = 1
  93. ACTION_IMPORT = 2
  94. ACTION_EDIT = 3
  95. ACTION_BULK_EDIT = 4
  96. ACTION_DELETE = 5
  97. ACTION_BULK_DELETE = 6
  98. ACTION_BULK_CREATE = 7
  99. ACTION_CHOICES = (
  100. (ACTION_CREATE, 'created'),
  101. (ACTION_BULK_CREATE, 'bulk created'),
  102. (ACTION_IMPORT, 'imported'),
  103. (ACTION_EDIT, 'modified'),
  104. (ACTION_BULK_EDIT, 'bulk edited'),
  105. (ACTION_DELETE, 'deleted'),
  106. (ACTION_BULK_DELETE, 'bulk deleted'),
  107. )
  108. # Report logging levels
  109. LOG_DEFAULT = 0
  110. LOG_SUCCESS = 10
  111. LOG_INFO = 20
  112. LOG_WARNING = 30
  113. LOG_FAILURE = 40
  114. LOG_LEVEL_CODES = {
  115. LOG_DEFAULT: 'default',
  116. LOG_SUCCESS: 'success',
  117. LOG_INFO: 'info',
  118. LOG_WARNING: 'warning',
  119. LOG_FAILURE: 'failure',
  120. }
  121. # webhook content types
  122. WEBHOOK_CT_JSON = 1
  123. WEBHOOK_CT_X_WWW_FORM_ENCODED = 2
  124. WEBHOOK_CT_CHOICES = (
  125. (WEBHOOK_CT_JSON, 'application/json'),
  126. (WEBHOOK_CT_X_WWW_FORM_ENCODED, 'application/x-www-form-urlencoded'),
  127. )
  128. # Models which support registered webhooks
  129. WEBHOOK_MODELS = [
  130. 'circuits.circuit',
  131. 'circuits.provider',
  132. 'dcim.cable',
  133. 'dcim.consoleport',
  134. 'dcim.consoleserverport',
  135. 'dcim.device',
  136. 'dcim.devicebay',
  137. 'dcim.devicetype',
  138. 'dcim.interface',
  139. 'dcim.inventoryitem',
  140. 'dcim.frontport',
  141. 'dcim.manufacturer',
  142. 'dcim.poweroutlet',
  143. 'dcim.powerpanel',
  144. 'dcim.powerport',
  145. 'dcim.powerfeed',
  146. 'dcim.rack',
  147. 'dcim.rearport',
  148. 'dcim.region',
  149. 'dcim.site',
  150. 'dcim.virtualchassis',
  151. 'ipam.aggregate',
  152. 'ipam.ipaddress',
  153. 'ipam.prefix',
  154. 'ipam.service',
  155. 'ipam.vlan',
  156. 'ipam.vrf',
  157. 'secrets.secret',
  158. 'tenancy.tenant',
  159. 'virtualization.cluster',
  160. 'virtualization.virtualmachine',
  161. ]