1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#8157: Clean up L2VPN assignment for VM interfaces

This commit is contained in:
jeremystretch
2022-07-06 13:31:31 -04:00
parent 5fd3eb82cd
commit 4d3278cb52
4 changed files with 21 additions and 8 deletions

View File

@ -440,6 +440,12 @@ class VMInterface(NetBoxModel, BaseInterface):
object_id_field='interface_id',
related_query_name='+'
)
l2vpn_terminations = GenericRelation(
to='ipam.L2VPNTermination',
content_type_field='assigned_object_type',
object_id_field='assigned_object_id',
related_query_name='vminterface',
)
class Meta:
verbose_name = 'interface'
@ -498,3 +504,7 @@ class VMInterface(NetBoxModel, BaseInterface):
@property
def parent_object(self):
return self.virtual_machine
@property
def l2vpn_termination(self):
return self.l2vpn_terminations.first()