Repository: netbox-community/netbox

Issue:
Typo: TunnelTerminationTypeChoices.TYPE_VIRUTALMACHINE
### Deployment Type

Self-hosted

### NetBox Version

v3.7.0

### Python Version

3.9

### Steps to Reproduce

Look at https://github.com/netbox-community/netbox/blob/c78a792cccfdbe6f373c0d474b1620e56e5f9cf8/netbox/vpn/choices.py#L41

### Expected Behavior

One of the choices is `TYPE_VIRTUALMACHINE`

### Observed Behavior

One of the choices is `TYPE_VIRUTALMACHINE`


Discussion:

Resolving patch:
diff --git a/netbox/vpn/choices.py b/netbox/vpn/choices.py
--- a/netbox/vpn/choices.py
+++ b/netbox/vpn/choices.py
@@ -38,11 +38,11 @@ class TunnelEncapsulationChoices(ChoiceSet):
 class TunnelTerminationTypeChoices(ChoiceSet):
     # For TunnelCreateForm
     TYPE_DEVICE = 'dcim.device'
-    TYPE_VIRUTALMACHINE = 'virtualization.virtualmachine'
+    TYPE_VIRTUALMACHINE = 'virtualization.virtualmachine'
 
     CHOICES = (
         (TYPE_DEVICE, _('Device')),
-        (TYPE_VIRUTALMACHINE, _('Virtual Machine')),
+        (TYPE_VIRTUALMACHINE, _('Virtual Machine')),
     )
 
 
diff --git a/netbox/vpn/forms/model_forms.py b/netbox/vpn/forms/model_forms.py
--- a/netbox/vpn/forms/model_forms.py
+++ b/netbox/vpn/forms/model_forms.py
@@ -7,7 +7,7 @@
 from netbox.forms import NetBoxModelForm
 from tenancy.forms import TenancyForm
 from utilities.forms.fields import CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField
-from utilities.forms.utils import add_blank_choice
+from utilities.forms.utils import add_blank_choice, get_field_value
 from utilities.forms.widgets import HTMXSelect
 from virtualization.models import VirtualMachine, VMInterface
 from vpn.choices import *
@@ -157,7 +157,7 @@ class TunnelCreateForm(TunnelForm):
     def __init__(self, *args, initial=None, **kwargs):
         super().__init__(*args, initial=initial, **kwargs)
 
-        if initial and initial.get('termination1_type') == TunnelTerminationTypeChoices.TYPE_VIRUTALMACHINE:
+        if get_field_value(self, 'termination1_type') == TunnelTerminationTypeChoices.TYPE_VIRTUALMACHINE:
             self.fields['termination1_parent'].label = _('Virtual Machine')
             self.fields['termination1_parent'].queryset = VirtualMachine.objects.all()
             self.fields['termination1_termination'].queryset = VMInterface.objects.all()
@@ -168,7 +168,7 @@ def __init__(self, *args, initial=None, **kwargs):
                 'virtual_machine_id': '$termination1_parent',
             })
 
-        if initial and initial.get('termination2_type') == TunnelTerminationTypeChoices.TYPE_VIRUTALMACHINE:
+        if get_field_value(self, 'termination2_type') == TunnelTerminationTypeChoices.TYPE_VIRTUALMACHINE:
             self.fields['termination2_parent'].label = _('Virtual Machine')
             self.fields['termination2_parent'].queryset = VirtualMachine.objects.all()
             self.fields['termination2_termination'].queryset = VMInterface.objects.all()
@@ -265,7 +265,7 @@ class Meta:
     def __init__(self, *args, initial=None, **kwargs):
         super().__init__(*args, initial=initial, **kwargs)
 
-        if initial and initial.get('type') == TunnelTerminationTypeChoices.TYPE_VIRUTALMACHINE:
+        if initial and initial.get('type') == TunnelTerminationTypeChoices.TYPE_VIRTUALMACHINE:
             self.fields['parent'].label = _('Virtual Machine')
             self.fields['parent'].queryset = VirtualMachine.objects.all()
             self.fields['termination'].queryset = VMInterface.objects.all()


Test patch: