Skip to content

Commit a173083

Browse files
committed
Closes #7606: Model transmit power for interfaces
1 parent 33c0c8c commit a173083

File tree

15 files changed

+51
-17
lines changed

15 files changed

+51
-17
lines changed

docs/release-notes/version-3.1.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
### Breaking Changes
77

88
* The `tenant` and `tenant_id` filters for the Cable model now filter on the tenant assigned directly to each cable, rather than on the parent object of either termination.
9-
* The `cable_peer` and `cable_peer_type` attributes of the interface model has been renamed to `link_peer` and `link_peer_type`, respectively, to accommodate wireless links.
9+
* The `cable_peer` and `cable_peer_type` attributes of cable termination models have been renamed to `link_peer` and `link_peer_type`, respectively, to accommodate wireless links between interfaces.
1010

1111
### New Features
1212

@@ -68,6 +68,7 @@ Multiple interfaces can be bridged to a single virtual interface to effect a bri
6868
* [#6874](https://github.com/netbox-community/netbox/issues/6874) - Add tenant assignment for locations
6969
* [#7354](https://github.com/netbox-community/netbox/issues/7354) - Relax uniqueness constraints on region, site group, and location names
7070
* [#7530](https://github.com/netbox-community/netbox/issues/7530) - Move device type component lists to separate views
71+
* [#7606](https://github.com/netbox-community/netbox/issues/7606) - Model transmit power for interfaces
7172

7273
### Other Changes
7374

@@ -113,6 +114,7 @@ Multiple interfaces can be bridged to a single virtual interface to effect a bri
113114
* Added `rf_channel` field
114115
* Added `rf_channel_frequency` field
115116
* Added `rf_chanel_width` field
117+
* Added `tx_power` field
116118
* Added `wwn` field
117119
* `cable_peer` has been renamed to `link_peer`
118120
* `cable_peer_type` has been renamed to `link_peer_type`

netbox/dcim/api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ class Meta:
628628
fields = [
629629
'id', 'url', 'display', 'device', 'name', 'label', 'type', 'enabled', 'parent', 'bridge', 'lag', 'mtu',
630630
'mac_address', 'wwn', 'mgmt_only', 'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency',
631-
'rf_channel_width', 'untagged_vlan', 'tagged_vlans', 'mark_connected', 'cable', 'wireless_link',
631+
'rf_channel_width', 'tx_power', 'untagged_vlan', 'tagged_vlans', 'mark_connected', 'cable', 'wireless_link',
632632
'link_peer', 'link_peer_type', 'connected_endpoint', 'connected_endpoint_type',
633633
'connected_endpoint_reachable', 'tags', 'custom_fields', 'created', 'last_updated', 'count_ipaddresses',
634634
'_occupied',

netbox/dcim/filtersets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ class Meta:
10111011
model = Interface
10121012
fields = [
10131013
'id', 'name', 'label', 'type', 'enabled', 'mtu', 'mgmt_only', 'mode', 'rf_role', 'rf_channel',
1014-
'rf_channel_frequency', 'rf_channel_width', 'description',
1014+
'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description',
10151015
]
10161016

10171017
def filter_device(self, queryset, name, value):

netbox/dcim/forms/bulk_edit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ def __init__(self, *args, **kwargs):
940940
class InterfaceBulkEditForm(
941941
form_from_model(Interface, [
942942
'label', 'type', 'parent', 'bridge', 'lag', 'mac_address', 'wwn', 'mtu', 'mgmt_only', 'mark_connected',
943-
'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width',
943+
'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power',
944944
]),
945945
BootstrapMixin,
946946
AddRemoveTagsForm,
@@ -996,7 +996,7 @@ class InterfaceBulkEditForm(
996996
class Meta:
997997
nullable_fields = [
998998
'label', 'parent', 'bridge', 'lag', 'mac_address', 'wwn', 'mtu', 'description', 'mode', 'rf_channel',
999-
'rf_channel_frequency', 'rf_channel_width', 'untagged_vlan', 'tagged_vlans',
999+
'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'untagged_vlan', 'tagged_vlans',
10001000
]
10011001

10021002
def __init__(self, *args, **kwargs):

netbox/dcim/forms/bulk_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ class Meta:
602602
fields = (
603603
'device', 'name', 'label', 'parent', 'bridge', 'lag', 'type', 'enabled', 'mark_connected', 'mac_address',
604604
'wwn', 'mtu', 'mgmt_only', 'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency',
605-
'rf_channel_width',
605+
'rf_channel_width', 'tx_power',
606606
)
607607

608608
def clean_enabled(self):

netbox/dcim/forms/filtersets.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ class InterfaceFilterForm(DeviceComponentFilterForm):
957957
field_groups = [
958958
['q', 'tag'],
959959
['name', 'label', 'kind', 'type', 'enabled', 'mgmt_only', 'mac_address', 'wwn'],
960-
['rf_role', 'rf_channel', 'rf_channel_width'],
960+
['rf_role', 'rf_channel', 'rf_channel_width', 'tx_power'],
961961
['region_id', 'site_group_id', 'site_id', 'location_id', 'device_id'],
962962
]
963963
kind = forms.MultipleChoiceField(
@@ -1010,6 +1010,12 @@ class InterfaceFilterForm(DeviceComponentFilterForm):
10101010
required=False,
10111011
label='Channel width (MHz)'
10121012
)
1013+
tx_power = forms.IntegerField(
1014+
required=False,
1015+
label='Transmit power (dBm)',
1016+
min_value=0,
1017+
max_value=127
1018+
)
10131019
tag = TagFilterField(model)
10141020

10151021

netbox/dcim/forms/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ class Meta:
11501150
fields = [
11511151
'device', 'name', 'label', 'type', 'enabled', 'parent', 'bridge', 'lag', 'mac_address', 'wwn', 'mtu',
11521152
'mgmt_only', 'mark_connected', 'description', 'mode', 'rf_role', 'rf_channel', 'rf_channel_frequency',
1153-
'rf_channel_width', 'wireless_lans', 'untagged_vlan', 'tagged_vlans', 'tags',
1153+
'rf_channel_width', 'tx_power', 'wireless_lans', 'untagged_vlan', 'tagged_vlans', 'tags',
11541154
]
11551155
widgets = {
11561156
'device': forms.HiddenInput(),

netbox/dcim/migrations/0140_wireless.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.db import migrations, models
2+
import django.core.validators
23
import django.db.models.deletion
34

45

@@ -30,6 +31,11 @@ class Migration(migrations.Migration):
3031
name='rf_channel_width',
3132
field=models.DecimalField(blank=True, decimal_places=3, max_digits=7, null=True),
3233
),
34+
migrations.AddField(
35+
model_name='interface',
36+
name='tx_power',
37+
field=models.PositiveSmallIntegerField(blank=True, null=True, validators=[django.core.validators.MaxValueValidator(127)]),
38+
),
3339
migrations.AddField(
3440
model_name='interface',
3541
name='wireless_lans',

netbox/dcim/models/device_components.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,12 @@ class Interface(ComponentModel, BaseInterface, LinkTermination, PathEndpoint):
560560
null=True,
561561
verbose_name='Channel width (MHz)'
562562
)
563+
tx_power = models.PositiveSmallIntegerField(
564+
blank=True,
565+
null=True,
566+
validators=(MaxValueValidator(127),),
567+
verbose_name='Transmit power (dBm)'
568+
)
563569
wireless_link = models.ForeignKey(
564570
to='wireless.WirelessLink',
565571
on_delete=models.SET_NULL,

netbox/dcim/tables/devices.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ class Meta(DeviceComponentTable.Meta):
498498
model = Interface
499499
fields = (
500500
'pk', 'name', 'device', 'label', 'enabled', 'type', 'mgmt_only', 'mtu', 'mode', 'mac_address', 'wwn',
501-
'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'description', 'mark_connected',
502-
'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'ip_addresses',
503-
'untagged_vlan', 'tagged_vlans',
501+
'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description',
502+
'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection',
503+
'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans',
504504
)
505505
default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description')
506506

@@ -533,9 +533,9 @@ class Meta(DeviceComponentTable.Meta):
533533
model = Interface
534534
fields = (
535535
'pk', 'name', 'label', 'enabled', 'type', 'parent', 'bridge', 'lag', 'mgmt_only', 'mtu', 'mode',
536-
'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_width', 'description', 'mark_connected', 'cable',
537-
'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'ip_addresses',
538-
'untagged_vlan', 'tagged_vlans', 'actions',
536+
'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_width', 'tx_power', 'description',
537+
'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection',
538+
'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions',
539539
)
540540
order_by = ('name',)
541541
default_columns = (

0 commit comments

Comments
 (0)