mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 11:56:25 -06:00
Fix E501 errors
This commit is contained in:
parent
4bc2bf6f2e
commit
d39dc6d45c
@ -239,9 +239,24 @@ class ContactAssignmentTest(APIViewTestCases.APIViewTestCase):
|
||||
ContactRole.objects.bulk_create(contact_roles)
|
||||
|
||||
contact_assignments = (
|
||||
ContactAssignment(object=sites[0], contact=contacts[0], role=contact_roles[0], priority=ContactPriorityChoices.PRIORITY_PRIMARY),
|
||||
ContactAssignment(object=sites[0], contact=contacts[1], role=contact_roles[1], priority=ContactPriorityChoices.PRIORITY_SECONDARY),
|
||||
ContactAssignment(object=sites[0], contact=contacts[2], role=contact_roles[2], priority=ContactPriorityChoices.PRIORITY_TERTIARY),
|
||||
ContactAssignment(
|
||||
object=sites[0],
|
||||
contact=contacts[0],
|
||||
role=contact_roles[0],
|
||||
priority=ContactPriorityChoices.PRIORITY_PRIMARY,
|
||||
),
|
||||
ContactAssignment(
|
||||
object=sites[0],
|
||||
contact=contacts[1],
|
||||
role=contact_roles[1],
|
||||
priority=ContactPriorityChoices.PRIORITY_SECONDARY,
|
||||
),
|
||||
ContactAssignment(
|
||||
object=sites[0],
|
||||
contact=contacts[2],
|
||||
role=contact_roles[2],
|
||||
priority=ContactPriorityChoices.PRIORITY_TERTIARY,
|
||||
),
|
||||
)
|
||||
ContactAssignment.objects.bulk_create(contact_assignments)
|
||||
|
||||
|
@ -286,9 +286,15 @@ class TokenTestCase(TestCase, BaseFilterSetTests):
|
||||
future_date = make_aware(datetime.datetime(3000, 1, 1))
|
||||
past_date = make_aware(datetime.datetime(2000, 1, 1))
|
||||
tokens = (
|
||||
Token(user=users[0], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar1'),
|
||||
Token(user=users[1], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar2'),
|
||||
Token(user=users[2], key=Token.generate_key(), expires=past_date, write_enabled=False),
|
||||
Token(
|
||||
user=users[0], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar1'
|
||||
),
|
||||
Token(
|
||||
user=users[1], key=Token.generate_key(), expires=future_date, write_enabled=True, description='foobar2'
|
||||
),
|
||||
Token(
|
||||
user=users[2], key=Token.generate_key(), expires=past_date, write_enabled=False
|
||||
),
|
||||
)
|
||||
Token.objects.bulk_create(tokens)
|
||||
|
||||
|
@ -23,11 +23,16 @@ class UserTestCase(
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
|
||||
users = (
|
||||
User(username='username1', first_name='first1', last_name='last1', email='user1@foo.com', password='pass1xxx'),
|
||||
User(username='username2', first_name='first2', last_name='last2', email='user2@foo.com', password='pass2xxx'),
|
||||
User(username='username3', first_name='first3', last_name='last3', email='user3@foo.com', password='pass3xxx'),
|
||||
User(
|
||||
username='username1', first_name='first1', last_name='last1', email='user1@foo.com', password='pass1xxx'
|
||||
),
|
||||
User(
|
||||
username='username2', first_name='first2', last_name='last2', email='user2@foo.com', password='pass2xxx'
|
||||
),
|
||||
User(
|
||||
username='username3', first_name='first3', last_name='last3', email='user3@foo.com', password='pass3xxx'
|
||||
),
|
||||
)
|
||||
User.objects.bulk_create(users)
|
||||
|
||||
|
@ -26,7 +26,10 @@ class ProxyHTTPConnection(HTTPConnection):
|
||||
try:
|
||||
from python_socks.sync import Proxy
|
||||
except ModuleNotFoundError as e:
|
||||
logger.info("Configuring an HTTP proxy using SOCKS requires the python_socks library. Check that it has been installed.")
|
||||
logger.info(
|
||||
"Configuring an HTTP proxy using SOCKS requires the python_socks library. Check that it has been "
|
||||
"installed."
|
||||
)
|
||||
raise e
|
||||
|
||||
proxy = Proxy.from_url(self._proxy_url, rdns=self.use_rdns)
|
||||
|
@ -443,7 +443,10 @@ class APIViewTestCases:
|
||||
# Compile list of fields to include
|
||||
fields_string = ''
|
||||
|
||||
file_fields = (strawberry_django.fields.types.DjangoFileType, strawberry_django.fields.types.DjangoImageType)
|
||||
file_fields = (
|
||||
strawberry_django.fields.types.DjangoFileType,
|
||||
strawberry_django.fields.types.DjangoImageType,
|
||||
)
|
||||
for field in type_class.__strawberry_definition__.fields:
|
||||
if (
|
||||
field.type in file_fields or (
|
||||
|
@ -427,9 +427,46 @@ class DynamicFilterLookupExpressionTest(TestCase):
|
||||
Rack.objects.bulk_create(racks)
|
||||
|
||||
devices = (
|
||||
Device(name='Device 1', device_type=device_types[0], role=roles[0], platform=platforms[0], serial='ABC', asset_tag='1001', site=sites[0], rack=racks[0], position=1, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_ACTIVE, local_context_data={"foo": 123}),
|
||||
Device(name='Device 2', device_type=device_types[1], role=roles[1], platform=platforms[1], serial='DEF', asset_tag='1002', site=sites[1], rack=racks[1], position=2, face=DeviceFaceChoices.FACE_FRONT, status=DeviceStatusChoices.STATUS_STAGED),
|
||||
Device(name='Device 3', device_type=device_types[2], role=roles[2], platform=platforms[2], serial='GHI', asset_tag='1003', site=sites[2], rack=racks[2], position=3, face=DeviceFaceChoices.FACE_REAR, status=DeviceStatusChoices.STATUS_FAILED),
|
||||
Device(
|
||||
name='Device 1',
|
||||
device_type=device_types[0],
|
||||
role=roles[0],
|
||||
platform=platforms[0],
|
||||
serial='ABC',
|
||||
asset_tag='1001',
|
||||
site=sites[0],
|
||||
rack=racks[0],
|
||||
position=1,
|
||||
face=DeviceFaceChoices.FACE_FRONT,
|
||||
status=DeviceStatusChoices.STATUS_ACTIVE,
|
||||
local_context_data={'foo': 123},
|
||||
),
|
||||
Device(
|
||||
name='Device 2',
|
||||
device_type=device_types[1],
|
||||
role=roles[1],
|
||||
platform=platforms[1],
|
||||
serial='DEF',
|
||||
asset_tag='1002',
|
||||
site=sites[1],
|
||||
rack=racks[1],
|
||||
position=2,
|
||||
face=DeviceFaceChoices.FACE_FRONT,
|
||||
status=DeviceStatusChoices.STATUS_STAGED,
|
||||
),
|
||||
Device(
|
||||
name='Device 3',
|
||||
device_type=device_types[2],
|
||||
role=roles[2],
|
||||
platform=platforms[2],
|
||||
serial='GHI',
|
||||
asset_tag='1003',
|
||||
site=sites[2],
|
||||
rack=racks[2],
|
||||
position=3,
|
||||
face=DeviceFaceChoices.FACE_REAR,
|
||||
status=DeviceStatusChoices.STATUS_FAILED,
|
||||
),
|
||||
)
|
||||
Device.objects.bulk_create(devices)
|
||||
|
||||
|
@ -75,9 +75,9 @@ class ClusterSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = Cluster
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type', 'scope_id', 'scope',
|
||||
'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count',
|
||||
'virtualmachine_count', 'allocated_vcpus', 'allocated_memory', 'allocated_disk'
|
||||
'id', 'url', 'display_url', 'display', 'name', 'type', 'group', 'status', 'tenant', 'scope_type',
|
||||
'scope_id', 'scope', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
'device_count', 'virtualmachine_count', 'allocated_vcpus', 'allocated_memory', 'allocated_disk'
|
||||
]
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description', 'virtualmachine_count')
|
||||
|
||||
|
@ -49,8 +49,8 @@ class VirtualMachineSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = VirtualMachine
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', 'tenant',
|
||||
'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description',
|
||||
'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role',
|
||||
'tenant', 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description',
|
||||
'comments', 'config_template', 'local_context_data', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
'interface_count', 'virtual_disk_count',
|
||||
]
|
||||
@ -62,8 +62,8 @@ class VirtualMachineWithConfigContextSerializer(VirtualMachineSerializer):
|
||||
|
||||
class Meta(VirtualMachineSerializer.Meta):
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role', 'tenant',
|
||||
'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description',
|
||||
'id', 'url', 'display_url', 'display', 'name', 'status', 'site', 'cluster', 'device', 'serial', 'role',
|
||||
'tenant', 'platform', 'primary_ip', 'primary_ip4', 'primary_ip6', 'vcpus', 'memory', 'disk', 'description',
|
||||
'comments', 'config_template', 'local_context_data', 'tags', 'custom_fields', 'config_context', 'created',
|
||||
'last_updated', 'interface_count', 'virtual_disk_count',
|
||||
]
|
||||
|
@ -73,7 +73,9 @@ class ClusterImportForm(ScopedImportForm, NetBoxModelImportForm):
|
||||
|
||||
class Meta:
|
||||
model = Cluster
|
||||
fields = ('name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags')
|
||||
fields = (
|
||||
'name', 'type', 'group', 'status', 'scope_type', 'scope_id', 'tenant', 'description', 'comments', 'tags',
|
||||
)
|
||||
labels = {
|
||||
'scope_id': _('Scope ID'),
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class ClusterTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Cluster
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'scope', 'scope_type', 'description',
|
||||
'comments', 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated',
|
||||
'pk', 'id', 'name', 'type', 'group', 'status', 'tenant', 'tenant_group', 'scope', 'scope_type',
|
||||
'description', 'comments', 'device_count', 'vm_count', 'contacts', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = ('pk', 'name', 'type', 'group', 'status', 'tenant', 'site', 'device_count', 'vm_count')
|
||||
|
@ -109,9 +109,24 @@ class ClusterTest(APIViewTestCases.APIViewTestCase):
|
||||
ClusterGroup.objects.bulk_create(cluster_groups)
|
||||
|
||||
clusters = (
|
||||
Cluster(name='Cluster 1', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED),
|
||||
Cluster(name='Cluster 2', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED),
|
||||
Cluster(name='Cluster 3', type=cluster_types[0], group=cluster_groups[0], status=ClusterStatusChoices.STATUS_PLANNED),
|
||||
Cluster(
|
||||
name='Cluster 1',
|
||||
type=cluster_types[0],
|
||||
group=cluster_groups[0],
|
||||
status=ClusterStatusChoices.STATUS_PLANNED,
|
||||
),
|
||||
Cluster(
|
||||
name='Cluster 2',
|
||||
type=cluster_types[0],
|
||||
group=cluster_groups[0],
|
||||
status=ClusterStatusChoices.STATUS_PLANNED,
|
||||
),
|
||||
Cluster(
|
||||
name='Cluster 3',
|
||||
type=cluster_types[0],
|
||||
group=cluster_groups[0],
|
||||
status=ClusterStatusChoices.STATUS_PLANNED,
|
||||
),
|
||||
)
|
||||
for cluster in clusters:
|
||||
cluster.save()
|
||||
@ -169,9 +184,25 @@ class VirtualMachineTest(APIViewTestCases.APIViewTestCase):
|
||||
device2 = create_test_device('device2', site=sites[1], cluster=clusters[1])
|
||||
|
||||
virtual_machines = (
|
||||
VirtualMachine(name='Virtual Machine 1', site=sites[0], cluster=clusters[0], device=device1, local_context_data={'A': 1}),
|
||||
VirtualMachine(name='Virtual Machine 2', site=sites[0], cluster=clusters[0], local_context_data={'B': 2}),
|
||||
VirtualMachine(name='Virtual Machine 3', site=sites[0], cluster=clusters[0], local_context_data={'C': 3}),
|
||||
VirtualMachine(
|
||||
name='Virtual Machine 1',
|
||||
site=sites[0],
|
||||
cluster=clusters[0],
|
||||
device=device1,
|
||||
local_context_data={'A': 1},
|
||||
),
|
||||
VirtualMachine(
|
||||
name='Virtual Machine 2',
|
||||
site=sites[0],
|
||||
cluster=clusters[0],
|
||||
local_context_data={'B': 2
|
||||
}),
|
||||
VirtualMachine(
|
||||
name='Virtual Machine 3',
|
||||
site=sites[0],
|
||||
cluster=clusters[0],
|
||||
local_context_data={'C': 3}
|
||||
),
|
||||
)
|
||||
VirtualMachine.objects.bulk_create(virtual_machines)
|
||||
|
||||
|
@ -117,9 +117,27 @@ class ClusterTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
ClusterType.objects.bulk_create(clustertypes)
|
||||
|
||||
clusters = (
|
||||
Cluster(name='Cluster 1', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]),
|
||||
Cluster(name='Cluster 2', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]),
|
||||
Cluster(name='Cluster 3', group=clustergroups[0], type=clustertypes[0], status=ClusterStatusChoices.STATUS_ACTIVE, scope=sites[0]),
|
||||
Cluster(
|
||||
name='Cluster 1',
|
||||
group=clustergroups[0],
|
||||
type=clustertypes[0],
|
||||
status=ClusterStatusChoices.STATUS_ACTIVE,
|
||||
scope=sites[0],
|
||||
),
|
||||
Cluster(
|
||||
name='Cluster 2',
|
||||
group=clustergroups[0],
|
||||
type=clustertypes[0],
|
||||
status=ClusterStatusChoices.STATUS_ACTIVE,
|
||||
scope=sites[0],
|
||||
),
|
||||
Cluster(
|
||||
name='Cluster 3',
|
||||
group=clustergroups[0],
|
||||
type=clustertypes[0],
|
||||
status=ClusterStatusChoices.STATUS_ACTIVE,
|
||||
scope=sites[0],
|
||||
),
|
||||
)
|
||||
for cluster in clusters:
|
||||
cluster.save()
|
||||
@ -214,9 +232,30 @@ class VirtualMachineTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
)
|
||||
|
||||
virtual_machines = (
|
||||
VirtualMachine(name='Virtual Machine 1', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]),
|
||||
VirtualMachine(name='Virtual Machine 2', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]),
|
||||
VirtualMachine(name='Virtual Machine 3', site=sites[0], cluster=clusters[0], device=devices[0], role=roles[0], platform=platforms[0]),
|
||||
VirtualMachine(
|
||||
name='Virtual Machine 1',
|
||||
site=sites[0],
|
||||
cluster=clusters[0],
|
||||
device=devices[0],
|
||||
role=roles[0],
|
||||
platform=platforms[0],
|
||||
),
|
||||
VirtualMachine(
|
||||
name='Virtual Machine 2',
|
||||
site=sites[0],
|
||||
cluster=clusters[0],
|
||||
device=devices[0],
|
||||
role=roles[0],
|
||||
platform=platforms[0],
|
||||
),
|
||||
VirtualMachine(
|
||||
name='Virtual Machine 3',
|
||||
site=sites[0],
|
||||
cluster=clusters[0],
|
||||
device=devices[0],
|
||||
role=roles[0],
|
||||
platform=platforms[0],
|
||||
),
|
||||
)
|
||||
VirtualMachine.objects.bulk_create(virtual_machines)
|
||||
|
||||
|
@ -177,7 +177,11 @@ class ClusterView(generic.ObjectView):
|
||||
queryset = Cluster.objects.all()
|
||||
|
||||
def get_extra_context(self, request, instance):
|
||||
return instance.virtual_machines.aggregate(vcpus_sum=Sum('vcpus'), memory_sum=Sum('memory'), disk_sum=Sum('disk'))
|
||||
return instance.virtual_machines.aggregate(
|
||||
vcpus_sum=Sum('vcpus'),
|
||||
memory_sum=Sum('memory'),
|
||||
disk_sum=Sum('disk')
|
||||
)
|
||||
|
||||
|
||||
@register_model_view(Cluster, 'virtualmachines', path='virtual-machines')
|
||||
|
@ -74,7 +74,8 @@ class IPSecProposalSerializer(NetBoxModelSerializer):
|
||||
model = IPSecProposal
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'encryption_algorithm',
|
||||
'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields',
|
||||
'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
@ -8,9 +8,11 @@ class Migration(migrations.Migration):
|
||||
|
||||
operations = [
|
||||
# Rename vpn_l2vpn constraints
|
||||
migrations.RunSQL(
|
||||
'ALTER TABLE vpn_l2vpn RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id'
|
||||
),
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpn '
|
||||
'RENAME CONSTRAINT ipam_l2vpn_tenant_id_bb2564a6_fk_tenancy_tenant_id '
|
||||
'TO vpn_l2vpn_tenant_id_57ec8f92_fk_tenancy_tenant_id'
|
||||
)),
|
||||
# Rename ipam_l2vpn_* sequences
|
||||
migrations.RunSQL('ALTER TABLE ipam_l2vpn_export_targets_id_seq RENAME TO vpn_l2vpn_export_targets_id_seq'),
|
||||
migrations.RunSQL('ALTER TABLE ipam_l2vpn_id_seq RENAME TO vpn_l2vpn_id_seq'),
|
||||
@ -26,22 +28,29 @@ class Migration(migrations.Migration):
|
||||
migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_24008406_uniq RENAME TO vpn_l2vpn_slug_76b5a174_uniq'),
|
||||
migrations.RunSQL('ALTER INDEX IF EXISTS ipam_l2vpn_slug_key RENAME TO vpn_l2vpn_slug_key'),
|
||||
# Rename vpn_l2vpntermination constraints
|
||||
migrations.RunSQL(
|
||||
'ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check TO vpn_l2vpntermination_assigned_object_id_check'
|
||||
),
|
||||
migrations.RunSQL(
|
||||
'ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co'
|
||||
),
|
||||
migrations.RunSQL(
|
||||
'ALTER TABLE vpn_l2vpntermination RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id'
|
||||
),
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpntermination '
|
||||
'RENAME CONSTRAINT ipam_l2vpntermination_assigned_object_id_check '
|
||||
'TO vpn_l2vpntermination_assigned_object_id_check'
|
||||
)),
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpntermination '
|
||||
'RENAME CONSTRAINT ipam_l2vpnterminatio_assigned_object_type_3923c124_fk_django_co '
|
||||
'TO vpn_l2vpntermination_assigned_object_type_id_f063b865_fk_django_co'
|
||||
)),
|
||||
migrations.RunSQL((
|
||||
'ALTER TABLE vpn_l2vpntermination '
|
||||
'RENAME CONSTRAINT ipam_l2vpntermination_l2vpn_id_9e570aa1_fk_ipam_l2vpn_id '
|
||||
'TO vpn_l2vpntermination_l2vpn_id_f5367bbe_fk_vpn_l2vpn_id'
|
||||
)),
|
||||
# Rename ipam_l2vpn_termination_* sequences
|
||||
migrations.RunSQL('ALTER TABLE ipam_l2vpntermination_id_seq RENAME TO vpn_l2vpntermination_id_seq'),
|
||||
# Rename ipam_l2vpn_* indexes
|
||||
migrations.RunSQL('ALTER INDEX ipam_l2vpntermination_pkey RENAME TO vpn_l2vpntermination_pkey'),
|
||||
migrations.RunSQL(
|
||||
'ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865'
|
||||
),
|
||||
migrations.RunSQL((
|
||||
'ALTER INDEX ipam_l2vpntermination_assigned_object_type_id_3923c124 '
|
||||
'RENAME TO vpn_l2vpntermination_assigned_object_type_id_f063b865'
|
||||
)),
|
||||
migrations.RunSQL(
|
||||
'ALTER INDEX ipam_l2vpntermination_l2vpn_id_9e570aa1 RENAME TO vpn_l2vpntermination_l2vpn_id_f5367bbe'
|
||||
),
|
||||
|
@ -52,9 +52,9 @@ class WirelessLANSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = WirelessLAN
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'scope_type', 'scope_id', 'scope',
|
||||
'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags', 'custom_fields',
|
||||
'created', 'last_updated',
|
||||
'id', 'url', 'display_url', 'display', 'ssid', 'description', 'group', 'status', 'vlan', 'scope_type',
|
||||
'scope_id', 'scope', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'description', 'comments', 'tags',
|
||||
'custom_fields', 'created', 'last_updated',
|
||||
]
|
||||
brief_fields = ('id', 'url', 'display', 'ssid', 'description')
|
||||
|
||||
|
@ -76,8 +76,8 @@ class WirelessLANImportForm(ScopedImportForm, NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = WirelessLAN
|
||||
fields = (
|
||||
'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'scope_type', 'scope_id',
|
||||
'description', 'comments', 'tags',
|
||||
'ssid', 'group', 'status', 'vlan', 'tenant', 'auth_type', 'auth_cipher', 'auth_psk', 'scope_type',
|
||||
'scope_id', 'description', 'comments', 'tags',
|
||||
)
|
||||
labels = {
|
||||
'scope_id': _('Scope ID'),
|
||||
|
@ -72,7 +72,8 @@ class WirelessLANTable(TenancyColumnsMixin, NetBoxTable):
|
||||
model = WirelessLAN
|
||||
fields = (
|
||||
'pk', 'ssid', 'group', 'status', 'tenant', 'tenant_group', 'vlan', 'interface_count', 'auth_type',
|
||||
'auth_cipher', 'auth_psk', 'scope', 'scope_type', 'description', 'comments', 'tags', 'created', 'last_updated',
|
||||
'auth_cipher', 'auth_psk', 'scope', 'scope_type', 'description', 'comments', 'tags', 'created',
|
||||
'last_updated',
|
||||
)
|
||||
default_columns = ('pk', 'ssid', 'group', 'status', 'description', 'vlan', 'auth_type', 'interface_count')
|
||||
|
||||
|
@ -27,8 +27,18 @@ class WirelessLANGroupTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
group.save()
|
||||
|
||||
groups = (
|
||||
WirelessLANGroup(name='Wireless LAN Group 1A', slug='wireless-lan-group-1a', parent=parent_groups[0], description='foobar1'),
|
||||
WirelessLANGroup(name='Wireless LAN Group 1B', slug='wireless-lan-group-1b', parent=parent_groups[0], description='foobar2'),
|
||||
WirelessLANGroup(
|
||||
name='Wireless LAN Group 1A',
|
||||
slug='wireless-lan-group-1a',
|
||||
parent=parent_groups[0],
|
||||
description='foobar1',
|
||||
),
|
||||
WirelessLANGroup(
|
||||
name='Wireless LAN Group 1B',
|
||||
slug='wireless-lan-group-1b',
|
||||
parent=parent_groups[0],
|
||||
description='foobar2',
|
||||
),
|
||||
WirelessLANGroup(name='Wireless LAN Group 2A', slug='wireless-lan-group-2a', parent=parent_groups[1]),
|
||||
WirelessLANGroup(name='Wireless LAN Group 2B', slug='wireless-lan-group-2b', parent=parent_groups[1]),
|
||||
WirelessLANGroup(name='Wireless LAN Group 3A', slug='wireless-lan-group-3a', parent=parent_groups[2]),
|
||||
|
@ -113,9 +113,20 @@ class WirelessLANTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
|
||||
cls.csv_data = (
|
||||
"group,ssid,status,tenant,scope_type,scope_id",
|
||||
f"Wireless LAN Group 2,WLAN4,{WirelessLANStatusChoices.STATUS_ACTIVE},{tenants[0].name},,",
|
||||
f"Wireless LAN Group 2,WLAN5,{WirelessLANStatusChoices.STATUS_DISABLED},{tenants[1].name},dcim.site,{sites[0].pk}",
|
||||
f"Wireless LAN Group 2,WLAN6,{WirelessLANStatusChoices.STATUS_RESERVED},{tenants[2].name},dcim.site,{sites[1].pk}",
|
||||
"Wireless LAN Group 2,WLAN4,{status},{tenant},,".format(
|
||||
status=WirelessLANStatusChoices.STATUS_ACTIVE,
|
||||
tenant=tenants[0].name
|
||||
),
|
||||
"Wireless LAN Group 2,WLAN5,{status},{tenant},dcim.site,{site}".format(
|
||||
status=WirelessLANStatusChoices.STATUS_DISABLED,
|
||||
tenant=tenants[1].name,
|
||||
site=sites[0].pk
|
||||
),
|
||||
"Wireless LAN Group 2,WLAN6,{status},{tenant},dcim.site,{site}".format(
|
||||
status=WirelessLANStatusChoices.STATUS_RESERVED,
|
||||
tenant=tenants[2].name,
|
||||
site=sites[1].pk
|
||||
),
|
||||
)
|
||||
|
||||
cls.csv_update_data = (
|
||||
@ -157,11 +168,17 @@ class WirelessLinkTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
]
|
||||
Interface.objects.bulk_create(interfaces)
|
||||
|
||||
wirelesslink1 = WirelessLink(interface_a=interfaces[0], interface_b=interfaces[1], ssid='LINK1', tenant=tenants[0])
|
||||
wirelesslink1 = WirelessLink(
|
||||
interface_a=interfaces[0], interface_b=interfaces[1], ssid='LINK1', tenant=tenants[0]
|
||||
)
|
||||
wirelesslink1.save()
|
||||
wirelesslink2 = WirelessLink(interface_a=interfaces[2], interface_b=interfaces[3], ssid='LINK2', tenant=tenants[0])
|
||||
wirelesslink2 = WirelessLink(
|
||||
interface_a=interfaces[2], interface_b=interfaces[3], ssid='LINK2', tenant=tenants[0]
|
||||
)
|
||||
wirelesslink2.save()
|
||||
wirelesslink3 = WirelessLink(interface_a=interfaces[4], interface_b=interfaces[5], ssid='LINK3', tenant=tenants[0])
|
||||
wirelesslink3 = WirelessLink(
|
||||
interface_a=interfaces[4], interface_b=interfaces[5], ssid='LINK3', tenant=tenants[0]
|
||||
)
|
||||
wirelesslink3.save()
|
||||
|
||||
tags = create_tags('Alpha', 'Bravo', 'Charlie')
|
||||
|
Loading…
Reference in New Issue
Block a user