mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -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>
|
<th scope="row">{% trans "Tunnel" %}</th>
|
||||||
<td>{{ object.tunnel_termination.tunnel|linkify|placeholder }}</td>
|
<td>{{ object.tunnel_termination.tunnel|linkify|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "VLAN Translation" %}</th>
|
||||||
|
<td>{{ object.vlan_translation_policy|linkify|placeholder }}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% include 'inc/panels/tags.html' %}
|
{% include 'inc/panels/tags.html' %}
|
||||||
@ -100,6 +104,11 @@
|
|||||||
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
|
{% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
|
||||||
</div>
|
</div>
|
||||||
</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="row mb-3">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
{% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
|
{% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
|
||||||
|
@ -362,7 +362,7 @@ class VMInterfaceForm(InterfaceCommonForm, VMComponentForm):
|
|||||||
model = VMInterface
|
model = VMInterface
|
||||||
fields = [
|
fields = [
|
||||||
'virtual_machine', 'name', 'parent', 'bridge', 'enabled', 'mac_address', 'mtu', 'description', 'mode',
|
'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 = {
|
labels = {
|
||||||
'mode': '802.1Q Mode',
|
'mode': '802.1Q Mode',
|
||||||
|
@ -16,7 +16,7 @@ from dcim.models import Device
|
|||||||
from dcim.tables import DeviceTable
|
from dcim.tables import DeviceTable
|
||||||
from extras.views import ObjectConfigContextView
|
from extras.views import ObjectConfigContextView
|
||||||
from ipam.models import IPAddress
|
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.constants import DEFAULT_ACTION_PERMISSIONS
|
||||||
from netbox.views import generic
|
from netbox.views import generic
|
||||||
from tenancy.views import ObjectContactsView
|
from tenancy.views import ObjectContactsView
|
||||||
@ -515,6 +515,11 @@ class VMInterfaceView(generic.ObjectView):
|
|||||||
exclude=('virtual_machine',),
|
exclude=('virtual_machine',),
|
||||||
orderable=False
|
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
|
# Get assigned VLANs and annotate whether each is tagged or untagged
|
||||||
vlans = []
|
vlans = []
|
||||||
@ -533,6 +538,7 @@ class VMInterfaceView(generic.ObjectView):
|
|||||||
return {
|
return {
|
||||||
'child_interfaces_table': child_interfaces_tables,
|
'child_interfaces_table': child_interfaces_tables,
|
||||||
'vlan_table': vlan_table,
|
'vlan_table': vlan_table,
|
||||||
|
'vlan_translation_table': vlan_translation_table,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user