
    >Tfh                     6   d dl mZ d dlmZ d dlmZmZmZm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ d dlmZmZmZ d d	lT d d	lT d
Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )    )gettext_lazy)InterfaceModeChoices)Device
DeviceRolePlatformSite)ConfigTemplate)VRF)NetBoxModelImportForm)Tenant)CSVChoiceFieldCSVModelChoiceField	SlugField)*)ClusterImportFormClusterGroupImportFormClusterTypeImportFormVirtualDiskImportFormVirtualMachineImportFormVMInterfaceImportFormc                   <    e Zd Z e            Z G d d          ZdS )r   c                       e Zd ZeZdZdS )ClusterTypeImportForm.MetanameslugdescriptiontagsN)__name__
__module____qualname__ClusterTypemodelfields     E/var/www/html/netbox-4.1.3/netbox/virtualization/forms/bulk_import.pyMetar      s        8r&   r(   Nr   r    r!   r   r   r(   r%   r&   r'   r   r      G        9;;D9 9 9 9 9 9 9 9 9 9r&   r   c                   <    e Zd Z e            Z G d d          ZdS )r   c                       e Zd ZeZdZdS )ClusterGroupImportForm.Metar   N)r   r    r!   ClusterGroupr#   r$   r%   r&   r'   r(   r-   "   s        8r&   r(   Nr)   r%   r&   r'   r   r      r*   r&   r   c            	       .   e Zd Z e ed          ej                                        d ed                    Z e ed          e	j                                        dd ed                    Z
 e ed	          e ed
                    Z e ed          ej                                        dd ed                    Z e ed          ej                                        dd ed                    Z G d d          ZdS )r   Typer   zType of cluster)labelquerysetto_field_name	help_textGroupFzAssigned cluster groupr1   r2   r3   requiredr4   StatusOperational statusr1   choicesr4   r   Assigned siter   Assigned tenantc                       e Zd ZeZdZdS )ClusterImportForm.Meta)	r   typegroupstatussitetenantr   commentsr   N)r   r    r!   Clusterr#   r$   r%   r&   r'   r(   r?   I   s        ir&   r(   N)r   r    r!   r   _r"   objectsallr@   r.   rA   r   ClusterStatusChoicesrB   r   rC   r   rD   r(   r%   r&   r'   r   r   '   s       aii$((**!%&&	  D  ajj%))++!,--  E ^akk$!())  F
 aii!!##!O$$  D ! akk##%%!%&&  Fj j j j j j j j j jr&   r   c            	          e Zd Z e ed          e ed                    Z e ed          ej	        
                                dd ed                    Z e ed	          ej	        
                                dd ed
                    Z e ed          ej	        
                                dd ed                    Z e ed          ej	                            d          dd ed                    Z e ed          ej	        
                                dd ed                    Z e ed          ej	        
                                dd ed                    Z eej	        
                                dd ed           ed                    Z G d d          ZdS )r   r8   r9   r:   r   r   Fr<   r6   rF   zAssigned clusterr   zAssigned device within clusterRoleT)vm_rolezFunctional roler1   r2   r7   r3   r4   r   r=   r   zAssigned platformzConfig template)r2   r3   r7   r1   r4   c                       e Zd ZeZdZdS )VirtualMachineImportForm.Meta)r   rB   rolerC   clusterdevicerD   platformvcpusmemorydiskr   serialconfig_templaterE   r   N)r   r    r!   VirtualMachiner#   r$   r%   r&   r'   r(   rP      s        
r&   r(   N)r   r    r!   r   rG   VirtualMachineStatusChoicesrB   r   r   rH   rI   rC   rF   rR   r   rS   r   filterrQ   r   rD   r   rT   r	   rY   r(   r%   r&   r'   r   r   N   s       ^akk+!())  F
 aii!!##!O$$  D "!a	ll$$&&!&''  G ! akk##%%!455  F aii#** + 
 
 !%&&  D ! akk##%%!%&&  F #"a
mm!%%''!'((  H *)'++--a!""!%&&  O
 
 
 
 
 
 
 
 
 
r&   r   c            	       4    e Zd Z e ed          ej                                        d          Z e ed          e	j                                        dd ed                    Z
 e ed          e	j                                        dd ed	                    Z e ed
          ed ed                    Z e ed          ej                                        dd ed                    Z G d d          Zd fd	Zd Z xZS )r   Virtual machiner   r1   r2   r3   ParentFzParent interfacerN   BridgezBridged interfaceModez0IEEE 802.1Q operational mode (for L2 interfaces))r1   r;   r7   r4   r
   rdzAssigned VRFc                       e Zd ZeZdZdS )VMInterfaceImportForm.Meta)virtual_machiner   parentbridgeenabledmac_addressmtur   modevrfr   N)r   r    r!   VMInterfacer#   r$   r%   r&   r'   r(   re      s        
r&   r(   Nc                 ^    t                      j        |g|R i | |r|                    d          x}rud| j        d         j         |i} | j        d         j        j        di || j        d         _         | j        d         j        j        di || j        d         _        d S d S d S )Nrf   virtual_machine__rg   rh   r%   )super__init__getr$   r3   r2   r\   )selfdataargskwargsrf   params	__class__s         r'   rr   zVMInterfaceImportForm.__init__   s    /////// 	a"&((+<"="== aV4E(F(TVVXg 2WX1F1O1V1`1`Y_1`1`H%.1VX1F1O1V1`1`Y_1`1`H%...	a 	aa ar&   c                 2    d| j         vrdS | j        d         S )Nri   T)ru   cleaned_data)rt   s    r'   clean_enabledz#VMInterfaceImportForm.clean_enabled   s"    DI%%4$Y//r&   )N)r   r    r!   r   rG   rZ   rH   rI   rf   rn   rg   rh   r   r   rl   r
   rm   r(   rr   r|   __classcell__)ry   s   @r'   r   r      s       ))a!""'++--  O
 ! akk$((**!&''  F ! akk$((**!'((  F >aii$!FGG	  D 
ahh""!N##  C
 
 
 
 
 
 
 

a 
a 
a 
a 
a 
a0 0 0 0 0 0 0r&   r   c                       e Zd Z e ed          ej                                        d          Z G d d          Z	dS )r   r^   r   r_   c                       e Zd ZeZdZdS )VirtualDiskImportForm.Meta)rf   r   sizer   r   N)r   r    r!   VirtualDiskr#   r$   r%   r&   r'   r(   r      s        
r&   r(   N)
r   r    r!   r   rG   rZ   rH   rI   rf   r(   r%   r&   r'   r   r      sv        ))a!""'++--  O
 
 
 
 
 
 
 
 
 
r&   r   N)django.utils.translationr   rG   dcim.choicesr   dcim.modelsr   r   r   r   extras.modelsr	   ipam.modelsr
   netbox.formsr   tenancy.modelsr   utilities.forms.fieldsr   r   r   virtualization.choicesvirtualization.models__all__r   r   r   r   r   r   r%   r&   r'   <module>r      s   6 6 6 6 6 6 - - - - - - : : : : : : : : : : : : ( ( ( ( ( (       . . . . . . ! ! ! ! ! ! Q Q Q Q Q Q Q Q Q Q $ $ $ $ # # # #9 9 9 9 91 9 9 99 9 9 9 92 9 9 9$j $j $j $j $j- $j $j $jN?
 ?
 ?
 ?
 ?
4 ?
 ?
 ?
D:0 :0 :0 :0 :01 :0 :0 :0z
 
 
 
 
1 
 
 
 
 
r&   