2022-10-10 11:00:59 -07:00
|
|
|
from netbox.search import SearchIndex, register_search
|
2023-11-28 13:45:00 -05:00
|
|
|
from . import models
|
2022-10-10 11:00:59 -07:00
|
|
|
|
|
|
|
|
2022-10-21 13:16:16 -04:00
|
|
|
@register_search
|
|
|
|
class AggregateIndex(SearchIndex):
|
|
|
|
model = models.Aggregate
|
|
|
|
fields = (
|
2023-02-18 19:30:29 +01:00
|
|
|
('prefix', 120),
|
2022-10-21 13:16:16 -04:00
|
|
|
('description', 500),
|
|
|
|
('date_added', 2000),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('rir', 'tenant', 'description')
|
2022-10-10 11:00:59 -07:00
|
|
|
|
|
|
|
|
2022-10-21 13:16:16 -04:00
|
|
|
@register_search
|
|
|
|
class ASNIndex(SearchIndex):
|
|
|
|
model = models.ASN
|
|
|
|
fields = (
|
|
|
|
('asn', 100),
|
|
|
|
('description', 500),
|
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('rir', 'tenant', 'description')
|
2022-10-10 11:00:59 -07:00
|
|
|
|
|
|
|
|
2023-02-27 16:36:05 -05:00
|
|
|
@register_search
|
|
|
|
class ASNRangeIndex(SearchIndex):
|
|
|
|
model = models.ASNRange
|
|
|
|
fields = (
|
|
|
|
('description', 500),
|
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('rir', 'tenant', 'description')
|
2023-02-27 16:36:05 -05:00
|
|
|
|
|
|
|
|
2022-10-21 13:16:16 -04:00
|
|
|
@register_search
|
|
|
|
class FHRPGroupIndex(SearchIndex):
|
|
|
|
model = models.FHRPGroup
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('group_id', 2000),
|
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-10 11:00:59 -07:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('protocol', 'auth_type', 'description')
|
2022-10-10 11:00:59 -07:00
|
|
|
|
|
|
|
|
2022-10-21 13:16:16 -04:00
|
|
|
@register_search
|
2022-10-10 11:00:59 -07:00
|
|
|
class IPAddressIndex(SearchIndex):
|
2022-10-21 13:16:16 -04:00
|
|
|
model = models.IPAddress
|
|
|
|
fields = (
|
|
|
|
('address', 100),
|
|
|
|
('dns_name', 300),
|
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('vrf', 'tenant', 'status', 'role', 'description')
|
2022-10-10 11:00:59 -07:00
|
|
|
|
|
|
|
|
2022-10-21 13:16:16 -04:00
|
|
|
@register_search
|
|
|
|
class IPRangeIndex(SearchIndex):
|
|
|
|
model = models.IPRange
|
|
|
|
fields = (
|
|
|
|
('start_address', 100),
|
|
|
|
('end_address', 300),
|
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('vrf', 'tenant', 'status', 'role', 'description')
|
2022-10-10 11:00:59 -07:00
|
|
|
|
|
|
|
|
2022-10-21 13:16:16 -04:00
|
|
|
@register_search
|
|
|
|
class PrefixIndex(SearchIndex):
|
|
|
|
model = models.Prefix
|
|
|
|
fields = (
|
2023-02-18 19:30:29 +01:00
|
|
|
('prefix', 110),
|
2022-10-21 13:16:16 -04:00
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('site', 'vrf', 'tenant', 'vlan', 'status', 'role', 'description')
|
2022-10-21 13:16:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
@register_search
|
|
|
|
class RIRIndex(SearchIndex):
|
|
|
|
model = models.RIR
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('slug', 110),
|
|
|
|
('description', 500),
|
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('description',)
|
2022-10-10 11:00:59 -07:00
|
|
|
|
|
|
|
|
2022-10-21 13:16:16 -04:00
|
|
|
@register_search
|
|
|
|
class RoleIndex(SearchIndex):
|
|
|
|
model = models.Role
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('slug', 110),
|
|
|
|
('description', 500),
|
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('description',)
|
2022-10-21 13:16:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
@register_search
|
|
|
|
class RouteTargetIndex(SearchIndex):
|
|
|
|
model = models.RouteTarget
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('tenant', 'description')
|
2022-10-21 13:16:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
@register_search
|
2022-10-10 11:00:59 -07:00
|
|
|
class ServiceIndex(SearchIndex):
|
2022-10-21 13:16:16 -04:00
|
|
|
model = models.Service
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('device', 'virtual_machine', 'description')
|
2022-11-15 10:37:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
@register_search
|
|
|
|
class ServiceTemplateIndex(SearchIndex):
|
|
|
|
model = models.ServiceTemplate
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('description', 500),
|
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('description',)
|
2022-10-21 13:16:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
@register_search
|
|
|
|
class VLANIndex(SearchIndex):
|
|
|
|
model = models.VLAN
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('vid', 100),
|
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('site', 'group', 'tenant', 'status', 'role', 'description')
|
2022-10-21 13:16:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
@register_search
|
|
|
|
class VLANGroupIndex(SearchIndex):
|
|
|
|
model = models.VLANGroup
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('slug', 110),
|
|
|
|
('description', 500),
|
|
|
|
('max_vid', 2000),
|
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('scope_type', 'min_vid', 'max_vid', 'description')
|
2022-10-21 13:16:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
@register_search
|
|
|
|
class VRFIndex(SearchIndex):
|
|
|
|
model = models.VRF
|
|
|
|
fields = (
|
|
|
|
('name', 100),
|
|
|
|
('rd', 200),
|
|
|
|
('description', 500),
|
2022-11-15 10:37:35 -05:00
|
|
|
('comments', 5000),
|
2022-10-21 13:16:16 -04:00
|
|
|
)
|
2023-11-09 16:21:09 -05:00
|
|
|
display_attrs = ('rd', 'tenant', 'description')
|