From 2acfda3dc53ad5566baca1b7c3c6f57284dc759e Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 2 Sep 2022 14:26:35 -0400 Subject: [PATCH] Fixes #10034: Add L2VPN column to interface and VLAN tables --- docs/release-notes/version-3.3.md | 1 + netbox/dcim/tables/devices.py | 14 ++++++++++---- netbox/ipam/tables/vlans.py | 10 ++++++++-- netbox/virtualization/tables/virtualmachines.py | 4 ++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/release-notes/version-3.3.md b/docs/release-notes/version-3.3.md index ebbb4ca98..49a403a45 100644 --- a/docs/release-notes/version-3.3.md +++ b/docs/release-notes/version-3.3.md @@ -5,6 +5,7 @@ ### Enhancements * [#9477](https://github.com/netbox-community/netbox/issues/9477) - Enable clearing applied table column ordering +* [#10034](https://github.com/netbox-community/netbox/issues/10034) - Add L2VPN column to interface and VLAN tables * [#10043](https://github.com/netbox-community/netbox/issues/10043) - Add support for `limit` query parameter to available VLANs API endpoint * [#10060](https://github.com/netbox-community/netbox/issues/10060) - Add journal entries to global search * [#10195](https://github.com/netbox-community/netbox/issues/10195) - Enable filtering of device components by rack diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index c1515a15f..036f83306 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -483,6 +483,12 @@ class BaseInterfaceTable(NetBoxTable): orderable=False, verbose_name='FHRP Groups' ) + l2vpn = tables.Column( + accessor=tables.A('l2vpn_termination__l2vpn'), + linkify=True, + orderable=False, + verbose_name='L2VPN' + ) untagged_vlan = tables.Column(linkify=True) tagged_vlans = columns.TemplateColumn( template_code=INTERFACE_TAGGED_VLANS, @@ -520,8 +526,8 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi 'pk', 'id', 'name', 'device', 'module_bay', 'module', 'label', 'enabled', 'type', 'mgmt_only', 'mtu', 'speed', 'duplex', 'mode', 'mac_address', 'wwn', 'poe_mode', 'poe_type', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'mark_connected', 'cable', - 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'vrf', 'ip_addresses', - 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'created', 'last_updated', + 'cable_color', 'wireless_link', 'wireless_lans', 'link_peer', 'connection', 'tags', 'vrf', 'l2vpn', + 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description') @@ -554,8 +560,8 @@ class DeviceInterfaceTable(InterfaceTable): 'pk', 'id', 'name', 'module_bay', 'module', 'label', 'enabled', 'type', 'parent', 'bridge', 'lag', 'mgmt_only', 'mtu', 'mode', 'mac_address', 'wwn', 'rf_role', 'rf_channel', 'rf_channel_frequency', 'rf_channel_width', 'tx_power', 'description', 'mark_connected', 'cable', 'cable_color', 'wireless_link', - 'wireless_lans', 'link_peer', 'connection', 'tags', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', - 'tagged_vlans', 'actions', + 'wireless_lans', 'link_peer', 'connection', 'tags', 'vrf', 'l2vpn', 'ip_addresses', 'fhrp_groups', + 'untagged_vlan', 'tagged_vlans', 'actions', ) order_by = ('name',) default_columns = ( diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index 00c215344..f183f8a7b 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -110,6 +110,12 @@ class VLANTable(TenancyColumnsMixin, NetBoxTable): role = tables.Column( linkify=True ) + l2vpn = tables.Column( + accessor=tables.A('l2vpn_termination__l2vpn'), + linkify=True, + orderable=False, + verbose_name='L2VPN' + ) prefixes = columns.TemplateColumn( template_code=VLAN_PREFIXES, orderable=False, @@ -122,8 +128,8 @@ class VLANTable(TenancyColumnsMixin, NetBoxTable): class Meta(NetBoxTable.Meta): model = VLAN fields = ( - 'pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'tenant_group', 'status', 'role', 'description', 'tags', - 'created', 'last_updated', + 'pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'tenant_group', 'status', 'role', + 'description', 'tags', 'l2vpn', 'created', 'last_updated', ) default_columns = ('pk', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description') row_attrs = { diff --git a/netbox/virtualization/tables/virtualmachines.py b/netbox/virtualization/tables/virtualmachines.py index 8ee19942b..dfd01696e 100644 --- a/netbox/virtualization/tables/virtualmachines.py +++ b/netbox/virtualization/tables/virtualmachines.py @@ -108,7 +108,7 @@ class VMInterfaceTable(BaseInterfaceTable): model = VMInterface fields = ( 'pk', 'id', 'name', 'virtual_machine', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', - 'vrf', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'created', 'last_updated', + 'vrf', 'l2vpn', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'description') @@ -129,7 +129,7 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable): model = VMInterface fields = ( 'pk', 'id', 'name', 'enabled', 'parent', 'bridge', 'mac_address', 'mtu', 'mode', 'description', 'tags', - 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions', + 'vrf', 'l2vpn', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions', ) default_columns = ('pk', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'ip_addresses') row_attrs = {