| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 |
- from netbox.search import SearchIndex, register_search
- from . import models
- @register_search
- class CableIndex(SearchIndex):
- model = models.Cable
- fields = (
- ('label', 100),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('type', 'status', 'tenant', 'label', 'description')
- @register_search
- class ConsolePortIndex(SearchIndex):
- model = models.ConsolePort
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- ('speed', 2000),
- )
- display_attrs = ('device', 'label', 'type', 'description')
- @register_search
- class ConsoleServerPortIndex(SearchIndex):
- model = models.ConsoleServerPort
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- ('speed', 2000),
- )
- display_attrs = ('device', 'label', 'type', 'description')
- @register_search
- class DeviceIndex(SearchIndex):
- model = models.Device
- fields = (
- ('asset_tag', 50),
- ('serial', 60),
- ('name', 100),
- ('virtual_chassis', 200),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = (
- 'site', 'location', 'rack', 'status', 'device_type', 'role', 'tenant', 'platform', 'serial', 'asset_tag',
- 'description',
- )
- @register_search
- class DeviceBayIndex(SearchIndex):
- model = models.DeviceBay
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- )
- display_attrs = ('device', 'label', 'description')
- @register_search
- class DeviceRoleIndex(SearchIndex):
- model = models.DeviceRole
- fields = (
- ('name', 100),
- ('slug', 110),
- ('description', 500),
- )
- display_attrs = ('description',)
- @register_search
- class DeviceTypeIndex(SearchIndex):
- model = models.DeviceType
- fields = (
- ('model', 100),
- ('part_number', 200),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('manufacturer', 'part_number', 'description')
- @register_search
- class FrontPortIndex(SearchIndex):
- model = models.FrontPort
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- )
- display_attrs = ('device', 'label', 'type', 'description')
- @register_search
- class MACAddressIndex(SearchIndex):
- model = models.MACAddress
- fields = (
- ('mac_address', 100),
- ('description', 500),
- )
- display_attrs = ('assigned_object', 'description')
- @register_search
- class InterfaceIndex(SearchIndex):
- model = models.Interface
- fields = (
- ('name', 100),
- ('label', 200),
- ('wwn', 300),
- ('description', 500),
- ('mtu', 2000),
- ('speed', 2000),
- )
- display_attrs = ('device', 'label', 'type', 'wwn', 'description')
- @register_search
- class InventoryItemIndex(SearchIndex):
- model = models.InventoryItem
- fields = (
- ('asset_tag', 50),
- ('serial', 60),
- ('name', 100),
- ('label', 200),
- ('description', 500),
- ('part_id', 2000),
- )
- display_attrs = ('device', 'manufacturer', 'parent', 'part_id', 'serial', 'asset_tag', 'description')
- @register_search
- class LocationIndex(SearchIndex):
- model = models.Location
- fields = (
- ('name', 100),
- ('facility', 100),
- ('slug', 110),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('site', 'status', 'tenant', 'facility', 'description')
- @register_search
- class ManufacturerIndex(SearchIndex):
- model = models.Manufacturer
- fields = (
- ('name', 100),
- ('slug', 110),
- ('description', 500),
- )
- display_attrs = ('description',)
- @register_search
- class ModuleIndex(SearchIndex):
- model = models.Module
- fields = (
- ('asset_tag', 50),
- ('serial', 60),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('device', 'module_bay', 'module_type', 'status', 'serial', 'asset_tag', 'description')
- @register_search
- class ModuleBayIndex(SearchIndex):
- model = models.ModuleBay
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- )
- display_attrs = ('device', 'label', 'position', 'description')
- @register_search
- class ModuleTypeProfileIndex(SearchIndex):
- model = models.ModuleTypeProfile
- fields = (
- ('name', 100),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('name', 'description')
- @register_search
- class ModuleTypeIndex(SearchIndex):
- model = models.ModuleType
- fields = (
- ('model', 100),
- ('part_number', 200),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('manufacturer', 'model', 'part_number', 'description')
- @register_search
- class PlatformIndex(SearchIndex):
- model = models.Platform
- fields = (
- ('name', 100),
- ('slug', 110),
- ('description', 500),
- )
- display_attrs = ('manufacturer', 'description')
- @register_search
- class PowerFeedIndex(SearchIndex):
- model = models.PowerFeed
- fields = (
- ('name', 100),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('power_panel', 'rack', 'status', 'description')
- @register_search
- class PowerOutletIndex(SearchIndex):
- model = models.PowerOutlet
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- )
- display_attrs = ('device', 'label', 'type', 'status', 'description')
- @register_search
- class PowerPanelIndex(SearchIndex):
- model = models.PowerPanel
- fields = (
- ('name', 100),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('site', 'location', 'description')
- @register_search
- class PowerPortIndex(SearchIndex):
- model = models.PowerPort
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- ('maximum_draw', 2000),
- ('allocated_draw', 2000),
- )
- display_attrs = ('device', 'label', 'type', 'description')
- @register_search
- class RackTypeIndex(SearchIndex):
- model = models.RackType
- fields = (
- ('model', 100),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('model', 'description')
- @register_search
- class RackIndex(SearchIndex):
- model = models.Rack
- fields = (
- ('asset_tag', 50),
- ('serial', 60),
- ('name', 100),
- ('facility_id', 200),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = (
- 'site', 'location', 'facility_id', 'tenant', 'status', 'role', 'serial', 'asset_tag', 'description',
- )
- @register_search
- class RackReservationIndex(SearchIndex):
- model = models.RackReservation
- fields = (
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('rack', 'tenant', 'user', 'description')
- @register_search
- class RackRoleIndex(SearchIndex):
- model = models.RackRole
- fields = (
- ('name', 100),
- ('slug', 110),
- ('description', 500),
- )
- display_attrs = ('description',)
- @register_search
- class RearPortIndex(SearchIndex):
- model = models.RearPort
- fields = (
- ('name', 100),
- ('label', 200),
- ('description', 500),
- )
- display_attrs = ('device', 'label', 'type', 'description')
- @register_search
- class RegionIndex(SearchIndex):
- model = models.Region
- fields = (
- ('name', 100),
- ('slug', 110),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('parent', 'description')
- @register_search
- class SiteIndex(SearchIndex):
- model = models.Site
- fields = (
- ('name', 100),
- ('facility', 100),
- ('slug', 110),
- ('description', 500),
- ('physical_address', 2000),
- ('shipping_address', 2000),
- ('comments', 5000),
- )
- display_attrs = ('region', 'group', 'status', 'tenant', 'facility', 'description')
- @register_search
- class SiteGroupIndex(SearchIndex):
- model = models.SiteGroup
- fields = (
- ('name', 100),
- ('slug', 110),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('parent', 'description')
- @register_search
- class VirtualChassisIndex(SearchIndex):
- model = models.VirtualChassis
- fields = (
- ('name', 100),
- ('domain', 300),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('master', 'domain', 'description')
- @register_search
- class VirtualDeviceContextIndex(SearchIndex):
- model = models.VirtualDeviceContext
- fields = (
- ('name', 100),
- ('identifier', 300),
- ('description', 500),
- ('comments', 5000),
- )
- display_attrs = ('device', 'status', 'identifier', 'tenant', 'description')
|