diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 70b297366..d00095b83 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -557,6 +557,12 @@ class BaseInterfaceTable(NetBoxTable): orderable=False, verbose_name=_('IP Addresses') ) + virtual_ips = tables.TemplateColumn( + accessor=Accessor('fhrp_group_assignments'), + template_code=INTERFACE_VIRTUAL_IPS, + orderable=False, + verbose_name=_('Virtual IPs') + ) fhrp_groups = tables.TemplateColumn( accessor=Accessor('fhrp_group_assignments'), template_code=INTERFACE_FHRPGROUPS, @@ -637,7 +643,7 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi 'speed', 'speed_formatted', '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', 'vdcs', 'vrf', 'l2vpn', - 'tunnel', 'ip_addresses', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'inventory_items', 'created', + 'tunnel', 'ip_addresses', 'virtual_ips', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'inventory_items', 'created', 'last_updated', ) default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type', 'description') @@ -674,7 +680,7 @@ 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', 'vdcs', 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', + 'wireless_lans', 'link_peer', 'connection', 'tags', 'vdcs', 'vrf', 'l2vpn', 'tunnel', 'ip_addresses', 'virtual_ips', 'fhrp_groups', 'untagged_vlan', 'tagged_vlans', 'actions', ) default_columns = ( diff --git a/netbox/dcim/tables/template_code.py b/netbox/dcim/tables/template_code.py index 96ab803e6..ce15457e4 100644 --- a/netbox/dcim/tables/template_code.py +++ b/netbox/dcim/tables/template_code.py @@ -48,6 +48,18 @@ INTERFACE_IPADDRESSES = """ {% endif %} """ +INTERFACE_VIRTUAL_IPS = """ + {% for fhrp_assignment in value.all %} + {% for ip in fhrp_assignment.group.ip_addresses.all %} + {% if ip.status != 'active' %} + {{ ip }} + {% else %} + {{ ip }} + {% endif %} + {% endfor %} + {% endfor %} +""" + INTERFACE_FHRPGROUPS = """ {% for assignment in value.all %} {{ assignment.group.get_protocol_display }}: {{ assignment.group.group_id }}