Skip to content

Commit cd128e5

Browse files
committed
Closes #7884: Add FHRP groups column to interface tables
1 parent 30a5c70 commit cd128e5

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

docs/release-notes/version-3.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* [#7775](https://github.com/netbox-community/netbox/issues/7775) - Enable dynamic config for `CHANGELOG_RETENTION`, `CUSTOM_VALIDATORS`, and `GRAPHQL_ENABLED`
1515
* [#7812](https://github.com/netbox-community/netbox/issues/7812) - Enable change logging for image attachments
1616
* [#7858](https://github.com/netbox-community/netbox/issues/7858) - Standardize the representation of content types across import & export functions
17+
* [#7884](https://github.com/netbox-community/netbox/issues/7884) - Add FHRP groups column to interface tables
1718

1819
### Bug Fixes
1920

netbox/dcim/tables/devices.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,12 @@ class BaseInterfaceTable(BaseTable):
475475
orderable=False,
476476
verbose_name='IP Addresses'
477477
)
478+
fhrp_groups = tables.TemplateColumn(
479+
accessor=Accessor('fhrp_group_assignments'),
480+
template_code=INTERFACE_FHRPGROUPS,
481+
orderable=False,
482+
verbose_name='FHRP Groups'
483+
)
478484
untagged_vlan = tables.Column(linkify=True)
479485
tagged_vlans = TemplateColumn(
480486
template_code=INTERFACE_TAGGED_VLANS,
@@ -509,7 +515,7 @@ class Meta(DeviceComponentTable.Meta):
509515
'pk', 'id', 'name', 'device', 'label', 'enabled', 'type', 'mgmt_only', 'mtu', 'mode', 'mac_address', 'wwn',
510516
'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description',
511517
'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection',
512-
'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans',
518+
'tags', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans',
513519
)
514520
default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description')
515521

@@ -542,9 +548,9 @@ class Meta(DeviceComponentTable.Meta):
542548
model = Interface
543549
fields = (
544550
'pk', 'id', 'name', 'label', 'enabled', 'type', 'parent', 'bridge', 'lag', 'mgmt_only', 'mtu', 'mode',
545-
'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_width', 'tx_power', 'description',
546-
'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection',
547-
'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions',
551+
'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power',
552+
'description', 'mark_connected', 'cable', 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer',
553+
'connection', 'tags', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions',
548554
)
549555
order_by = ('name',)
550556
default_columns = (

netbox/dcim/tables/template_code.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
</div>
5151
"""
5252

53+
INTERFACE_FHRPGROUPS = """
54+
<div class="table-badge-group">
55+
{% for assignment in value.all %}
56+
<a href="{{ assignment.group.get_absolute_url }}">{{ assignment.group.group_id }} ({{ assignment.group.get_protocol_display }})</a>
57+
{% endfor %}
58+
</div>
59+
"""
60+
5361
INTERFACE_TAGGED_VLANS = """
5462
{% if record.mode == 'tagged' %}
5563
{% for vlan in record.tagged_vlans.all %}

netbox/virtualization/tables.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class Meta(BaseTable.Meta):
171171
model = VMInterface
172172
fields = (
173173
'pk', 'id', 'name', 'virtual_machine', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags',
174-
'ip_addresses', 'untagged_vlan', 'tagged_vlans',
174+
'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans',
175175
)
176176
default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'description')
177177

@@ -193,7 +193,7 @@ class Meta(BaseTable.Meta):
193193
model = VMInterface
194194
fields = (
195195
'pk', 'id', 'name', 'enabled', 'parent', 'bridge', 'mac_address', 'mtu', 'mode', 'description', 'tags',
196-
'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions',
196+
'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions',
197197
)
198198
default_columns = (
199199
'pk', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'ip_addresses', 'actions',

0 commit comments

Comments
 (0)