mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Add vlan_translation_table to VMInterface detail page
This commit is contained in:
parent
f396847d54
commit
4b7ab753c1
@ -67,6 +67,10 @@
|
||||
<th scope="row">{% trans "Tunnel" %}</th>
|
||||
<td>{{ object.tunnel_termination.tunnel|linkify|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "VLAN Translation" %}</th>
|
||||
<td>{{ object.vlan_translation_policy|linkify|placeholder }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% include 'inc/panels/tags.html' %}
|
||||
@ -100,6 +104,11 @@
|
||||
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-12">
|
||||
{% include 'inc/panel_table.html' with table=vlan_translation_table heading="VLAN Translation" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-12">
|
||||
{% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
|
||||
|
@ -362,7 +362,7 @@ class VMInterfaceForm(InterfaceCommonForm, VMComponentForm):
|
||||
model = VMInterface
|
||||
fields = [
|
||||
'virtual_machine', 'name', 'parent', 'bridge', 'enabled', 'mac_address', 'mtu', 'description', 'mode',
|
||||
'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vrf', 'tags',
|
||||
'vlan_group', 'untagged_vlan', 'tagged_vlans', 'vrf', 'tags', 'vlan_translation_policy',
|
||||
]
|
||||
labels = {
|
||||
'mode': '802.1Q Mode',
|
||||
|
@ -16,7 +16,7 @@ from dcim.models import Device
|
||||
from dcim.tables import DeviceTable
|
||||
from extras.views import ObjectConfigContextView
|
||||
from ipam.models import IPAddress
|
||||
from ipam.tables import InterfaceVLANTable
|
||||
from ipam.tables import InterfaceVLANTable, InterfaceVLANTranslationTable
|
||||
from netbox.constants import DEFAULT_ACTION_PERMISSIONS
|
||||
from netbox.views import generic
|
||||
from tenancy.views import ObjectContactsView
|
||||
@ -515,6 +515,11 @@ class VMInterfaceView(generic.ObjectView):
|
||||
exclude=('virtual_machine',),
|
||||
orderable=False
|
||||
)
|
||||
vlan_translation_table = InterfaceVLANTranslationTable(
|
||||
interface=instance,
|
||||
data=instance.vlan_translation_policy.rules.all() if instance.vlan_translation_policy else [],
|
||||
orderable=False
|
||||
)
|
||||
|
||||
# Get assigned VLANs and annotate whether each is tagged or untagged
|
||||
vlans = []
|
||||
@ -533,6 +538,7 @@ class VMInterfaceView(generic.ObjectView):
|
||||
return {
|
||||
'child_interfaces_table': child_interfaces_tables,
|
||||
'vlan_table': vlan_table,
|
||||
'vlan_translation_table': vlan_translation_table,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user