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

Add RF channel fields to Interface

This commit is contained in:
jeremystretch
2021-10-12 10:46:41 -04:00
parent 3e7922e41e
commit 8e1535f7ec
14 changed files with 236 additions and 13 deletions

View File

@@ -926,7 +926,7 @@ class PowerOutletBulkEditForm(
class InterfaceBulkEditForm(
form_from_model(Interface, [
'label', 'type', 'parent', 'lag', 'mac_address', 'wwn', 'mtu', 'mgmt_only', 'mark_connected', 'description',
'mode',
'mode', 'rf_channel', 'rf_channel_width',
]),
BootstrapMixin,
AddRemoveTagsForm,
@@ -977,8 +977,8 @@ class InterfaceBulkEditForm(
class Meta:
nullable_fields = [
'label', 'parent', 'lag', 'mac_address', 'wwn', 'mtu', 'description', 'mode', 'untagged_vlan',
'tagged_vlans',
'label', 'parent', 'lag', 'mac_address', 'wwn', 'mtu', 'description', 'mode', 'rf_channel',
'rf_channel_width', 'untagged_vlan', 'tagged_vlans',
]
def __init__(self, *args, **kwargs):

View File

@@ -584,7 +584,7 @@ class InterfaceCSVForm(CustomFieldModelCSVForm):
model = Interface
fields = (
'device', 'name', 'label', 'parent', 'lag', 'type', 'enabled', 'mark_connected', 'mac_address', 'wwn',
'mtu', 'mgmt_only', 'description', 'mode',
'mtu', 'mgmt_only', 'description', 'mode', 'rf_channel', 'rf_channel_width',
)
def __init__(self, *args, **kwargs):

View File

@@ -963,6 +963,7 @@ class InterfaceFilterForm(DeviceComponentFilterForm):
field_groups = [
['q', 'tag'],
['name', 'label', 'type', 'enabled', 'mgmt_only', 'mac_address', 'wwn'],
['rf_channel', 'rf_channel_width'],
['region_id', 'site_group_id', 'site_id', 'location_id', 'device_id'],
]
type = forms.MultipleChoiceField(
@@ -990,6 +991,16 @@ class InterfaceFilterForm(DeviceComponentFilterForm):
required=False,
label='WWN'
)
rf_channel = forms.MultipleChoiceField(
choices=WirelessChannelChoices,
required=False,
widget=StaticSelectMultiple()
)
rf_channel_width = forms.MultipleChoiceField(
choices=WirelessChannelWidthChoices,
required=False,
widget=StaticSelectMultiple()
)
tag = TagFilterField(model)

View File

@@ -1098,12 +1098,15 @@ class InterfaceForm(BootstrapMixin, InterfaceCommonForm, CustomFieldModelForm):
model = Interface
fields = [
'device', 'name', 'label', 'type', 'enabled', 'parent', 'lag', 'mac_address', 'wwn', 'mtu', 'mgmt_only',
'mark_connected', 'description', 'mode', 'untagged_vlan', 'tagged_vlans', 'tags',
'mark_connected', 'description', 'mode', 'rf_channel', 'rf_channel_width', 'untagged_vlan', 'tagged_vlans',
'tags',
]
widgets = {
'device': forms.HiddenInput(),
'type': StaticSelect(),
'mode': StaticSelect(),
'rf_channel': StaticSelect(),
'rf_channel_width': StaticSelect(),
}
labels = {
'mode': '802.1Q Mode',

View File

@@ -465,7 +465,19 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
mode = forms.ChoiceField(
choices=add_blank_choice(InterfaceModeChoices),
required=False,
widget=StaticSelect()
)
rf_channel = forms.ChoiceField(
choices=add_blank_choice(WirelessChannelChoices),
required=False,
widget=StaticSelect(),
label='Wireless channel'
)
rf_channel_width = forms.ChoiceField(
choices=add_blank_choice(WirelessChannelWidthChoices),
required=False,
widget=StaticSelect(),
label='Channel width'
)
untagged_vlan = DynamicModelChoiceField(
queryset=VLAN.objects.all(),
@@ -477,7 +489,8 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
)
field_order = (
'device', 'name_pattern', 'label_pattern', 'type', 'enabled', 'parent', 'lag', 'mtu', 'mac_address',
'description', 'mgmt_only', 'mark_connected', 'mode', 'untagged_vlan', 'tagged_vlans', 'tags'
'description', 'mgmt_only', 'mark_connected', 'rf_channel', 'rf_channel_width', 'mode' 'untagged_vlan',
'tagged_vlans', 'tags'
)
def __init__(self, *args, **kwargs):