mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Move L2VPN and L2VPNTermination models from ipam to vpn * Move L2VPN resources from ipam to vpn * Extend migration to update content types * Misc cleanup
31 lines
751 B
Python
31 lines
751 B
Python
import graphene
|
|
|
|
from dcim.graphql.types import InterfaceType
|
|
from dcim.models import Interface
|
|
from ipam.graphql.types import VLANType
|
|
from ipam.models import VLAN
|
|
from virtualization.graphql.types import VMInterfaceType
|
|
from virtualization.models import VMInterface
|
|
|
|
__all__ = (
|
|
'L2VPNAssignmentType',
|
|
)
|
|
|
|
|
|
class L2VPNAssignmentType(graphene.Union):
|
|
class Meta:
|
|
types = (
|
|
InterfaceType,
|
|
VLANType,
|
|
VMInterfaceType,
|
|
)
|
|
|
|
@classmethod
|
|
def resolve_type(cls, instance, info):
|
|
if type(instance) is Interface:
|
|
return InterfaceType
|
|
if type(instance) is VLAN:
|
|
return VLANType
|
|
if type(instance) is VMInterface:
|
|
return VMInterfaceType
|