mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
822 bulk import of device components (#3711)
Closes #822: CSV import for device components * Implement CSV import for netbox-community#822 * Comment out default_return_url until there is a proper target * Fix the default value of `enabled` when not included in the import * rear_port is definitely required here * Power Ports don't have a type (yet) * Add import for console-ports and console-server-ports * Add import for device-bays
This commit is contained in:
committed by
Jeremy Stretch
parent
f3a41df395
commit
adb25fd7d7
@@ -426,6 +426,15 @@ class ConsolePortTemplateTable(BaseTable):
|
||||
empty_text = "None"
|
||||
|
||||
|
||||
class ConsolePortImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = ConsolePort
|
||||
fields = ('device', 'name', 'description')
|
||||
empty_text = False
|
||||
|
||||
|
||||
class ConsoleServerPortTemplateTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
actions = tables.TemplateColumn(
|
||||
@@ -440,6 +449,15 @@ class ConsoleServerPortTemplateTable(BaseTable):
|
||||
empty_text = "None"
|
||||
|
||||
|
||||
class ConsoleServerPortImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = ConsoleServerPort
|
||||
fields = ('device', 'name', 'description')
|
||||
empty_text = False
|
||||
|
||||
|
||||
class PowerPortTemplateTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
actions = tables.TemplateColumn(
|
||||
@@ -454,6 +472,15 @@ class PowerPortTemplateTable(BaseTable):
|
||||
empty_text = "None"
|
||||
|
||||
|
||||
class PowerPortImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = PowerPort
|
||||
fields = ('device', 'name', 'description', 'maximum_draw', 'allocated_draw')
|
||||
empty_text = False
|
||||
|
||||
|
||||
class PowerOutletTemplateTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
actions = tables.TemplateColumn(
|
||||
@@ -468,6 +495,15 @@ class PowerOutletTemplateTable(BaseTable):
|
||||
empty_text = "None"
|
||||
|
||||
|
||||
class PowerOutletImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = PowerOutlet
|
||||
fields = ('device', 'name', 'description', 'power_port', 'feed_leg')
|
||||
empty_text = False
|
||||
|
||||
|
||||
class InterfaceTemplateTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
mgmt_only = tables.TemplateColumn("{% if value %}OOB Management{% endif %}")
|
||||
@@ -483,6 +519,16 @@ class InterfaceTemplateTable(BaseTable):
|
||||
empty_text = "None"
|
||||
|
||||
|
||||
class InterfaceImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
virtual_machine = tables.LinkColumn('virtualization:virtualmachine', args=[Accessor('virtual_machine.pk')], verbose_name='Virtual Machine')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = Interface
|
||||
fields = ('device', 'virtual_machine', 'name', 'description', 'lag', 'type', 'enabled', 'mac_address', 'mtu', 'mgmt_only', 'mode')
|
||||
empty_text = False
|
||||
|
||||
|
||||
class FrontPortTemplateTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
rear_port_position = tables.Column(
|
||||
@@ -500,6 +546,15 @@ class FrontPortTemplateTable(BaseTable):
|
||||
empty_text = "None"
|
||||
|
||||
|
||||
class FrontPortImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = FrontPort
|
||||
fields = ('device', 'name', 'description', 'type', 'rear_port', 'rear_port_position')
|
||||
empty_text = False
|
||||
|
||||
|
||||
class RearPortTemplateTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
actions = tables.TemplateColumn(
|
||||
@@ -514,6 +569,15 @@ class RearPortTemplateTable(BaseTable):
|
||||
empty_text = "None"
|
||||
|
||||
|
||||
class RearPortImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = RearPort
|
||||
fields = ('device', 'name', 'description', 'type', 'position')
|
||||
empty_text = False
|
||||
|
||||
|
||||
class DeviceBayTemplateTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
actions = tables.TemplateColumn(
|
||||
@@ -701,6 +765,16 @@ class DeviceBayTable(BaseTable):
|
||||
fields = ('name',)
|
||||
|
||||
|
||||
class DeviceBayImportTable(BaseTable):
|
||||
device = tables.LinkColumn('dcim:device', args=[Accessor('device.pk')], verbose_name='Device')
|
||||
installed_device = tables.LinkColumn('dcim:device', args=[Accessor('installed_device.pk')], verbose_name='Installed Device')
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = DeviceBay
|
||||
fields = ('device', 'name', 'installed_device', 'description')
|
||||
empty_text = False
|
||||
|
||||
|
||||
#
|
||||
# Cables
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user