|
|
@@ -327,6 +327,13 @@ class IPAddressImportForm(NetBoxModelImportForm):
|
|
|
to_field_name='name',
|
|
|
help_text=_('Assigned interface')
|
|
|
)
|
|
|
+ fhrp_group = CSVModelChoiceField(
|
|
|
+ label=_('FHRP Group'),
|
|
|
+ queryset=FHRPGroup.objects.all(),
|
|
|
+ required=False,
|
|
|
+ to_field_name='name',
|
|
|
+ help_text=_('Assigned FHRP Group name')
|
|
|
+ )
|
|
|
is_primary = forms.BooleanField(
|
|
|
label=_('Is primary'),
|
|
|
help_text=_('Make this the primary IP for the assigned device'),
|
|
|
@@ -341,8 +348,8 @@ class IPAddressImportForm(NetBoxModelImportForm):
|
|
|
class Meta:
|
|
|
model = IPAddress
|
|
|
fields = [
|
|
|
- 'address', 'vrf', 'tenant', 'status', 'role', 'device', 'virtual_machine', 'interface', 'is_primary',
|
|
|
- 'is_oob', 'dns_name', 'description', 'comments', 'tags',
|
|
|
+ 'address', 'vrf', 'tenant', 'status', 'role', 'device', 'virtual_machine', 'interface', 'fhrp_group',
|
|
|
+ 'is_primary', 'is_oob', 'dns_name', 'description', 'comments', 'tags',
|
|
|
]
|
|
|
|
|
|
def __init__(self, data=None, *args, **kwargs):
|
|
|
@@ -398,6 +405,8 @@ class IPAddressImportForm(NetBoxModelImportForm):
|
|
|
# Set interface assignment
|
|
|
if self.cleaned_data.get('interface'):
|
|
|
self.instance.assigned_object = self.cleaned_data['interface']
|
|
|
+ if self.cleaned_data.get('fhrp_group'):
|
|
|
+ self.instance.assigned_object = self.cleaned_data['fhrp_group']
|
|
|
|
|
|
ipaddress = super().save(*args, **kwargs)
|
|
|
|