search.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. from . import models
  2. from netbox.search import SearchIndex, register_search
  3. @register_search
  4. class AggregateIndex(SearchIndex):
  5. model = models.Aggregate
  6. fields = (
  7. ('prefix', 120),
  8. ('description', 500),
  9. ('date_added', 2000),
  10. ('comments', 5000),
  11. )
  12. @register_search
  13. class ASNIndex(SearchIndex):
  14. model = models.ASN
  15. fields = (
  16. ('asn', 100),
  17. ('description', 500),
  18. )
  19. @register_search
  20. class ASNRangeIndex(SearchIndex):
  21. model = models.ASNRange
  22. fields = (
  23. ('description', 500),
  24. )
  25. @register_search
  26. class FHRPGroupIndex(SearchIndex):
  27. model = models.FHRPGroup
  28. fields = (
  29. ('name', 100),
  30. ('group_id', 2000),
  31. ('description', 500),
  32. ('comments', 5000),
  33. )
  34. @register_search
  35. class IPAddressIndex(SearchIndex):
  36. model = models.IPAddress
  37. fields = (
  38. ('address', 100),
  39. ('dns_name', 300),
  40. ('description', 500),
  41. ('comments', 5000),
  42. )
  43. @register_search
  44. class IPRangeIndex(SearchIndex):
  45. model = models.IPRange
  46. fields = (
  47. ('start_address', 100),
  48. ('end_address', 300),
  49. ('description', 500),
  50. ('comments', 5000),
  51. )
  52. @register_search
  53. class L2VPNIndex(SearchIndex):
  54. model = models.L2VPN
  55. fields = (
  56. ('name', 100),
  57. ('slug', 110),
  58. ('description', 500),
  59. ('comments', 5000),
  60. )
  61. @register_search
  62. class PrefixIndex(SearchIndex):
  63. model = models.Prefix
  64. fields = (
  65. ('prefix', 110),
  66. ('description', 500),
  67. ('comments', 5000),
  68. )
  69. @register_search
  70. class RIRIndex(SearchIndex):
  71. model = models.RIR
  72. fields = (
  73. ('name', 100),
  74. ('slug', 110),
  75. ('description', 500),
  76. )
  77. @register_search
  78. class RoleIndex(SearchIndex):
  79. model = models.Role
  80. fields = (
  81. ('name', 100),
  82. ('slug', 110),
  83. ('description', 500),
  84. )
  85. @register_search
  86. class RouteTargetIndex(SearchIndex):
  87. model = models.RouteTarget
  88. fields = (
  89. ('name', 100),
  90. ('description', 500),
  91. ('comments', 5000),
  92. )
  93. @register_search
  94. class ServiceIndex(SearchIndex):
  95. model = models.Service
  96. fields = (
  97. ('name', 100),
  98. ('description', 500),
  99. ('comments', 5000),
  100. )
  101. @register_search
  102. class ServiceTemplateIndex(SearchIndex):
  103. model = models.ServiceTemplate
  104. fields = (
  105. ('name', 100),
  106. ('description', 500),
  107. ('comments', 5000),
  108. )
  109. @register_search
  110. class VLANIndex(SearchIndex):
  111. model = models.VLAN
  112. fields = (
  113. ('name', 100),
  114. ('vid', 100),
  115. ('description', 500),
  116. ('comments', 5000),
  117. )
  118. @register_search
  119. class VLANGroupIndex(SearchIndex):
  120. model = models.VLANGroup
  121. fields = (
  122. ('name', 100),
  123. ('slug', 110),
  124. ('description', 500),
  125. ('max_vid', 2000),
  126. )
  127. @register_search
  128. class VRFIndex(SearchIndex):
  129. model = models.VRF
  130. fields = (
  131. ('name', 100),
  132. ('rd', 200),
  133. ('description', 500),
  134. ('comments', 5000),
  135. )