1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#7852: Extend VRF assignment to VM interfaces

This commit is contained in:
jeremystretch
2022-02-07 09:46:38 -05:00
parent 5fea012eab
commit 3651ef53e3
17 changed files with 137 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
from dcim.choices import InterfaceModeChoices
from dcim.models import DeviceRole, Platform, Site
from ipam.models import VRF
from netbox.forms import NetBoxModelCSVForm
from tenancy.models import Tenant
from utilities.forms import CSVChoiceField, CSVModelChoiceField, SlugField
@@ -121,11 +122,18 @@ class VMInterfaceCSVForm(NetBoxModelCSVForm):
required=False,
help_text='IEEE 802.1Q operational mode (for L2 interfaces)'
)
vrf = CSVModelChoiceField(
queryset=VRF.objects.all(),
required=False,
to_field_name='rd',
help_text='Assigned VRF'
)
class Meta:
model = VMInterface
fields = (
'virtual_machine', 'name', 'parent', 'bridge', 'enabled', 'mac_address', 'mtu', 'description', 'mode',
'vrf',
)
def clean_enabled(self):