Repository: netbox-community/netbox

Issue:
Importation of cable with termination to virtual interface an exception is generated
### NetBox version

v3.3.1

### Python version

3.10

### Steps to Reproduce

1. Create Site, Device Type, Device Role to support device creation
2. Create device using previous type, role and site
3. Create 2 virtual interfaces on device
4. Import cable between two interfaces

### Expected Behavior

Import error shown

### Observed Behavior

Exception raised:

```ValueError at /dcim/cables/import/
'CableCSVForm' has no field named 'termination'.
Request Method:	POST
Request URL:	http://127.0.0.1:8000/dcim/cables/import/
Django Version:	4.0.7
Exception Type:	ValueError
Exception Value:	
'CableCSVForm' has no field named 'termination'.
Exception Location:	C:\Development\netbox\venv\lib\site-packages\django\forms\forms.py, line 400, in add_error
Python Executable:	C:\Development\netbox\venv\Scripts\python.exe
Python Version:	3.10.4
Python Path:	
['C:\\Development\\netbox\\netbox\\netbox',
 'C:\\Program Files\\Python\\3.10\\python310.zip',
 'C:\\Program Files\\Python\\3.10\\DLLs',
 'C:\\Program Files\\Python\\3.10\\lib',
 'C:\\Program Files\\Python\\3.10',
 'C:\\Development\\netbox\\venv',
 'C:\\Development\\netbox\\venv\\lib\\site-packages',
 'c:\\development\\netbox\\netbox-routing',
 'c:\\development\\netbox\\netbox-config-backup',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\pydriller-2.1-py3.10.egg',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\dulwich-0.20.35-py3.10-win-amd64.egg',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\uuid-1.30-py3.10.egg',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\lizard-1.17.9-py3.10.egg',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\types_pytz-2021.3.6-py3.10.egg',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\gitpython-3.1.27-py3.10.egg',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\gitdb-4.0.9-py3.10.egg',
 'C:\\Development\\netbox\\venv\\lib\\site-packages\\smmap-5.0.0-py3.10.egg',
 'c:\\development\\netbox\\netbox-sync',
 'c:\\development\\netbox\\netbox-secretstore']
Server time:	Fri, 02 Sep 2022 17:30:30 +0000```


Discussion:

Resolving patch:
diff --git a/netbox/dcim/models/cables.py b/netbox/dcim/models/cables.py
--- a/netbox/dcim/models/cables.py
+++ b/netbox/dcim/models/cables.py
@@ -281,15 +281,11 @@ def clean(self):
 
         # Validate interface type (if applicable)
         if self.termination_type.model == 'interface' and self.termination.type in NONCONNECTABLE_IFACE_TYPES:
-            raise ValidationError({
-                'termination': f'Cables cannot be terminated to {self.termination.get_type_display()} interfaces'
-            })
+            raise ValidationError(f"Cables cannot be terminated to {self.termination.get_type_display()} interfaces")
 
         # A CircuitTermination attached to a ProviderNetwork cannot have a Cable
         if self.termination_type.model == 'circuittermination' and self.termination.provider_network is not None:
-            raise ValidationError({
-                'termination': "Circuit terminations attached to a provider network may not be cabled."
-            })
+            raise ValidationError("Circuit terminations attached to a provider network may not be cabled.")
 
     def save(self, *args, **kwargs):
 


Test patch: