mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 00:28:16 -06:00
Migration for new form factors. Also updated device templates to display FF correctly in the console/power table
This commit is contained in:
parent
6a9ae22422
commit
f9f388f2ad
@ -527,7 +527,7 @@ class ConsoleServerPortSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = ConsoleServerPort
|
||||
fields = ['id', 'device', 'name', 'connected_console']
|
||||
fields = ['id', 'device', 'name', 'connected_console', 'form_factor']
|
||||
read_only_fields = ['connected_console']
|
||||
|
||||
|
||||
@ -535,7 +535,7 @@ class WritableConsoleServerPortSerializer(ValidatedModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = ConsoleServerPort
|
||||
fields = ['id', 'device', 'name']
|
||||
fields = ['id', 'device', 'name', 'form_factor']
|
||||
|
||||
|
||||
#
|
||||
@ -548,14 +548,14 @@ class ConsolePortSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = ConsolePort
|
||||
fields = ['id', 'device', 'name', 'cs_port', 'connection_status']
|
||||
fields = ['id', 'device', 'name', 'cs_port', 'connection_status', 'form_factor']
|
||||
|
||||
|
||||
class WritableConsolePortSerializer(ValidatedModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = ConsolePort
|
||||
fields = ['id', 'device', 'name', 'cs_port', 'connection_status']
|
||||
fields = ['id', 'device', 'name', 'cs_port', 'connection_status', 'form_factor']
|
||||
|
||||
|
||||
#
|
||||
|
@ -0,0 +1,73 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.4 on 2017-10-09 18:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dcim', '0049_rackreservation_change_user'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='consoleserverport',
|
||||
name='form_factor',
|
||||
field=models.PositiveSmallIntegerField(null=True, choices=[['Console',
|
||||
[[6000, 'RJ45 Serial'],
|
||||
[6010, 'DE9 Serial'],
|
||||
[6020, 'DB25 Serial'],
|
||||
[6030, 'USB to Serial'],
|
||||
[6040, 'Micro USB to Serial'],
|
||||
[6050, 'Mini USB to Serial'],
|
||||
[6060, 'KVM']]]])
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='consoleserverporttemplate',
|
||||
name='form_factor',
|
||||
field=models.PositiveSmallIntegerField(null=True, choices=[['Console',
|
||||
[[6000, 'RJ45 Serial'],
|
||||
[6010, 'DE9 Serial'],
|
||||
[6020, 'DB25 Serial'],
|
||||
[6030, 'USB to Serial'],
|
||||
[6040, 'Micro USB to Serial'],
|
||||
[6050, 'Mini USB to Serial'],
|
||||
[6060, 'KVM']]]])
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='consoleport',
|
||||
name='form_factor',
|
||||
field=models.PositiveSmallIntegerField(null=True, choices=[['Console',
|
||||
[[6000, 'RJ45 Serial'],
|
||||
[6010, 'DE9 Serial'],
|
||||
[6020, 'DB25 Serial'],
|
||||
[6030, 'USB to Serial'],
|
||||
[6040, 'Micro USB to Serial'],
|
||||
[6050, 'Mini USB to Serial'],
|
||||
[6060, 'KVM']]]])
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='consoleporttemplate',
|
||||
name='form_factor',
|
||||
field=models.PositiveSmallIntegerField(null=True, choices=[['Console',
|
||||
[[6000, 'RJ45 Serial'],
|
||||
[6010, 'DE9 Serial'],
|
||||
[6020, 'DB25 Serial'],
|
||||
[6030, 'USB to Serial'],
|
||||
[6040, 'Micro USB to Serial'],
|
||||
[6050, 'Mini USB to Serial'],
|
||||
[6060, 'KVM']]]])
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='interface',
|
||||
name='form_factor',
|
||||
field=models.PositiveSmallIntegerField(choices=[['Virtual interfaces', [[0, 'Virtual'], [200, 'Link Aggregation Group (LAG)']]], ['Ethernet (fixed)', [[800, '100BASE-TX (10/100ME)'], [1000, '1000BASE-T (1GE)'], [1150, '10GBASE-T (10GE)'], [1170, '10GBASE-CX4 (10GE)']]], ['Ethernet (modular)', [[1050, 'GBIC (1GE)'], [1100, 'SFP (1GE)'], [1200, 'SFP+ (10GE)'], [1300, 'XFP (10GE)'], [1310, 'XENPAK (10GE)'], [1320, 'X2 (10GE)'], [1350, 'SFP28 (25GE)'], [1400, 'QSFP+ (40GE)'], [1500, 'CFP (100GE)'], [1510, 'CFP2 (100GE)'], [1520, 'CFP4 (100GE)'], [1550, 'Cisco CPAK (100GE)'], [1600, 'QSFP28 (100GE)']]], ['Wireless', [[2600, 'IEEE 802.11a'], [2610, 'IEEE 802.11b/g'], [2620, 'IEEE 802.11n'], [2630, 'IEEE 802.11ac'], [2640, 'IEEE 802.11ad']]], ['FibreChannel', [[3010, 'SFP (1GFC)'], [3020, 'SFP (2GFC)'], [3040, 'SFP (4GFC)'], [3080, 'SFP+ (8GFC)'], [3160, 'SFP+ (16GFC)']]], ['Serial', [[4000, 'T1 (1.544 Mbps)'], [4010, 'E1 (2.048 Mbps)'], [4040, 'T3 (45 Mbps)'], [4050, 'E3 (34 Mbps)'], [4060, 'RJ45'], [4070, 'DE9'], [4080, 'DB25']]], ['Stacking', [[5000, 'Cisco StackWise'], [5050, 'Cisco StackWise Plus'], [5100, 'Cisco FlexStack'], [5150, 'Cisco FlexStack Plus'], [5200, 'Juniper VCP']]], ['Other', [[32767, 'Other']]]], default=1200),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='interfacetemplate',
|
||||
name='form_factor',
|
||||
field=models.PositiveSmallIntegerField(choices=[['Virtual interfaces', [[0, 'Virtual'], [200, 'Link Aggregation Group (LAG)']]], ['Ethernet (fixed)', [[800, '100BASE-TX (10/100ME)'], [1000, '1000BASE-T (1GE)'], [1150, '10GBASE-T (10GE)'], [1170, '10GBASE-CX4 (10GE)']]], ['Ethernet (modular)', [[1050, 'GBIC (1GE)'], [1100, 'SFP (1GE)'], [1200, 'SFP+ (10GE)'], [1300, 'XFP (10GE)'], [1310, 'XENPAK (10GE)'], [1320, 'X2 (10GE)'], [1350, 'SFP28 (25GE)'], [1400, 'QSFP+ (40GE)'], [1500, 'CFP (100GE)'], [1510, 'CFP2 (100GE)'], [1520, 'CFP4 (100GE)'], [1550, 'Cisco CPAK (100GE)'], [1600, 'QSFP28 (100GE)']]], ['Wireless', [[2600, 'IEEE 802.11a'], [2610, 'IEEE 802.11b/g'], [2620, 'IEEE 802.11n'], [2630, 'IEEE 802.11ac'], [2640, 'IEEE 802.11ad']]], ['FibreChannel', [[3010, 'SFP (1GFC)'], [3020, 'SFP (2GFC)'], [3040, 'SFP (4GFC)'], [3080, 'SFP+ (8GFC)'], [3160, 'SFP+ (16GFC)']]], ['Serial', [[4000, 'T1 (1.544 Mbps)'], [4010, 'E1 (2.048 Mbps)'], [4040, 'T3 (45 Mbps)'], [4050, 'E3 (34 Mbps)'], [4060, 'RJ45'], [4070, 'DE9'], [4080, 'DB25']]], ['Stacking', [[5000, 'Cisco StackWise'], [5050, 'Cisco StackWise Plus'], [5100, 'Cisco FlexStack'], [5150, 'Cisco FlexStack Plus'], [5200, 'Juniper VCP']]], ['Other', [[32767, 'Other']]]], default=1200),
|
||||
),
|
||||
]
|
@ -1070,7 +1070,7 @@ class ConsolePort(models.Model):
|
||||
verbose_name='Console server port', blank=True, null=True)
|
||||
connection_status = models.NullBooleanField(choices=CONNECTION_STATUS_CHOICES, default=CONNECTION_STATUS_CONNECTED)
|
||||
|
||||
csv_headers = ['console_server', 'cs_port', 'device', 'console_port', 'connection_status']
|
||||
csv_headers = ['console_server', 'cs_port', 'device', 'console_port', 'form_factor', 'connection_status']
|
||||
|
||||
class Meta:
|
||||
ordering = ['device', 'name']
|
||||
|
@ -2,6 +2,9 @@
|
||||
<td>
|
||||
<i class="fa fa-fw fa-keyboard-o"></i> {{ cp }}
|
||||
</td>
|
||||
<td>
|
||||
<span class="text-muted">{{ cp.get_form_factor_display }}</span>
|
||||
</td>
|
||||
{% if cp.cs_port %}
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=cp.cs_port.device.pk %}">{{ cp.cs_port.device }}</a>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<i class="fa fa-fw fa-bolt"></i> {{ pp }}
|
||||
</td>
|
||||
{% if pp.power_outlet %}
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="{% url 'dcim:device' pk=pp.power_outlet.device.pk %}">{{ pp.power_outlet.device }}</a>
|
||||
</td>
|
||||
@ -10,6 +11,7 @@
|
||||
{{ pp.power_outlet }}
|
||||
</td>
|
||||
{% else %}
|
||||
<td></td>
|
||||
<td colspan="2">
|
||||
<span class="text-muted">Not connected</span>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user