diff --git a/docs/release-notes/version-2.7.md b/docs/release-notes/version-2.7.md index 047ee3549..3cf4522a7 100644 --- a/docs/release-notes/version-2.7.md +++ b/docs/release-notes/version-2.7.md @@ -1,5 +1,13 @@ # NetBox v2.7 Release Notes +## v2.7.12 (FUTURE) + +### Enhancements + +* [#3676](https://github.com/netbox-community/netbox/issues/3676) - Reference VRF by name rather than RD during IP/prefix import + +--- + ## v2.7.11 (2020-03-27) ### Enhancements diff --git a/netbox/ipam/forms.py b/netbox/ipam/forms.py index 7a4373fb0..b0f28060d 100644 --- a/netbox/ipam/forms.py +++ b/netbox/ipam/forms.py @@ -335,9 +335,9 @@ class PrefixForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): class PrefixCSVForm(CustomFieldModelCSVForm): vrf = FlexibleModelChoiceField( queryset=VRF.objects.all(), - to_field_name='rd', + to_field_name='name', required=False, - help_text='Route distinguisher of parent VRF (or {ID})', + help_text='Name of parent VRF (or {ID})', error_messages={ 'invalid_choice': 'VRF not found.', } @@ -739,9 +739,9 @@ class IPAddressBulkAddForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): class IPAddressCSVForm(CustomFieldModelCSVForm): vrf = FlexibleModelChoiceField( queryset=VRF.objects.all(), - to_field_name='rd', + to_field_name='name', required=False, - help_text='Route distinguisher of parent VRF (or {ID})', + help_text='Name of parent VRF (or {ID})', error_messages={ 'invalid_choice': 'VRF not found.', } diff --git a/netbox/ipam/tests/test_views.py b/netbox/ipam/tests/test_views.py index ba9db74f7..5c48cccfd 100644 --- a/netbox/ipam/tests/test_views.py +++ b/netbox/ipam/tests/test_views.py @@ -180,10 +180,10 @@ class PrefixTestCase(ViewTestCases.PrimaryObjectViewTestCase): } cls.csv_data = ( - "prefix,status", - "10.4.0.0/16,Active", - "10.5.0.0/16,Active", - "10.6.0.0/16,Active", + "vrf,prefix,status", + "VRF 1,10.4.0.0/16,Active", + "VRF 1,10.5.0.0/16,Active", + "VRF 1,10.6.0.0/16,Active", ) cls.bulk_edit_data = { @@ -207,6 +207,7 @@ class IPAddressTestCase(ViewTestCases.PrimaryObjectViewTestCase): VRF(name='VRF 1', rd='65000:1'), VRF(name='VRF 2', rd='65000:2'), ) + VRF.objects.bulk_create(vrfs) IPAddress.objects.bulk_create([ IPAddress(family=4, address=IPNetwork('192.0.2.1/24'), vrf=vrfs[0]), @@ -228,10 +229,10 @@ class IPAddressTestCase(ViewTestCases.PrimaryObjectViewTestCase): } cls.csv_data = ( - "address,status", - "192.0.2.4/24,Active", - "192.0.2.5/24,Active", - "192.0.2.6/24,Active", + "vrf,address,status", + "VRF 1,192.0.2.4/24,Active", + "VRF 1,192.0.2.5/24,Active", + "VRF 1,192.0.2.6/24,Active", ) cls.bulk_edit_data = {