|
@@ -18,11 +18,12 @@ from tenancy.models import *
|
|
|
from utilities.choices import ColorChoices
|
|
from utilities.choices import ColorChoices
|
|
|
from utilities.filters import (
|
|
from utilities.filters import (
|
|
|
ContentTypeFilter, MultiValueCharFilter, MultiValueMACAddressFilter, MultiValueNumberFilter, MultiValueWWNFilter,
|
|
ContentTypeFilter, MultiValueCharFilter, MultiValueMACAddressFilter, MultiValueNumberFilter, MultiValueWWNFilter,
|
|
|
- TreeNodeMultipleChoiceFilter,
|
|
|
|
|
|
|
+ NumericArrayFilter, TreeNodeMultipleChoiceFilter,
|
|
|
)
|
|
)
|
|
|
from virtualization.models import Cluster
|
|
from virtualization.models import Cluster
|
|
|
from vpn.models import L2VPN
|
|
from vpn.models import L2VPN
|
|
|
from wireless.choices import WirelessRoleChoices, WirelessChannelChoices
|
|
from wireless.choices import WirelessRoleChoices, WirelessChannelChoices
|
|
|
|
|
+from wireless.models import WirelessLAN, WirelessLink
|
|
|
from .choices import *
|
|
from .choices import *
|
|
|
from .constants import *
|
|
from .constants import *
|
|
|
from .models import *
|
|
from .models import *
|
|
@@ -105,7 +106,7 @@ class RegionFilterSet(OrganizationalModelFilterSet, ContactModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Region
|
|
model = Region
|
|
|
- fields = ['id', 'name', 'slug', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class SiteGroupFilterSet(OrganizationalModelFilterSet, ContactModelFilterSet):
|
|
class SiteGroupFilterSet(OrganizationalModelFilterSet, ContactModelFilterSet):
|
|
@@ -135,7 +136,7 @@ class SiteGroupFilterSet(OrganizationalModelFilterSet, ContactModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = SiteGroup
|
|
model = SiteGroup
|
|
|
- fields = ['id', 'name', 'slug', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class SiteFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
|
class SiteFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
|
@@ -178,12 +179,11 @@ class SiteFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
|
|
|
queryset=ASN.objects.all(),
|
|
queryset=ASN.objects.all(),
|
|
|
label=_('AS (ID)'),
|
|
label=_('AS (ID)'),
|
|
|
)
|
|
)
|
|
|
|
|
+ time_zone = MultiValueCharFilter()
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Site
|
|
model = Site
|
|
|
- fields = (
|
|
|
|
|
- 'id', 'name', 'slug', 'facility', 'latitude', 'longitude', 'description'
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'facility', 'latitude', 'longitude', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -270,7 +270,7 @@ class LocationFilterSet(TenancyFilterSet, ContactModelFilterSet, OrganizationalM
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Location
|
|
model = Location
|
|
|
- fields = ['id', 'name', 'slug', 'status', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'status', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -285,7 +285,7 @@ class RackRoleFilterSet(OrganizationalModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = RackRole
|
|
model = RackRole
|
|
|
- fields = ['id', 'name', 'slug', 'color', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'color', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
|
class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
|
@@ -364,10 +364,10 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Rack
|
|
model = Rack
|
|
|
- fields = [
|
|
|
|
|
|
|
+ fields = (
|
|
|
'id', 'name', 'facility_id', 'asset_tag', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
|
|
'id', 'name', 'facility_id', 'asset_tag', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
|
|
|
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
|
|
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
|
|
|
- ]
|
|
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -447,10 +447,14 @@ class RackReservationFilterSet(NetBoxModelFilterSet, TenancyFilterSet):
|
|
|
to_field_name='username',
|
|
to_field_name='username',
|
|
|
label=_('User (name)'),
|
|
label=_('User (name)'),
|
|
|
)
|
|
)
|
|
|
|
|
+ unit = NumericArrayFilter(
|
|
|
|
|
+ field_name='units',
|
|
|
|
|
+ lookup_expr='contains'
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = RackReservation
|
|
model = RackReservation
|
|
|
- fields = ['id', 'created', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'created', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -467,7 +471,7 @@ class ManufacturerFilterSet(OrganizationalModelFilterSet, ContactModelFilterSet)
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Manufacturer
|
|
model = Manufacturer
|
|
|
- fields = ['id', 'name', 'slug', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class DeviceTypeFilterSet(NetBoxModelFilterSet):
|
|
class DeviceTypeFilterSet(NetBoxModelFilterSet):
|
|
@@ -538,10 +542,22 @@ class DeviceTypeFilterSet(NetBoxModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = DeviceType
|
|
model = DeviceType
|
|
|
- fields = [
|
|
|
|
|
|
|
+ fields = (
|
|
|
'id', 'model', 'slug', 'part_number', 'u_height', 'exclude_from_utilization', 'is_full_depth',
|
|
'id', 'model', 'slug', 'part_number', 'u_height', 'exclude_from_utilization', 'is_full_depth',
|
|
|
'subdevice_role', 'airflow', 'weight', 'weight_unit', 'description',
|
|
'subdevice_role', 'airflow', 'weight', 'weight_unit', 'description',
|
|
|
- ]
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Counters
|
|
|
|
|
+ 'console_port_template_count',
|
|
|
|
|
+ 'console_server_port_template_count',
|
|
|
|
|
+ 'power_port_template_count',
|
|
|
|
|
+ 'power_outlet_template_count',
|
|
|
|
|
+ 'interface_template_count',
|
|
|
|
|
+ 'front_port_template_count',
|
|
|
|
|
+ 'rear_port_template_count',
|
|
|
|
|
+ 'device_bay_template_count',
|
|
|
|
|
+ 'module_bay_template_count',
|
|
|
|
|
+ 'inventory_item_template_count',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -635,7 +651,7 @@ class ModuleTypeFilterSet(NetBoxModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ModuleType
|
|
model = ModuleType
|
|
|
- fields = ['id', 'model', 'part_number', 'weight', 'weight_unit', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'model', 'part_number', 'weight', 'weight_unit', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -675,12 +691,15 @@ class DeviceTypeComponentFilterSet(django_filters.FilterSet):
|
|
|
method='search',
|
|
method='search',
|
|
|
label=_('Search'),
|
|
label=_('Search'),
|
|
|
)
|
|
)
|
|
|
- devicetype_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
|
|
+ device_type_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
queryset=DeviceType.objects.all(),
|
|
queryset=DeviceType.objects.all(),
|
|
|
field_name='device_type_id',
|
|
field_name='device_type_id',
|
|
|
label=_('Device type (ID)'),
|
|
label=_('Device type (ID)'),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ # TODO: Remove in v4.1
|
|
|
|
|
+ devicetype_id = device_type_id
|
|
|
|
|
+
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
|
return queryset
|
|
return queryset
|
|
@@ -691,32 +710,35 @@ class DeviceTypeComponentFilterSet(django_filters.FilterSet):
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModularDeviceTypeComponentFilterSet(DeviceTypeComponentFilterSet):
|
|
class ModularDeviceTypeComponentFilterSet(DeviceTypeComponentFilterSet):
|
|
|
- moduletype_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
|
|
+ module_type_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
queryset=ModuleType.objects.all(),
|
|
queryset=ModuleType.objects.all(),
|
|
|
field_name='module_type_id',
|
|
field_name='module_type_id',
|
|
|
label=_('Module type (ID)'),
|
|
label=_('Module type (ID)'),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ # TODO: Remove in v4.1
|
|
|
|
|
+ moduletype_id = module_type_id
|
|
|
|
|
+
|
|
|
|
|
|
|
|
class ConsolePortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
class ConsolePortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ConsolePortTemplate
|
|
model = ConsolePortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'type', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConsoleServerPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
class ConsoleServerPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ConsoleServerPortTemplate
|
|
model = ConsoleServerPortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'type', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class PowerPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
class PowerPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = PowerPortTemplate
|
|
model = PowerPortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'maximum_draw', 'allocated_draw', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class PowerOutletTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
class PowerOutletTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
@@ -724,10 +746,14 @@ class PowerOutletTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceType
|
|
|
choices=PowerOutletFeedLegChoices,
|
|
choices=PowerOutletFeedLegChoices,
|
|
|
null_value=None
|
|
null_value=None
|
|
|
)
|
|
)
|
|
|
|
|
+ power_port_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ queryset=PowerPortTemplate.objects.all(),
|
|
|
|
|
+ label=_('Power port (ID)'),
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = PowerOutletTemplate
|
|
model = PowerOutletTemplate
|
|
|
- fields = ['id', 'name', 'type', 'feed_leg', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'type', 'feed_leg', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class InterfaceTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
class InterfaceTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
@@ -751,7 +777,7 @@ class InterfaceTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeCo
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = InterfaceTemplate
|
|
model = InterfaceTemplate
|
|
|
- fields = ['id', 'name', 'type', 'enabled', 'mgmt_only', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'type', 'enabled', 'mgmt_only', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class FrontPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
class FrontPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
@@ -759,10 +785,13 @@ class FrontPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeCo
|
|
|
choices=PortTypeChoices,
|
|
choices=PortTypeChoices,
|
|
|
null_value=None
|
|
null_value=None
|
|
|
)
|
|
)
|
|
|
|
|
+ rear_port_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ queryset=RearPort.objects.all()
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = FrontPortTemplate
|
|
model = FrontPortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'color', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'type', 'color', 'rear_port_position', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class RearPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
class RearPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
@@ -773,21 +802,21 @@ class RearPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeCom
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = RearPortTemplate
|
|
model = RearPortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'color', 'positions', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'type', 'color', 'positions', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModuleBayTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
class ModuleBayTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ModuleBayTemplate
|
|
model = ModuleBayTemplate
|
|
|
- fields = ['id', 'name', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'position', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class DeviceBayTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
class DeviceBayTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = DeviceBayTemplate
|
|
model = DeviceBayTemplate
|
|
|
- fields = ['id', 'name', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class InventoryItemTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
class InventoryItemTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
@@ -820,7 +849,7 @@ class InventoryItemTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeCompo
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = InventoryItemTemplate
|
|
model = InventoryItemTemplate
|
|
|
- fields = ['id', 'name', 'label', 'part_id', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'part_id', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -841,7 +870,7 @@ class DeviceRoleFilterSet(OrganizationalModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = DeviceRole
|
|
model = DeviceRole
|
|
|
- fields = ['id', 'name', 'slug', 'color', 'vm_role', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'color', 'vm_role', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class PlatformFilterSet(OrganizationalModelFilterSet):
|
|
class PlatformFilterSet(OrganizationalModelFilterSet):
|
|
@@ -867,7 +896,7 @@ class PlatformFilterSet(OrganizationalModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Platform
|
|
model = Platform
|
|
|
- fields = ['id', 'name', 'slug', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'description')
|
|
|
|
|
|
|
|
@extend_schema_field(OpenApiTypes.STR)
|
|
@extend_schema_field(OpenApiTypes.STR)
|
|
|
def get_for_device_type(self, queryset, name, value):
|
|
def get_for_device_type(self, queryset, name, value):
|
|
@@ -979,6 +1008,11 @@ class DeviceFilterSet(
|
|
|
queryset=Rack.objects.all(),
|
|
queryset=Rack.objects.all(),
|
|
|
label=_('Rack (ID)'),
|
|
label=_('Rack (ID)'),
|
|
|
)
|
|
)
|
|
|
|
|
+ parent_bay_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ field_name='parent_bay',
|
|
|
|
|
+ queryset=DeviceBay.objects.all(),
|
|
|
|
|
+ label=_('Parent bay (ID)'),
|
|
|
|
|
+ )
|
|
|
cluster_id = django_filters.ModelMultipleChoiceFilter(
|
|
cluster_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
queryset=Cluster.objects.all(),
|
|
queryset=Cluster.objects.all(),
|
|
|
label=_('VM cluster (ID)'),
|
|
label=_('VM cluster (ID)'),
|
|
@@ -1068,10 +1102,22 @@ class DeviceFilterSet(
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Device
|
|
model = Device
|
|
|
- fields = [
|
|
|
|
|
|
|
+ fields = (
|
|
|
'id', 'asset_tag', 'face', 'position', 'latitude', 'longitude', 'airflow', 'vc_position', 'vc_priority',
|
|
'id', 'asset_tag', 'face', 'position', 'latitude', 'longitude', 'airflow', 'vc_position', 'vc_priority',
|
|
|
'description',
|
|
'description',
|
|
|
- ]
|
|
|
|
|
|
|
+
|
|
|
|
|
+ # Counters
|
|
|
|
|
+ 'console_port_count',
|
|
|
|
|
+ 'console_server_port_count',
|
|
|
|
|
+ 'power_port_count',
|
|
|
|
|
+ 'power_outlet_count',
|
|
|
|
|
+ 'interface_count',
|
|
|
|
|
+ 'front_port_count',
|
|
|
|
|
+ 'rear_port_count',
|
|
|
|
|
+ 'device_bay_count',
|
|
|
|
|
+ 'module_bay_count',
|
|
|
|
|
+ 'inventory_item_count',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -1134,24 +1180,29 @@ class VirtualDeviceContextFilterSet(NetBoxModelFilterSet, TenancyFilterSet, Prim
|
|
|
device_id = django_filters.ModelMultipleChoiceFilter(
|
|
device_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
field_name='device',
|
|
field_name='device',
|
|
|
queryset=Device.objects.all(),
|
|
queryset=Device.objects.all(),
|
|
|
- label='VDC (ID)',
|
|
|
|
|
|
|
+ label=_('VDC (ID)')
|
|
|
)
|
|
)
|
|
|
device = django_filters.ModelMultipleChoiceFilter(
|
|
device = django_filters.ModelMultipleChoiceFilter(
|
|
|
field_name='device',
|
|
field_name='device',
|
|
|
queryset=Device.objects.all(),
|
|
queryset=Device.objects.all(),
|
|
|
- label='Device model',
|
|
|
|
|
|
|
+ label=_('Device model')
|
|
|
|
|
+ )
|
|
|
|
|
+ interface_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ field_name='interfaces',
|
|
|
|
|
+ queryset=Interface.objects.all(),
|
|
|
|
|
+ label=_('Interface (ID)')
|
|
|
)
|
|
)
|
|
|
status = django_filters.MultipleChoiceFilter(
|
|
status = django_filters.MultipleChoiceFilter(
|
|
|
choices=VirtualDeviceContextStatusChoices
|
|
choices=VirtualDeviceContextStatusChoices
|
|
|
)
|
|
)
|
|
|
has_primary_ip = django_filters.BooleanFilter(
|
|
has_primary_ip = django_filters.BooleanFilter(
|
|
|
method='_has_primary_ip',
|
|
method='_has_primary_ip',
|
|
|
- label='Has a primary IP',
|
|
|
|
|
|
|
+ label=_('Has a primary IP')
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = VirtualDeviceContext
|
|
model = VirtualDeviceContext
|
|
|
- fields = ['id', 'device', 'name', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'device', 'name', 'identifier', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -1217,7 +1268,7 @@ class ModuleFilterSet(NetBoxModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Module
|
|
model = Module
|
|
|
- fields = ['id', 'status', 'asset_tag', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'status', 'asset_tag', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -1361,6 +1412,10 @@ class ModularDeviceComponentFilterSet(DeviceComponentFilterSet):
|
|
|
|
|
|
|
|
|
|
|
|
|
class CabledObjectFilterSet(django_filters.FilterSet):
|
|
class CabledObjectFilterSet(django_filters.FilterSet):
|
|
|
|
|
+ cable_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ queryset=Cable.objects.all(),
|
|
|
|
|
+ label=_('Cable (ID)'),
|
|
|
|
|
+ )
|
|
|
cabled = django_filters.BooleanFilter(
|
|
cabled = django_filters.BooleanFilter(
|
|
|
field_name='cable',
|
|
field_name='cable',
|
|
|
lookup_expr='isnull',
|
|
lookup_expr='isnull',
|
|
@@ -1402,7 +1457,7 @@ class ConsolePortFilterSet(
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ConsolePort
|
|
model = ConsolePort
|
|
|
- fields = ['id', 'name', 'label', 'description', 'cable_end']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'speed', 'description', 'mark_connected', 'cable_end')
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConsoleServerPortFilterSet(
|
|
class ConsoleServerPortFilterSet(
|
|
@@ -1418,7 +1473,7 @@ class ConsoleServerPortFilterSet(
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ConsoleServerPort
|
|
model = ConsoleServerPort
|
|
|
- fields = ['id', 'name', 'label', 'description', 'cable_end']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'speed', 'description', 'mark_connected', 'cable_end')
|
|
|
|
|
|
|
|
|
|
|
|
|
class PowerPortFilterSet(
|
|
class PowerPortFilterSet(
|
|
@@ -1434,7 +1489,9 @@ class PowerPortFilterSet(
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = PowerPort
|
|
model = PowerPort
|
|
|
- fields = ['id', 'name', 'label', 'maximum_draw', 'allocated_draw', 'description', 'cable_end']
|
|
|
|
|
|
|
+ fields = (
|
|
|
|
|
+ 'id', 'name', 'label', 'maximum_draw', 'allocated_draw', 'description', 'mark_connected', 'cable_end',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
|
|
|
class PowerOutletFilterSet(
|
|
class PowerOutletFilterSet(
|
|
@@ -1451,10 +1508,16 @@ class PowerOutletFilterSet(
|
|
|
choices=PowerOutletFeedLegChoices,
|
|
choices=PowerOutletFeedLegChoices,
|
|
|
null_value=None
|
|
null_value=None
|
|
|
)
|
|
)
|
|
|
|
|
+ power_port_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ queryset=PowerPort.objects.all(),
|
|
|
|
|
+ label=_('Power port (ID)'),
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = PowerOutlet
|
|
model = PowerOutlet
|
|
|
- fields = ['id', 'name', 'label', 'feed_leg', 'description', 'cable_end']
|
|
|
|
|
|
|
+ fields = (
|
|
|
|
|
+ 'id', 'name', 'label', 'feed_leg', 'description', 'mark_connected', 'cable_end',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
|
|
|
class CommonInterfaceFilterSet(django_filters.FilterSet):
|
|
class CommonInterfaceFilterSet(django_filters.FilterSet):
|
|
@@ -1569,27 +1632,37 @@ class InterfaceFilterSet(
|
|
|
vdc_id = django_filters.ModelMultipleChoiceFilter(
|
|
vdc_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
field_name='vdcs',
|
|
field_name='vdcs',
|
|
|
queryset=VirtualDeviceContext.objects.all(),
|
|
queryset=VirtualDeviceContext.objects.all(),
|
|
|
- label='Virtual Device Context',
|
|
|
|
|
|
|
+ label=_('Virtual Device Context')
|
|
|
)
|
|
)
|
|
|
vdc_identifier = django_filters.ModelMultipleChoiceFilter(
|
|
vdc_identifier = django_filters.ModelMultipleChoiceFilter(
|
|
|
field_name='vdcs__identifier',
|
|
field_name='vdcs__identifier',
|
|
|
queryset=VirtualDeviceContext.objects.all(),
|
|
queryset=VirtualDeviceContext.objects.all(),
|
|
|
to_field_name='identifier',
|
|
to_field_name='identifier',
|
|
|
- label='Virtual Device Context (Identifier)',
|
|
|
|
|
|
|
+ label=_('Virtual Device Context (Identifier)')
|
|
|
)
|
|
)
|
|
|
vdc = django_filters.ModelMultipleChoiceFilter(
|
|
vdc = django_filters.ModelMultipleChoiceFilter(
|
|
|
field_name='vdcs__name',
|
|
field_name='vdcs__name',
|
|
|
queryset=VirtualDeviceContext.objects.all(),
|
|
queryset=VirtualDeviceContext.objects.all(),
|
|
|
to_field_name='name',
|
|
to_field_name='name',
|
|
|
- label='Virtual Device Context',
|
|
|
|
|
|
|
+ label=_('Virtual Device Context')
|
|
|
|
|
+ )
|
|
|
|
|
+ wireless_lan_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ field_name='wireless_lans',
|
|
|
|
|
+ queryset=WirelessLAN.objects.all(),
|
|
|
|
|
+ label=_('Wireless LAN')
|
|
|
|
|
+ )
|
|
|
|
|
+ wireless_link_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ queryset=WirelessLink.objects.all(),
|
|
|
|
|
+ label=_('Wireless link')
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Interface
|
|
model = Interface
|
|
|
- fields = [
|
|
|
|
|
|
|
+ fields = (
|
|
|
'id', 'name', 'label', 'type', 'enabled', 'mtu', 'mgmt_only', 'poe_mode', 'poe_type', 'mode', 'rf_role',
|
|
'id', 'name', 'label', 'type', 'enabled', 'mtu', 'mgmt_only', 'poe_mode', 'poe_type', 'mode', 'rf_role',
|
|
|
- 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'cable_end',
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'mark_connected',
|
|
|
|
|
+ 'cable_id', 'cable_end',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def filter_virtual_chassis_member(self, queryset, name, value):
|
|
def filter_virtual_chassis_member(self, queryset, name, value):
|
|
|
try:
|
|
try:
|
|
@@ -1618,10 +1691,15 @@ class FrontPortFilterSet(
|
|
|
choices=PortTypeChoices,
|
|
choices=PortTypeChoices,
|
|
|
null_value=None
|
|
null_value=None
|
|
|
)
|
|
)
|
|
|
|
|
+ rear_port_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ queryset=RearPort.objects.all()
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = FrontPort
|
|
model = FrontPort
|
|
|
- fields = ['id', 'name', 'label', 'type', 'color', 'description', 'cable_end']
|
|
|
|
|
|
|
+ fields = (
|
|
|
|
|
+ 'id', 'name', 'label', 'type', 'color', 'rear_port_position', 'description', 'mark_connected', 'cable_end',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
|
|
|
class RearPortFilterSet(
|
|
class RearPortFilterSet(
|
|
@@ -1636,21 +1714,38 @@ class RearPortFilterSet(
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = RearPort
|
|
model = RearPort
|
|
|
- fields = ['id', 'name', 'label', 'type', 'color', 'positions', 'description', 'cable_end']
|
|
|
|
|
|
|
+ fields = (
|
|
|
|
|
+ 'id', 'name', 'label', 'type', 'color', 'positions', 'description', 'mark_connected', 'cable_end',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModuleBayFilterSet(DeviceComponentFilterSet, NetBoxModelFilterSet):
|
|
class ModuleBayFilterSet(DeviceComponentFilterSet, NetBoxModelFilterSet):
|
|
|
|
|
+ installed_module_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ field_name='installed_module',
|
|
|
|
|
+ queryset=ModuleBay.objects.all(),
|
|
|
|
|
+ label=_('Installed module (ID)'),
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ModuleBay
|
|
model = ModuleBay
|
|
|
- fields = ['id', 'name', 'label', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'position', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class DeviceBayFilterSet(DeviceComponentFilterSet, NetBoxModelFilterSet):
|
|
class DeviceBayFilterSet(DeviceComponentFilterSet, NetBoxModelFilterSet):
|
|
|
|
|
+ installed_device_id = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ queryset=Device.objects.all(),
|
|
|
|
|
+ label=_('Installed device (ID)'),
|
|
|
|
|
+ )
|
|
|
|
|
+ installed_device = django_filters.ModelMultipleChoiceFilter(
|
|
|
|
|
+ field_name='installed_device__name',
|
|
|
|
|
+ queryset=Device.objects.all(),
|
|
|
|
|
+ to_field_name='name',
|
|
|
|
|
+ label=_('Installed device (name)'),
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = DeviceBay
|
|
model = DeviceBay
|
|
|
- fields = ['id', 'name', 'label', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class InventoryItemFilterSet(DeviceComponentFilterSet, NetBoxModelFilterSet):
|
|
class InventoryItemFilterSet(DeviceComponentFilterSet, NetBoxModelFilterSet):
|
|
@@ -1686,7 +1781,7 @@ class InventoryItemFilterSet(DeviceComponentFilterSet, NetBoxModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = InventoryItem
|
|
model = InventoryItem
|
|
|
- fields = ['id', 'name', 'label', 'part_id', 'asset_tag', 'discovered']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'label', 'part_id', 'asset_tag', 'description', 'discovered')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -1705,7 +1800,7 @@ class InventoryItemRoleFilterSet(OrganizationalModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = InventoryItemRole
|
|
model = InventoryItemRole
|
|
|
- fields = ['id', 'name', 'slug', 'color', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'slug', 'color', 'description')
|
|
|
|
|
|
|
|
|
|
|
|
|
class VirtualChassisFilterSet(NetBoxModelFilterSet):
|
|
class VirtualChassisFilterSet(NetBoxModelFilterSet):
|
|
@@ -1770,7 +1865,7 @@ class VirtualChassisFilterSet(NetBoxModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = VirtualChassis
|
|
model = VirtualChassis
|
|
|
- fields = ['id', 'domain', 'name', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'domain', 'name', 'description', 'member_count')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -1875,7 +1970,7 @@ class CableFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Cable
|
|
model = Cable
|
|
|
- fields = ['id', 'label', 'length', 'length_unit', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'label', 'length', 'length_unit', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -1953,12 +2048,12 @@ class CableFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
return self.filter_by_termination_object(queryset, CircuitTermination, value)
|
|
return self.filter_by_termination_object(queryset, CircuitTermination, value)
|
|
|
|
|
|
|
|
|
|
|
|
|
-class CableTerminationFilterSet(BaseFilterSet):
|
|
|
|
|
|
|
+class CableTerminationFilterSet(ChangeLoggedModelFilterSet):
|
|
|
termination_type = ContentTypeFilter()
|
|
termination_type = ContentTypeFilter()
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = CableTermination
|
|
model = CableTermination
|
|
|
- fields = ['id', 'cable', 'cable_end', 'termination_type', 'termination_id']
|
|
|
|
|
|
|
+ fields = ('id', 'cable', 'cable_end', 'termination_type', 'termination_id')
|
|
|
|
|
|
|
|
|
|
|
|
|
class PowerPanelFilterSet(NetBoxModelFilterSet, ContactModelFilterSet):
|
|
class PowerPanelFilterSet(NetBoxModelFilterSet, ContactModelFilterSet):
|
|
@@ -2007,7 +2102,7 @@ class PowerPanelFilterSet(NetBoxModelFilterSet, ContactModelFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = PowerPanel
|
|
model = PowerPanel
|
|
|
- fields = ['id', 'name', 'description']
|
|
|
|
|
|
|
+ fields = ('id', 'name', 'description')
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -2073,10 +2168,10 @@ class PowerFeedFilterSet(NetBoxModelFilterSet, CabledObjectFilterSet, PathEndpoi
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = PowerFeed
|
|
model = PowerFeed
|
|
|
- fields = [
|
|
|
|
|
- 'id', 'name', 'status', 'type', 'supply', 'phase', 'voltage', 'amperage', 'max_utilization', 'cable_end',
|
|
|
|
|
- 'description',
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ fields = (
|
|
|
|
|
+ 'id', 'name', 'status', 'type', 'supply', 'phase', 'voltage', 'amperage', 'max_utilization',
|
|
|
|
|
+ 'available_power', 'mark_connected', 'cable_end', 'description',
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
if not value.strip():
|
|
@@ -2135,18 +2230,18 @@ class ConsoleConnectionFilterSet(ConnectionFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = ConsolePort
|
|
model = ConsolePort
|
|
|
- fields = ['name']
|
|
|
|
|
|
|
+ fields = ('name',)
|
|
|
|
|
|
|
|
|
|
|
|
|
class PowerConnectionFilterSet(ConnectionFilterSet):
|
|
class PowerConnectionFilterSet(ConnectionFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = PowerPort
|
|
model = PowerPort
|
|
|
- fields = ['name']
|
|
|
|
|
|
|
+ fields = ('name',)
|
|
|
|
|
|
|
|
|
|
|
|
|
class InterfaceConnectionFilterSet(ConnectionFilterSet):
|
|
class InterfaceConnectionFilterSet(ConnectionFilterSet):
|
|
|
|
|
|
|
|
class Meta:
|
|
class Meta:
|
|
|
model = Interface
|
|
model = Interface
|
|
|
- fields = []
|
|
|
|
|
|
|
+ fields = tuple()
|