
    >Tfc                        d dl mZ d dlmZ d dlmZ d dlmZ d dl	T d dl
T d dlT d dlmZ d dlmZ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mZ d dlmZmZm Z m!Z!m"Z"m#Z# d dl$m%Z%m&Z&m'Z' d dl(m)Z)m*Z*m+Z+m,Z,m-Z- d dl.m/Z/ d dl0m1Z1m2Z2 ddl3m4Z4m5Z5 dZ6 G d de          Z7 G d de          Z8 G d dee          Z9 G d dee          Z: G d de          Z; G d de          Z< G d  d!ee          Z= G d" d#ee          Z> G d$ d%e          Z? G d& d'e          Z@ G d( d)e          ZA G d* d+e          ZB G d, d-e          ZC G d. d/ee          ZD G d0 d1e5e          ZEd2 ZF G d3 d4ee          ZG G d5 d6e          ZH G d7 d8ee          ZI G d9 d:e          ZJ G d; d<ejK                  ZL G d= d>ejM                  ZN G d? d@ejK                  ZO G dA dBeO          ZP G dC dDeP          ZQ G dE dFeP          ZR G dG dHeP          ZS G dI dJeP          ZT G dK dLeP          ZU G dM dNeP          ZV G dO dPeP          ZW G dQ dReP          ZX G dS dTeO          ZY G dU dVeO          ZZ G dW dXe          Z[ G dY dZe[          Z\ G d[ d\e\          Z] G d] d^e\          Z^ G d_ d`e\          Z_ G da dbe\          Z` G dc dde4e\          Za G de dfe\          Zb G dg dhe\          Zc G di dje\          Zd G dk dle[          Ze G dm dnejM                  Zf G do dpe[          Zg G dq dre          Zh G ds dtee          ZiduS )v    )forms)ContentType)gettext_lazy)TimeZoneFormField)*)ConfigTemplate)ASN	IPAddressVLAN	VLANGroupVRF)NetBoxModelForm)TenancyForm)User)add_blank_choiceget_field_value)CommentFieldDynamicModelChoiceFieldDynamicModelMultipleChoiceField	JSONFieldNumericArrayField	SlugField)FieldSetInlineFieldsTabbedGroups)	APISelectClearableFileInput
HTMXSelectNumberWithOptionsSelectWithPK)Cluster)WirelessLANWirelessLANGroup   )InterfaceCommonFormModuleCommonForm),	CableFormConsolePortFormConsolePortTemplateFormConsoleServerPortFormConsoleServerPortTemplateFormDeviceBayFormDeviceBayTemplateForm
DeviceFormDeviceRoleFormDeviceTypeFormDeviceVCMembershipFormFrontPortFormFrontPortTemplateFormInterfaceFormInterfaceTemplateFormInventoryItemFormInventoryItemRoleFormInventoryItemTemplateFormLocationFormManufacturerForm
ModuleFormModuleBayFormModuleBayTemplateFormModuleTypeFormPlatformFormPopulateDeviceBayFormPowerFeedFormPowerOutletFormPowerOutletTemplateFormPowerPanelFormPowerPortFormPowerPortTemplateFormRackFormRackReservationFormRackRoleFormRackTypeFormRearPortFormRearPortTemplateForm
RegionFormSiteFormSiteGroupFormVCMemberSelectFormVirtualChassisFormVirtualDeviceContextFormc                       e Zd Z e ed          ej                                        d          Z e	            Z
 eddddd          fZ G d	 d
          ZdS )rM   ParentFlabelquerysetrequiredparentnameslugdescriptiontagsc                       e Zd ZeZdZdS )RegionForm.MetarY   rZ   r[   r\   r]   N)__name__
__module____qualname__Regionmodelfields     ;/var/www/html/netbox-4.1.3/netbox/dcim/forms/model_forms.pyMetar_   T   s        
rh   rj   N)ra   rb   rc   r   _rd   objectsallrY   r   r[   r   	fieldsetsrj   rg   rh   ri   rM   rM   H   s        $$akk##%%  F
 9;;D 	66=&AAI
 
 
 
 
 
 
 
 
 
rh   rM   c                       e Zd Z e ed          ej                                        d          Z e	            Z
 eddddd          fZ G d	 d
          ZdS )rO   rT   FrU   rY   rZ   r[   r\   r]   c                       e Zd ZeZdZdS )SiteGroupForm.Metar`   N)ra   rb   rc   	SiteGroupre   rf   rg   rh   ri   rj   rq   g   s        
rh   rj   N)ra   rb   rc   r   rk   rr   rl   rm   rY   r   r[   r   rn   rj   rg   rh   ri   rO   rO   [   s        $$akk"&&((  F
 9;;D 	66=&AAI
 
 
 
 
 
 
 
 
 
rh   rO   c                   Z   e Zd Z e ed          ej                                        d          Z e ed          e	j                                        d          Z
 eej                                         ed          d          Z e            Z e ed           e e            j                  d          Z e            Z ed	d
dddddddd ed                     edd ed                     edddd ed                    fZ G d d          ZdS ) rN   rd   FrU   GroupASNs)rW   rV   rX   z	Time zone)rV   choicesrX   rZ   r[   statusregiongroupfacilityasns	time_zoner\   r]   SiterZ   tenant_grouptenantTenancyphysical_addressshipping_addresslatitude	longitudezContact Infoc                   d    e Zd ZeZdZ ej        ddi           ej        ddi          dZdS )SiteForm.Meta)rZ   r[   rw   rx   ry   r   r   rz   r{   r|   r\   r   r   r   r   commentsr]   rows   attrs)r   r   N)	ra   rb   rc   r}   re   rf   r   Textareawidgetsrg   rh   ri   rj   r      sj        

 !/A! ! !
 !/A! ! !
 
rh   rj   N)ra   rb   rc   r   rk   rd   rl   rm   rx   rr   ry   r   r	   r{   r   r[   r   r   rv   r|   r   r   r   rn   rj   rg   rh   ri   rN   rN   n   s       $$akk##%%  F
 $#ajj"&&((  E
 +*""aii  D
 9;;D!!ann  !2!2!4!4!<==  I
 |~~H 	FHhV[Zgio6	
 	
 	
 	)===#%7[WXWXYgWhWhiiiI
 
 
 
 
 
 
 
 
 
rh   rN   c                   b   e Zd Z e ed          ej                                        d          Z e ed          e	j                                        dddi          Z
 e            Z ed	d
dddddd ed          	  	         edd ed                    fZ G d d          ZdS )r9   r}   TrV   rW   selectorrT   Fsite_id$siterV   rW   rX   query_paramssiterY   rZ   r[   rw   rz   r\   r]   Locationr~   r   r   r   c                       e Zd ZeZdZdS )LocationForm.Meta)
r   rY   rZ   r[   rw   r\   r   r   rz   r]   N)ra   rb   rc   r   re   rf   rg   rh   ri   rj   r      s        
rh   rj   N)ra   rb   rc   r   rk   r}   rl   rm   r   r   rY   r   r[   r   rn   rj   rg   rh   ri   r9   r9      s       ""aii!!##  D
 %$akk!%%''w
	  F 9;;D 	668ZX^efefgqerersss)===I

 
 
 
 
 
 
 
 
 
rh   r9   c            
       r    e Zd Z e            Z eddddd ed                    fZ G d d	          Zd
S )rI   rZ   r[   colorr\   r]   z	Rack Roler~   c                       e Zd ZeZg dZdS )RackRoleForm.MetarZ   r[   r   r\   r]   N)ra   rb   rc   RackRolere   rf   rg   rh   ri   rj   r      $        
 
 
rh   rj   N	ra   rb   rc   r   r[   r   rk   rn   rj   rg   rh   ri   rI   rI      sr        9;;D 	-aannUUUI
 
 
 
 
 
 
 
 
 
rh   rI   c                      e Zd Z e ed          ej                                                  Z e	            Z
 e ed          d          Z eddddd	d
 ed                     edd eddd ed                     eddd ed                    d ed                     edd ed                    fZ G d d          ZdS ) rJ   ManufacturerrV   rW   Slugre   rV   slug_sourcemanufacturerr[   r\   form_factorr]   	Rack Typer~   widthu_heightouter_widthouter_depth
outer_unitOuter DimensionsrV   weight
max_weightweight_unitWeightmounting_depth
Dimensionsstarting_unit
desc_units	Numberingc                       e Zd ZeZg dZdS )RackTypeForm.Meta)r   re   r[   r   r   r   r   r   r   r   r   r   r   r   r   r\   r   r]   N)ra   rb   rc   RackTypere   rf   rg   rh   ri   rj   r      s$        
 
 
rh   rj   N)ra   rb   rc   r   rk   r   rl   rm   r   r   r   r   r[   r   r   rn   rj   rg   rh   ri   rJ   rJ      sY       **a%))++  L |~~H9aii  D 	&-PV]^]^_j]k]klllZL|11M_K`K`aaaL<aakkRRR11\??		
 	
 	
 	,QQ{^^DDD	I
 
 
 
 
 
 
 
 
 
rh   rJ   c                   n    e Zd Z e ed          ej                                        d          Z e ed          e	j                                        dddi          Z
 e ed	          ej                                        d
          Z e ed          ej                                        d ed                    Z e            Z eddddddddd ed          
  
         eddd ed                     edd ed                    fZ G d  d!          Z fd"Z xZS )#rG   r}   Tr   r   Fr   r   r   RolerU   r   zFSelect a pre-defined rack type, or set physical characteristics below.)rV   rW   rX   	help_textr   locationrZ   rw   role	rack_typer\   airflowr]   Rackr~   facility_idserial	asset_tagzInventory Controlr   r   r   c                       e Zd ZeZg dZdS )RackForm.Meta)r   r   rZ   r   r   r   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r\   r   r]   N)ra   rb   rc   r   re   rf   rg   rh   ri   rj   r     s$        
 
 
rh   rj   c                     t                      j        |i | | j        d         j        j                            dddd           t          | d          rt          j        D ]
}| j        |= d S g | j	        t          ddddt          d	d
dt          d                    t          dddt          d                    ddt          d          	  	        R | _	        d S )Nr   .z#form_fields)zhx-getz
hx-includez	hx-targetr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r~   )super__init__rf   widgetr   updater   r   RACKTYPE_FIELDSrn   r   r   rk   )selfargskwargs
field_name	__class__s       ri   r   zRackForm.__init__  s   $)&))) 	K '-44('6
 6
 	 	 	 4-- 	"2 , ,
K
++, ,!7OZ |STUgShShiii <aPXkkZZZ$l<	   DNNNrh   )ra   rb   rc   r   rk   r}   rl   rm   r   r   r   r   r   r   r   r   r   r   rn   rj   r   __classcell__r   s   @ri   rG   rG      s       ""aii!!##  D
 '&a
mm!%%''w
	  H #"aii!%%''  D
 ('ann!%%''!\]]	  I |~~H 	VXv{M[dflststu{s|s|}}}+AA>Q<R<RSSS)===I
 
 
 
 
 
 
 
        rh   rG   c            
          e Zd Z e ed          ej                                        d          Z e	 ed           e
j                     ed                    Z e
j         ed          ej                            d          	          Z e            Z ed
dddd ed                     edd ed                    fZ G d d          ZdS )rH   r   Tr   UnitszRComma-separated list of numeric unit IDs. A range may be specified using a hyphen.)rV   
base_fieldr   r   usernamer   rackunitsuserr\   r]   Reservationr~   r   r   r   c                       e Zd ZeZg dZdS )RackReservationForm.Meta)r   r   r   r   r   r\   r   r]   N)ra   rb   rc   RackReservationre   rf   rg   rh   ri   rj   r   F  s$        
 
 
rh   rj   N)ra   rb   rc   r   rk   r   rl   rm   r   r   r   IntegerFieldr   ModelChoiceFieldr   order_byr   r   r   r   rn   rj   rg   rh   ri   rH   rH   0  sA       ""aii!!##  D
 ajj%5%''!hii  E
 "5!aii&&z22  D |~~H 	&-aaFVFVWWW)===I

 
 
 
 
 
 
 
 
 
rh   rH   c            	       p    e Zd Z e            Z edddd ed                    fZ G d d          Zd	S )
r:   rZ   r[   r\   r]   r   r~   c                       e Zd ZeZg dZdS )ManufacturerForm.Meta)rZ   r[   r\   r]   N)ra   rb   rc   r   re   rf   rg   rh   ri   rj   r   T  s$        
 
 
rh   rj   Nr   rg   rh   ri   r:   r:   M  sr        9;;D 	QQ~=N=NOOOI
 
 
 
 
 
 
 
 
 
rh   r:   c                      e Zd Z e ed          ej                                                  Z e ed          e	j                                        dddddgi	          Z
 e ed
          d          Z e            Z edddddd ed                     edddddddd ed          	  	         edd ed                    fZ G d  d!          Zd"S )#r0   r   r   zDefault platformFTmanufacturer_idz$manufacturernullrV   rW   rX   r   r   r   re   r   r   r[   default_platformr\   r]   zDevice Typer~   r   exclude_from_utilizationis_full_depthpart_numbersubdevice_roler   r   r   Chassisfront_image
rear_imageImagesc                   T    e Zd ZeZg dZ edei           edei          dZdS )DeviceTypeForm.Meta)r   re   r[   r   r   r   r   r   r   r   r   r   r   r   r\   r   r]   acceptr   )r   r   N)	ra   rb   rc   
DeviceTypere   rf   r   DEVICETYPE_IMAGE_FORMATSr   rg   rh   ri   rj   r   x  st        
 
 
 .-25    -,24   	
 
rh   rj   N)ra   rb   rc   r   rk   r   rl   rm   r   Platformr   r   r[   r   r   r   rn   rj   rg   rh   ri   r0   r0   [  sy       **a%))++  L /.a"##!%%''8
   9aii  D |~~H 	&2DmU[bcbcdqbrbrsss2O]Tdfom!!I,,	
 	
 	
 	11X;;???I
 
 
 
 
 
 
 
 
 
rh   r0   c            
           e Zd Z e ed          ej                                                  Z e	            Z
 eddddd ed          	           ed
dd ed          	          fZ G d d          ZdS )r>   r   r   r   re   r   r\   r]   zModule Typer~   r   r   r   r   c                       e Zd ZeZg dZdS )ModuleTypeForm.Meta)	r   re   r   r   r   r   r\   r   r]   N)ra   rb   rc   
ModuleTypere   rf   rg   rh   ri   rj   r     s$        
 
 
rh   rj   N)ra   rb   rc   r   rk   r   rl   rm   r   r   r   r   rn   rj   rg   rh   ri   r>   r>     s        **a%))++  L |~~H 	-UVUVWdUeUefffHm!!I,,GGGI

 
 
 
 
 
 
 
 
 
rh   r>   c                       e Zd Z e ed          ej                                        d          Z e	            Z
 edddddd	d
 ed                    fZ G d d          ZdS )r/   Config templateFrU   rZ   r[   r   vm_roleconfig_templater\   r]   zDevice Roler~   c                       e Zd ZeZg dZdS )DeviceRoleForm.Meta)rZ   r[   r   r  r  r\   r]   N)ra   rb   rc   
DeviceRolere   rf   rg   rh   ri   rj   r    $        
 
 
rh   rj   N)ra   rb   rc   r   rk   r   rl   rm   r  r   r[   r   rn   rj   rg   rh   ri   r/   r/     s        --a!""'++--  O
 9;;D 	FGY0A=RX_`_`an_o_o	
 	
 	
I
 
 
 
 
 
 
 
 
 
rh   r/   c                   D   e Zd Z e ed          ej                                        d          Z e ed          e	j                                        d          Z
 e ed          d          Z edd	d
ddd ed                    fZ G d d          ZdS )r?   r   FrU   r  r   @   )rV   
max_lengthrZ   r[   r   r  r\   r]   r   r~   c                       e Zd ZeZg dZdS )PlatformForm.Meta)rZ   r[   r   r  r\   r]   N)ra   rb   rc   r   re   rf   rg   rh   ri   rj   r    r   rh   rj   N)ra   rb   rc   r   rk   r   rl   rm   r   r   r  r   r[   r   rn   rj   rg   rh   ri   r?   r?     s       **a%))++  L
 .-a!""'++--  O
 9aii  D 	1BMSY`a`abl`m`mnnnI
 
 
 
 
 
 
 
 
 
rh   r?   c                       e Zd Z e ed          ej                                        d          Z e ed          e	j                                        dddidd	i
          Z
 e ed          ej                                        dddd          Z ej         ed          d ed          d edddd                    Z e ed          ej                                        ddid          Z e ed          ej                                                  Z e ed          ej                                        ddddi           Z e ed!          ej                                        ddddd"gi           Z e            Z edd#$          Z e ed%          ej                                        ddd&id'          Z ej        d ed           ed(          )          Z  ej        d ed*           ed+          )          Z! e ed,          e"j                                        d-          Z# G d. d/          Z$ fd0Z% xZ&S )1r.   r}   Tr   r   Fr   r   racksz$rack)rV   rW   rX   r   initial_paramsr   z	$location)r   location_idr   Positionz/The lowest-numbered unit occupied by the devicez#/api/dcim/racks/{{rack}}/elevation/devicez*[{"fieldName":"face","queryParam":"face"}])zts-disabled-fieldzdata-dynamic-params)api_urlr   )rV   rX   r   localizer   Device typerY   r   rV   rW   contextr   zDevice roler   r   available_for_device_type$device_typer   r!   r    )rX   rV   zVirtual chassismaster)rV   rW   rX   r  r   z@The position in the virtual chassis this device is identified by)rX   rV   r   Priorityz1The priority of the device in the virtual chassisr  rU   c                       e Zd ZeZg dZdS )DeviceForm.Meta)rZ   r   device_typer   r   r   r   r   positionfacer   r   rw   r   platformprimary_ip4primary_ip6oob_ipclusterr   r   virtual_chassisvc_positionvc_priorityr\   r  r   r]   local_context_dataN)ra   rb   rc   Devicere   rf   rg   rh   ri   rj   r  0  s$        
 
 
rh   rj   c                     t                      j        |i | | j        j        rKdg}dD ]{}dg}| j                            d                              dd          }t          j                            |t          j        
                    t                    |                              d	          }|r8d
 |D             }|                    d|f           |                    |           t          j                            d                              |t          j        
                    t                    |                              d	          }	|	r#d |	D             }|                    d|f           || j        d                    |                   _        }|| j        d         _        | j        d         j                            d| j        j                   | j        j        j        rut-          | j        d          r`d| j        d         _        d| j        d         _        | j        j        j        j        | j        d<   | j        j        j        j        | j        d<   ng | j        d         _        d| j        d         j        j        d<   g | j        d         _        d| j        d         j        j        d<   g | j        d         _        d| j        d         j        j        d<   | j                            d          p| j                            d          }
|
r|
d|
 fg| j        d         j        _        d S d S )N)Nz	---------)      F)	if_masterpkT)flat)address__familyassigned_object_typeassigned_object_id__inassigned_objectc                 @    g | ]}|j         |j         d |j         dfS )z ())idaddressr6  .0ips     ri   
<listcomp>z'DeviceForm.__init__.<locals>.<listcomp>M  s6    gggSU"*'M'M8J'M'M'MNgggrh   zInterface IPs
nat_inside)r3   nat_inside__assigned_object_type"nat_inside__assigned_object_id__inc                 0    g | ]}|j         |j         d fS )z (NAT))r9  r:  r;  s     ri   r>  z'DeviceForm.__init__.<locals>.<listcomp>W  s*    PPP""*'<'<'<=PPPrh   zNAT IPszprimary_ip{}r&  r!  exclude
parent_bayr   r   r$  readonlyr%  U) r   r   instancer1  vc_interfacesvalues_listr
   rl   filterr   get_for_model	Interfaceprefetch_relatedappendextendrf   formatrv   r   add_query_paramr   is_child_devicehasattrdisabledrD  r  r   initialrack_idr   dataget)r   r   r   oob_ip_choicesfamily
ip_choicesinterface_idsinterface_ipsip_listnat_ipsr!  r   s              ri   r   zDeviceForm.__init__9  sL   $)&)))= 3	B 22N  P P12
 !% ; ;e ; L L X XY]dh X i i !* 1 8 8$*)4)<)J)J9)U)U+8 !9 ! ! #"#455	 
 ! 3ggYfgggG%%&@AAA"))'222#+<<\JJQQ$*5@5H5V5VW`5a5a7D R   #"#455	 
  <PPPPPG%%y'&:;;;EON11&99:BB,:DK!) K
#*::9dmFVWWW }(8 OWT]T`=a=a O/3F#,/3F#,'+}'?'F'NV$'+}'?'F'NV$
 24DK&.BFDK&-3J?13DK&.BFDK&-3J?,.DK!)=ADK!(.z: 9==,,L0@0@0L0L 	R7?X6P5QDK
#*222	R 	Rrh   )'ra   rb   rc   r   rk   r}   rl   rm   r   r   r   r   r   r   DecimalFieldr   r!  r   r   r  r   r   r#  r!   r'  r   r   r   r+  VirtualChassisr(  r   r)  r*  r   r  rj   r   r   r   s   @ri   r.   r.     s       ""aii!!##  D
 '&a
mm!%%''w
 W

 
 
H #"aii!!##&
 
	  D "u!a
mm!EFFy9%-'S 
 
 
  H *)a#''))n
   K #"a#''))  D '&a
mm!%%'''
  H &%a	ll$$&&(
  G |~~H"   .-a!""'++--h
   O %%$a
mm!VWW  K
 %%$a
mm!GHH  K
 .-a!""'++--  O
 
 
 
 
 
 
 
;R ;R ;R ;R ;R ;R ;R ;R ;Rrh   r.   c                   n    e Zd Z e ed          ej                                        ddi          Z e ed          e	j                                        ddi          Z
 e ed	          ej                                        d
did          Z e            Z ej         ed          dd ed                    Z ej         ed          dd ed                    Z edddddd ed                     edddd ed                     fZ G d! d"          Z fd#Z xZS )$r;   r,  
modulebaysz$module_bay)rV   rW   r  z
Module bay	device_id$device)rV   rW   r   Module typerY   r   Tr  zReplicate componentsFzBAutomatically populate components associated with this module type)rV   rX   rU  r   zAdopt componentsz!Adopt already existing componentsr  
module_baymodule_typerw   r\   r]   Moduler~   r   r   replicate_componentsadopt_componentsHardwarec                       e Zd ZeZg dZdS )ModuleForm.Meta)r  rg  rh  rw   r   r   r]   rj  rk  r\   r   N)ra   rb   rc   ri  re   rf   rg   rh   ri   rj   rn    s$        
 
 
rh   rj   c                 
    t                      j        |i | | j        j        r\d| j        d         _        d| j        d         _        d| j        d         _        d| j        d         _        d| j        d         _        d S d S )NTr  Frj  rk  )r   r   rG  r1  rf   rT  rU  r   r   r   r   s      ri   r   zModuleForm.__init__  s    $)&)))= 	<-1DK!*:?DK./7;?DK./86;DK*+37;DK*+444	< 	<rh   )ra   rb   rc   r   rk   r,  rl   rm   r  	ModuleBayrg  r   rh  r   r   r   BooleanFieldrj  rk  r   rn   rj   r   r   r   s   @ri   r;   r;   w  s       $$akk##%%-
  F )(aoo"&&((
  J *)a#''))n
   K |~~H-5-a&''!XYY	   *u)a"##!788	   	<-QW^_^_`h^i^ijjj;(>@RYZYZ[eYfYfgggI

 
 
 
 
 
 
 
< < < < < < < < <rh   r;   c                  x    t          d t          j                            t                    D                       S )Nc                     g | ]C}|j          d |j         |                                j        j                                        fDS )r   )	app_labelre   model_class_metaverbose_nametitle)r<  cts     ri   r>  z0get_termination_type_choices.<locals>.<listcomp>  s[        L	%	%28	%	%r~~'7'7'='J'P'P'R'RS  rh   )r   r   rl   rJ  CABLE_TERMINATION_MODELSrg   rh   ri   get_termination_type_choicesr|    sB      %,,-EFF     rh   c                       e Zd Z ej        ed e             ed                    Z ej        ed e             ed                    Z	 e
            Z G d d          ZdS )r'   FType)rv   rX   r   rV   c                       e Zd ZeZg dZdS )CableForm.Meta)a_terminations_typeb_terminations_typetyperw   r   r   rV   r   lengthlength_unitr\   r   r]   N)ra   rb   rc   Cablere   rf   rg   rh   ri   rj   r    s$        
 
 
rh   rj   N)ra   rb   rc   r   ChoiceFieldr|  r   rk   r  r  r   r   rj   rg   rh   ri   r'   r'     s        +%+,z||aii	   ,%+,z||aii	   |~~H
 
 
 
 
 
 
 
 
 
rh   r'   c            
       0   e Zd Z e ed          ej                                        d          Z e ed          e	j                                        dddi          Z
 e            Z ed	d
ddd ed                    fZ G d d          ZdS )rD   r}   Tr   r   Fr   r   r   r   r   rZ   r\   r]   zPower Panelr~   c                       e Zd ZeZg dZdS )PowerPanelForm.Meta)r   r   rZ   r\   r   r]   N)ra   rb   rc   
PowerPanelre   rf   rg   rh   ri   rj   r    r  rh   rj   N)ra   rb   rc   r   rk   r}   rl   rm   r   r   r   r   r   r   rn   rj   rg   rh   ri   rD   rD     s        ""aii!!##  D
 '&a
mm!%%''w
	  H |~~H 	V]F=IYIYZZZI
 
 
 
 
 
 
 
 
 
rh   rD   c                      e Zd Z e ed          ej                                        d          Z e ed          e	j                                        dd          Z
 e            Z eddd	d
dddd ed          	  	         eddddd ed                     edd ed                    fZ G d d          ZdS )rA   zPower panelTr   r   F)rV   rW   rX   r   power_panelr   rZ   rw   r  r\   mark_connectedr]   z
Power Feedr~   supplyvoltageamperagephasemax_utilizationCharacteristicsr   r   r   c                       e Zd ZeZg dZdS )PowerFeedForm.Meta)r  r   rZ   rw   r  r  r  r  r  r  r  r   r   r\   r   r]   N)ra   rb   rc   	PowerFeedre   rf   rg   rh   ri   rj   r    $        
 
 
rh   rj   N)ra   rb   rc   r   rk   r  rl   rm   r  r   r   r   r   r   rn   rj   rg   rh   ri   rA   rA     s>       ))a#''))  K
 #"aii!!##	  D |~~H 	668V]L\^d<	
 	
 	
 	9j';LSTSTUfSgSghhh)===I
 
 
 
 
 
 
 
 
 
rh   rA   c                        e Zd Z ej         ed          ej                                        d          Z	 e
            Z G d d          Z fdZ xZS )rQ   MasterFrU   c                   2    e Zd ZeZg dZd e            iZdS )VirtualChassisForm.Meta)rZ   domainr  r\   r   r]   r  N)ra   rb   rc   ra  re   rf   r    r   rg   rh   ri   rj   r    s8        
 
 
 llnn
rh   rj   c                      t                      j        |i | t          j                            | j                  | j        d         _        d S )N)r(  r  )r   r   r,  rl   rJ  rG  rf   rW   rp  s      ri   r   zVirtualChassisForm.__init__   sI    $)&))))/)>)>t})>)])]H&&&rh   )ra   rb   rc   r   r   rk   r,  rl   rm   r  r   r   rj   r   r   r   s   @ri   rQ   rQ     s        #U#akk##%%  F
 |~~H
 
 
 
 
 
 
 
^ ^ ^ ^ ^ ^ ^ ^ ^rh   rQ   c                   @     e Zd Z G d d          Zd fd	Zd Z xZS )r1   c                   $    e Zd ZeZddgZdddZdS )DeviceVCMembershipForm.Metar)  r*  r  r  )r)  r*  N)ra   rb   rc   r,  re   rf   labelsrg   rh   ri   rj   r  '  s3        =
 &%
 
rh   rj   Fc                      t                      j        |i | d| j        d         _        ddi| j        d         j        _        ddi| j        d         j        _        || _        d S )NTr)  classzform-controlr*  )r   r   rf   rX   r   r   validate_vc_position)r   r  r   r   r   s       ri   r   zDeviceVCMembershipForm.__init__1  sp    $)&))) /3M"+ 4;N2KM")/3:N2KM")/ %9!!!rh   c                     | j         d         }| j        rft          j                            | j        j        |          }|                                r't          j	        d
                    |                    |S )Nr)  )r(  r)  z7A virtual chassis member already exists in position {}.)cleaned_datar  r,  rl   rJ  rG  r(  existsr   ValidationErrorrP  )r   r)  conflicting_memberss      ri   clean_vc_positionz(DeviceVCMembershipForm.clean_vc_position?  s    '6$ 	"(."7"7 $ =' #8 # # #))++ +MTTU`aa   rh   )F)ra   rb   rc   rj   r   r  r   r   s   @ri   r1   r1   &  st        
 
 
 
 
 
 
 
9 9 9 9 9 9      rh   r1   c                   v    e Zd Z e ed          ej                                        ddid          Zd Z	dS )rP   r,  virtual_chassis_idr   T)rV   rW   r   r   c                 ^    | j         d         }|j        t          j        d| d          |S )Nr  zDevice z* is already assigned to a virtual chassis.)r  r(  r   r  )r   r  s     ri   clean_devicezVCMemberSelectForm.clean_deviceY  sB    "8,!-'L&LLL   rh   N)
ra   rb   rc   r   rk   r,  rl   rm   r  r  rg   rh   ri   rP   rP   O  se        $$akk##%% &
   F    rh   rP   c                   ~     e Zd Z e ed          ej                                        ddi          Z fdZ	 xZ
S )ComponentTemplateFormr  rY   r   )rV   rW   r  c                 z     t                      j        |i | | j        j        rd| j        d         _        d S d S )NTr   r   r   rG  r1  rf   rT  rp  s      ri   r   zComponentTemplateForm.__init__o  M    $)&))) = 	726DK&///	7 	7rh   )ra   rb   rc   r   rk   r   rl   rm   r   r   r   r   s   @ri   r  r  f  sx        ))a#''))n
  K7 7 7 7 7 7 7 7 7rh   r  c                       e Zd Z e ed          ej                                                                        dddi          Z e ed          e	j                                        dddi          Z
 fdZ xZS )ModularComponentTemplateFormr  FrY   r   )rV   rW   rX   r  rf  c                 z     t                      j        |i | | j        j        rd| j        d         _        d S d S )NTrh  r  rp  s      ri   r   z%ModularComponentTemplateForm.__init__  r  rh   )ra   rb   rc   r   rk   r   rl   rm   r   r   rh  r   r   r   s   @ri   r  r  w  s        ))a#''))--//n
	  K *)a#''))n
	  K7 7 7 7 7 7 7 7 7rh   r  c                   J    e Zd Z edddddd          fZ G d d          Zd	S )
r)   r   rh  rZ   rV   r  r\   c                       e Zd ZeZg dZdS )ConsolePortTemplateForm.Metar   rh  rZ   rV   r  r\   N)ra   rb   rc   ConsolePortTemplatere   rf   rg   rh   ri   rj   r    $        #
 
 
rh   rj   Nra   rb   rc   r   rn   rj   rg   rh   ri   r)   r)     Z        vwVVI
 
 
 
 
 
 
 
 
 
rh   r)   c                   J    e Zd Z edddddd          fZ G d d          Zd	S )
r+   r   rh  rZ   rV   r  r\   c                       e Zd ZeZg dZdS )"ConsoleServerPortTemplateForm.Metar  N)ra   rb   rc   ConsoleServerPortTemplatere   rf   rg   rh   ri   rj   r    s$        )
 
 
rh   rj   Nr  rg   rh   ri   r+   r+     r  rh   r+   c            
       N    e Zd Z edddddddd          fZ G d	 d
          ZdS )rF   r   rh  rZ   rV   r  maximum_drawallocated_drawr\   c                       e Zd ZeZg dZdS )PowerPortTemplateForm.Meta)r   rh  rZ   rV   r  r  r  r\   N)ra   rb   rc   PowerPortTemplatere   rf   rg   rh   ri   rj   r    $        !
 
 
rh   rj   Nr  rg   rh   ri   rF   rF     se        =&'6>Scer	
 	
I
 
 
 
 
 
 
 
 
 
rh   rF   c            
           e Zd Z e ed          ej                                        dddi          Z e	dddd	d
ddd          fZ
 G d d          ZdS )rC   
Power portFdevicetype_idr  r   r   rh  rZ   rV   r  
power_portfeed_legr\   c                       e Zd ZeZg dZdS )PowerOutletTemplateForm.Meta)r   rh  rZ   rV   r  r  r  r\   N)ra   rb   rc   PowerOutletTemplatere   rf   rg   rh   ri   rj   r    r  rh   rj   N)ra   rb   rc   r   rk   r  rl   rm   r  r   rn   rj   rg   rh   ri   rC   rC     s        ((aoo"*..00^
	  J 	vwV`boppI
 
 
 
 
 
 
 
 
 
rh   rC   c                   
   e Zd Z e ed          ej                                        dddd          Z e	ddd	d
ddddd	  	         e	dd ed                     e	d ed                    fZ
 G d d          ZdS )r5   BridgeFr  $module_type)device_type_idmodule_type_idr   r   rh  rZ   rV   r  enabled	mgmt_onlyr\   bridgepoe_modepoe_typePoEr~   rf_roleWirelessc                       e Zd ZeZg dZdS )InterfaceTemplateForm.Meta)r   rh  rZ   rV   r  r  r  r\   r  r  r  r  N)ra   rb   rc   InterfaceTemplatere   rf   rg   rh   ri   rj   r    r  rh   rj   N)ra   rb   rc   r   rk   r  rl   rm   r  r   rn   rj   rg   rh   ri   r5   r5     s        $$akk"*..00,,
 
	  F 	=&'69k[hjr	
 	
 	Zaahh777:///I
 
 
 
 
 
 
 
 
 
rh   r5   c                       e Zd Z e ed          ej                                        dddd          Z e	ddd	d
ddddd	  	        fZ
 G d d          ZdS )r3   	Rear portFr  r  )r  moduletype_idr   r   rh  rZ   rV   r  r   	rear_portrear_port_positionr\   c                       e Zd ZeZg dZdS )FrontPortTemplateForm.Meta)	r   rh  rZ   rV   r  r   r  r  r\   N)ra   rb   rc   FrontPortTemplatere   rf   rg   rh   ri   rj   r    s$        !
 
 
rh   rj   N)ra   rb   rc   r   rk   RearPortTemplaterl   rm   r  r   rn   rj   rg   rh   ri   r3   r3     s        ''ann!)--//++
 
	  I 	=&'67KYm	
 	
I
 
 
 
 
 
 
 
 
 
rh   r3   c            
       N    e Zd Z edddddddd          fZ G d	 d
          ZdS )rL   r   rh  rZ   rV   r  r   	positionsr\   c                       e Zd ZeZg dZdS )RearPortTemplateForm.Meta)r   rh  rZ   rV   r  r   r  r\   N)ra   rb   rc   r  re   rf   rg   rh   ri   rj   r    s$         
 
 
rh   rj   Nr  rg   rh   ri   rL   rL      s`        vwQ\^kllI
 
 
 
 
 
 
 
 
 
rh   rL   c                   J    e Zd Z edddddd          fZ G d d          Zd	S )
r=   r   rh  rZ   rV   r!  r\   c                       e Zd ZeZg dZdS )ModuleBayTemplateForm.Meta)r   rh  rZ   rV   r!  r\   N)ra   rb   rc   ModuleBayTemplatere   rf   rg   rh   ri   rj   r    r  rh   rj   Nr  rg   rh   ri   r=   r=     sZ        vw
MZZI
 
 
 
 
 
 
 
 
 
rh   r=   c                   F    e Zd Z edddd          fZ G d d          ZdS )r-   r   rZ   rV   r\   c                       e Zd ZeZg dZdS )DeviceBayTemplateForm.Meta)r   rZ   rV   r\   N)ra   rb   rc   DeviceBayTemplatere   rf   rg   rh   ri   rj   r    r  rh   rj   Nr  rg   rh   ri   r-   r-     sV        ??I
 
 
 
 
 
 
 
 
 
rh   r-   c                       e Zd Z e ed          ej                                        dddi          Z e ed          e	j                                        d          Z
 e ed          ej                                        d          Z eej                                        dd	di ed
                    Z eej                                        dd	di ed                    Z eej                                        dd	di ed                    Z eej                                        dd	di ed                    Z eej                                        dd	di ed                    Z eej                                        dd	di ed                    Z eej                                        dd	di ed                    Z edddddddd           e e ed ed                     ed ed                     ed ed                      ed! ed"                     ed# ed$                     ed% ed&                     ed' ed(                               ed)                    fZ G d* d+          Z fd,Z fd-Z  xZ!S ).r8   rT   Fr  r  r   r   rU   r   r  zConsole port templaterW   rX   r   rV   zConsole server port templatezFront port templatezInterface templatezPower outlet templatezPower port templatezRear port templater   rY   rZ   rV   r   r   part_idr\   interfacetemplaterL  r~   consoleporttemplateConsole PortconsoleserverporttemplateConsole Server Portfrontporttemplate
Front Portrearporttemplate	Rear Portpowerporttemplate
Power PortpoweroutlettemplatePower OutletComponent Assignmentc                       e Zd ZeZg dZdS )InventoryItemTemplateForm.Meta)r   rY   rZ   rV   r   r   r  r\   N)ra   rb   rc   InventoryItemTemplatere   rf   rg   rh   ri   rj   r
    s$        %
 
 
rh   rj   c                    |                     d          }|                     di                                           }|                     d          }|                     d          }|rat          j                            t
                    D ];}t          |j                  |                                u r|j        ||j	        <    n<n|r|rt          j                            t
                                        |          
                                x}rK|                                j                            |          
                                x}	r
|	||j	        <   ||d<    t                      j        |i | d S )NrG  rU  component_typecomponent_idr1  )rX  copyr   rl   rJ  !MODULAR_COMPONENT_TEMPLATE_MODELSr  	componentrv  re   firstr   r   r   r   r   rG  rU  r  r  component_modelcontent_typer  r   s             ri   r   z"InventoryItemTemplateForm.__init__  s}   ::j))**Y++0022 %566{{>22 
	<#.#6#=#=>_#`#`  *++/J/J/L/LLL5=5GGO12E M  	< 	<*299:[\\ccgucvv||~~~| < , 8 8 : : B I I\ I Z Z ` ` b bb9 <2;GL./#y$)&)))))rh   c                 (    t                                                        fddD             }t          |          dk    r!t          j        t          d                    |r j        |d                   j        _        d S d  j        _        d S )Nc                 .    g | ]}j         |         |S rg   r  r<  fieldr   s     ri   r>  z3InventoryItemTemplateForm.clean.<locals>.<listcomp>  s9     
 
 
 "5)	

 
 
rh   )r  r  r   r  r  r  r  r$   <An InventoryItem can only be assigned to a single component.r   	r   cleanlenr   r  rk   r  rG  r  r   selected_objectsr   s   ` ri   r  zInventoryItemTemplateForm.clean  s    
 
 
 
 
 
 
   1$$'*h(i(ijjj 	+&*&78H8K&LDM###&*DM###rh   )"ra   rb   rc   r   rk   r  rl   rm   rY   InventoryItemRoler   r   r   r  r  r  r  r  r   r  r  r  r  r  r  r  r  r   r   rn   rj   r   r  r   r   s   @ri   r8   r8   $  sP       $$akk&.2244^
	  F #"aii"*..00  D
 +*a%))++  L 21$,0022n
 a'((   !8 7*26688n
 a.//! ! ! 0/"*..00n
 a%&&   0/"*..00n
 a$%%   21$,0022n
 a'((   0/"*..00n
 a%&&   /.!)--//n
 a$%%   	8VWfniYf	
 	
 	L,11[>>BBB.QQ~5F5FGGG411=R;S;STTT,11\??CCC+!!K..AAA,11\??CCC.QQ~5F5FGGG  )**	
 	
 	
	I$
 
 
 
 
 
 
 
* * * * *,+ + + + + + + + +rh   r8   c                   z     e Zd Z e ed          ej                                        d          Z fdZ	 xZ
S )DeviceComponentFormr,  Tr   c                 z     t                      j        |i | | j        j        rd| j        d         _        d S d S )NTr  r  rp  s      ri   r   zDeviceComponentForm.__init__  sM    $)&))) = 	2-1DK!***	2 	2rh   )ra   rb   rc   r   rk   r,  rl   rm   r  r   r   r   s   @ri   r$  r$    sn        $$akk##%%  F2 2 2 2 2 2 2 2 2rh   r$  c                   p    e Zd Z e ed          ej                                        dddi          ZdS )ModularDeviceComponentFormri  Frd  re  r   N)	ra   rb   rc   r   rk   ri  rl   rm   modulerg   rh   ri   r'  r'    sN        $$akk##%%
	  FFFrh   r'  c                   P    e Zd Z eddddddddd		  	        fZ G d
 d          ZdS )r(   r  r(  rZ   rV   r  speedr  r\   r]   c                       e Zd ZeZg dZdS )ConsolePortForm.Meta	r  r(  rZ   rV   r  r*  r  r\   r]   N)ra   rb   rc   ConsolePortre   rf   rg   rh   ri   rj   r,    s$        
 
 
rh   rj   Nr  rg   rh   ri   r(   r(     h        hBRTaci	
 	
I
 
 
 
 
 
 
 
 
 
rh   r(   c                   P    e Zd Z eddddddddd		  	        fZ G d
 d          ZdS )r*   r  r(  rZ   rV   r  r*  r  r\   r]   c                       e Zd ZeZg dZdS )ConsoleServerPortForm.Metar-  N)ra   rb   rc   ConsoleServerPortre   rf   rg   rh   ri   rj   r2    r  rh   rj   Nr  rg   rh   ri   r*   r*     r/  rh   r*   c                   R    e Zd Z eddddddddd	d

  
        fZ G d d          ZdS )rE   r  r(  rZ   rV   r  r  r  r  r\   r]   c                       e Zd ZeZg dZdS )PowerPortForm.Meta)
r  r(  rZ   rV   r  r  r  r  r\   r]   N)ra   rb   rc   	PowerPortre   rf   rg   rh   ri   rj   r6    r  rh   rj   Nr  rg   rh   ri   rE   rE     sj        hIY[k6	
 	
I
 
 
 
 
 
 
 
 
 
rh   rE   c                       e Zd Z e ed          ej                                        dddi          Z e	dddd	d
ddddd
  
        fZ
 G d d          ZdS )rB   r  Frd  re  r   r  r(  rZ   rV   r  r  r  r  r\   r]   c                       e Zd ZeZg dZdS )PowerOutletForm.Meta)
r  r(  rZ   rV   r  r  r  r  r\   r]   N)ra   rb   rc   PowerOutletre   rf   rg   rh   ri   rj   r:    s$        
 
 
rh   rj   N)ra   rb   rc   r   rk   r7  rl   rm   r  r   rn   rj   rg   rh   ri   rB   rB     s        ((aoo"&&((
	  J 	hzScer	
 	
I
 
 
 
 
 
 
 
 
 
rh   rB   c                      e Zd Z eej                                        d ed          ddiddi          Z e	e
j                                        d ed          d	di
          Z e	e
j                                        d ed          d	di
          Z e	e
j                                        d ed          ddd
          Z e	ej                                        d ed                    Z eej                                        d ed          ddi
          Z e	ej                                        d ed           ed                    Z e	ej                                        d ed          ddd
          Z eej                                        d ed          ddd
          Z e	ej                                        d ed                    Z ej        dd ed                    Z edd d!d"d#d$d%d&d' ed(          )
  
         ed*d+d, ed-          )           ed.d/d0d1d2d3 ed4          )           ed5d6d ed7          )           ed8d9 ed:          )           ed;d<d=d> ed?          )           ed@dAdBdCdDdE edF          )          fZ G dG dH          ZdS )Ir4   FzVirtual device contexts
interfacesz$parentrd  re  )rW   rX   rV   r  r   zParent interfacevirtual_chassis_member_id)rW   rX   rV   r   zBridged interfacezLAG interfacelag)r>  r  zWireless LAN group)rW   rX   rV   zWireless LANsgroup_idz$wireless_lan_groupz
VLAN groupz/Filter VLANs available for assignment by group.)rW   rX   rV   r   zUntagged VLANz$vlan_group)r@  available_on_devicezTagged VLANsr   NWWN)empty_valuerX   rV   r  r(  rZ   rV   r  r*  duplexr\   r]   rL  r~   vrfmac_addresswwn
Addressingvdcsmtutx_powerr  r  r  	OperationrY   r  zRelated Interfacesr  r  r  mode
vlan_groupuntagged_vlantagged_vlansz802.1Q Switchingr  
rf_channelrf_channel_frequencyrf_channel_widthwireless_lan_groupwireless_lansr  c                   P    e Zd ZeZg dZ ee           e            dZ	ddiZ
dS )InterfaceForm.Meta)r  r(  rI  rZ   rV   r  r*  rD  r  rY   r  r?  rF  rG  rJ  r  r  r\   r  r  rM  r  rQ  rR  rS  rK  rU  rO  rP  rE  r]   )options)r*  rM  rM  z802.1Q ModeN)ra   rb   rc   rL  re   rf   r   InterfaceSpeedChoicesr   r   r  rg   rh   ri   rj   rW  y  sc        
 
 
 '&-   JLL	
 
 M
rh   rj   )ra   rb   rc   r   VirtualDeviceContextrl   rm   rk   rI  r   rL  rY   r  r?  r#   rT  r"   rU  r   rN  r   rO  rP  r   rE  r   	CharFieldrG  r   rn   rj   rg   rh   ri   r4   r4     s<       **%-1133a)**)
 

 
 
D %$"&&((a"##'
	  F %$"&&((a#$$'
	  F "
!"&&((a  )2
 
	  C 10!)--//a$%%  
 43$((**a  -
	  M )("&&((aoo!EFF	  J ,+!!##a  %#,
 
	  M 32!!##a%#,
 
	  L "
!""ahh  C
 %/ahh  C 	h(M[ahihijuhvhv	
 	
 	
 	u11\??CCC
I{DT[\[\]h[i[ijjj8U3G1H1HIIIZaahh777QQOaMbMbccc|%;=OQegv:	
 	
 	
I
 
 
 
 
 
 
 
 
 
rh   r4   c                       e Zd Z eej                                        ddi          Z edddddd	d
dddd          fZ	 G d d          Z
dS )r2   rd  re  )rW   r   r  r(  rZ   rV   r  r   r  r  r  r\   r]   c                       e Zd ZeZg dZdS )FrontPortForm.Meta)r  r(  rZ   rV   r  r   r  r  r  r\   r]   N)ra   rb   rc   	FrontPortre   rf   rg   rh   ri   rj   r^    r  rh   rj   N)ra   rb   rc   r   RearPortrl   rm   r  r   rn   rj   rg   rh   ri   r2   r2     s        ''!%%''
  I 	h+Oceu6	
 	
I
 
 
 
 
 
 
 
 
 
rh   r2   c                   R    e Zd Z eddddddddd	d

  
        fZ G d d          ZdS )rK   r  r(  rZ   rV   r  r   r  r  r\   r]   c                       e Zd ZeZg dZdS )RearPortForm.Meta)
r  r(  rZ   rV   r  r   r  r  r\   r]   N)ra   rb   rc   r`  re   rf   rg   rh   ri   rj   rc    r   rh   rj   Nr  rg   rh   ri   rK   rK     sj        h+O_anpv	
 	
I
 
 
 
 
 
 
 
 
 
rh   rK   c            	       L    e Zd Z eddddddd          fZ G d d	          Zd
S )r<   r  r(  rZ   rV   r!  r\   r]   c                       e Zd ZeZg dZdS )ModuleBayForm.Meta)r  r(  rZ   rV   r!  r\   r]   N)ra   rb   rc   rq  re   rf   rg   rh   ri   rj   rf    $        
 
 
rh   rj   Nr  rg   rh   ri   r<   r<     s]        8VWj-QWYYI
 
 
 
 
 
 
 
 
 
rh   r<   c                   H    e Zd Z eddddd          fZ G d d          ZdS )	r,   r  rZ   rV   r\   r]   c                       e Zd ZeZg dZdS )DeviceBayForm.Meta)r  rZ   rV   r\   r]   N)ra   rb   rc   	DeviceBayre   rf   rg   rh   ri   rj   rj    rg  rh   rj   Nr  rg   rh   ri   r,   r,     sX        67M6CCI
 
 
 
 
 
 
 
 
 
rh   r,   c                        e Zd Z ej        ej                                         ed           ed                    Z	 fdZ
 xZS )r@   zChild Devicez[Child devices must first be created and assigned to the site and rack of the parent device.)rW   rV   r   c                     t                      j        |i | t          j                            |j        j        |j        j        ddt          j	                  
                    |j        j                  | j        d         _        d S )NTr   )r   r   parent_bay__isnulldevice_type__u_heightdevice_type__subdevice_roler  installed_device)r   r   r,  rl   rJ  r  r   r   SubdeviceRoleChoices
ROLE_CHILDrC  r1  rf   rW   )r   
device_bayr   r   r   s       ri   r   zPopulateDeviceBayForm.__init__  s    $)&)))39>3H3H"'"'#"#(<(G 4I 4
 4
 'Z&)'
*
* 	&'000rh   )ra   rb   rc   r   r   r,  rl   rm   rk   rq  r   r   r   s   @ri   r@   r@     s~        -u-##%%a!qrr  	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+rh   r@   c                       e Zd Z e ed          ej                                        dddi          Z e ed          e	j                                        d          Z
 e ed          ej                                        d          Z eej                                        dddi ed	          
          Z eej                                        dddi ed          
          Z eej                                        dddi ed          
          Z eej                                        dddi ed          
          Z eej                                        dddi ed          
          Z eej                                        dddi ed          
          Z eej                                        dddi ed          
          Z eddddddd ed                     edddd ed                     e e ed ed                     ed  ed!                     ed" ed#                     ed$ ed%                     ed& ed'                     ed( ed)                     ed* ed+                               ed,                    fZ G d- d.          Z fd/Z fd0Z  xZ!S )1r6   rT   Frd  re  r   r   rU   r   zConsole portr  zConsole server portz
Front portrL  zPower outletr  r  r  rY   rZ   rV   r   r\   r]   zInventory Itemr~   r   r  r   r   rl  	interfaceconsoleportr  consoleserverportr  	frontportr  rearportr  	powerportr  poweroutletr  r  c                       e Zd ZeZg dZdS )InventoryItemForm.Meta)r  rY   rZ   rV   r   r   r  r   r   r\   r]   N)ra   rb   rc   InventoryItemre   rf   rg   rh   ri   rj   r~  ;  s$        
 
 
rh   rj   c                 N   |                     d          }|                     di                                           }|                     d          }|                     d          }|rat          j                            t
                    D ];}t          |j                  |                                u r|j        ||j	        <    n<n|r|rt          j                            t
                                        |          
                                x}rK|                                j                            |          
                                x}	r
|	||j	        <   ||d<    t                      j        |i | | j        j        rd| j        d         _        d S d S )NrG  rU  r  r  r  Fr  )rX  r  r   rl   rJ  MODULAR_COMPONENT_MODELSr  r  rv  re   r  r   r   rG  r1  rf   rT  r  s             ri   r   zInventoryItemForm.__init__B  s   ::j))**Y++0022 %566{{>22 
	<#.#6#=#=>V#W#W  *++/J/J/L/LLL5=5GGO12E M  	< 	<*299:RSSZZ^lZmmssuuu| < , 8 8 : : B I I\ I Z Z ` ` b bb9 <2;GL./#y$)&))) = 	3-2DK!***	3 	3rh   c                 (    t                                                        fddD             }t          |          dk    r!t          j        t          d                    |r j        |d                   j        _        d S d  j        _        d S )Nc                 .    g | ]}j         |         |S rg   r  r  s     ri   r>  z+InventoryItemForm.clean.<locals>.<listcomp>`  s7     
 
 
"5)

 
 
rh   )rw  rx  ry  rv  r|  r{  rz  r$   r  r   r  r   s   ` ri   r  zInventoryItemForm.clean\  s    
 
 
 
 
 
 

   1$$'*h(i(ijjj 	+&*&78H8K&LDM###&*DM###rh   )"ra   rb   rc   r   rk   r  rl   rm   rY   r"  r   r   r   r.  rw  r3  rx  r_  ry  rL  rv  r;  r|  r7  r{  r`  rz  r   r   rn   rj   r   r  r   r   s   @ri   r6   r6     s^       $$akk&**,,
	  F #"aii"*..00  D
 +*a%))++  L *)$((**
 a  K 0/"*..00
 a%&&   ('"&&((
 aoo  I ('"&&((
 ann  I *)$((**
 a  K ('"&&((
 aoo  I '&!%%''
 ann  H 	8VWfmVZ[Z[\lZmZmnnnHk*VVVL11[>>:::QQ~->->???,115J3K3KLLL11\??;;;!!K..99911\??;;;QQ~->->???  )**	
 	
 	
I"
 
 
 
 
 
 
 
3 3 3 3 34+ + + + + + + + +rh   r6   c            
       r    e Zd Z e            Z eddddd ed                    fZ G d d	          Zd
S )r7   rZ   r[   r   r\   r]   zInventory Item Roler~   c                       e Zd ZeZg dZdS )InventoryItemRoleForm.Metar   N)ra   rb   rc   r"  re   rf   rg   rh   ri   rj   r  w  r  rh   rj   Nr   rg   rh   ri   r7   r7   p  su        9;;D 	-aaH]F^F^___I
 
 
 
 
 
 
 
 
 
rh   r7   c                      e Zd Z e ed          ej                                        d          Z ee	j                                         ed          dddd	          Z
 ee	j                                         ed
          dddd	          Z eddddddd ed                     edd ed                    fZ G d d          ZdS )rR   r,  Tr   zPrimary IPv4Fre  4)rd  rZ  )rW   rV   rX   r   zPrimary IPv66r  rZ   rw   
identifierr$  r%  r]   zVirtual Device Contextr~   r   r   r   c                       e Zd ZeZg dZdS )VirtualDeviceContextForm.Meta)
r  rZ   rw   r  r$  r%  r   r   r   r]   N)ra   rb   rc   rZ  re   rf   rg   rh   ri   rj   r    s$        $
 
 
rh   rj   N)ra   rb   rc   r   rk   r,  rl   rm   r  r
   r$  r%  r   rn   rj   rg   rh   ri   rR   rR   ~  sa       $$akk##%%  F
 *)"&&((a"
 
	  K *)"&&((a"
 
	  K 	fhm]TZ+,,	
 	
 	
 	)===I
 
 
 
 
 
 
 
 
 
rh   rR   N)jdjangor   "django.contrib.contenttypes.modelsr   django.utils.translationr   rk   timezone_fieldr   dcim.choicesdcim.constantsdcim.modelsextras.modelsr   ipam.modelsr	   r
   r   r   r   netbox.formsr   tenancy.formsr   users.modelsr   utilities.formsr   r   utilities.forms.fieldsr   r   r   r   r   r   utilities.forms.renderingr   r   r   utilities.forms.widgetsr   r   r   r   r    virtualization.modelsr!   wireless.modelsr"   r#   commonr%   r&   __all__rM   rO   rN   r9   rI   rJ   rG   rH   r:   r0   r>   r/   r?   r.   r;   r|  r'   rD   rA   rQ   	ModelFormr1   FormrP   r  r  r)   r+   rF   rC   r5   r3   rL   r=   r-   r8   r$  r'  r(   r*   rE   rB   r4   r2   rK   r<   r,   r@   r6   r7   rR   rg   rh   ri   <module>r     sO
         : : : : : : 6 6 6 6 6 6 , , , , , ,             ( ( ( ( ( ( < < < < < < < < < < < < < < ( ( ( ( ( ( % % % % % %       = = = = = = = =                K J J J J J J J J J n n n n n n n n n n n n n n ) ) ) ) ) ) 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9-`
 
 
 
 
 
 
 
&
 
 
 
 
O 
 
 
&2
 2
 2
 2
 2
{O 2
 2
 2
j
 
 
 
 
; 
 
 
8
 
 
 
 
? 
 
 

 
 
 
 
? 
 
 
>A A A A A{O A A AH
 
 
 
 
+ 
 
 
:
 
 
 
 
 
 
 
+
 +
 +
 +
 +
_ +
 +
 +
\
 
 
 
 
_ 
 
 
(
 
 
 
 
_ 
 
 
*
 
 
 
 
? 
 
 
6gR gR gR gR gRo gR gR gRT9< 9< 9< 9< 9<!? 9< 9< 9<x  
 
 
 
 
_ 
 
 
.
 
 
 
 
_ 
 
 
6
 
 
 
 
K 
 
 
F^ ^ ^ ^ ^ ^ ^ ^.& & & & &U_ & & &R       .7 7 7 7 7EO 7 7 7"7 7 7 7 7#8 7 7 74	
 	
 	
 	
 	
: 	
 	
 	
	
 	
 	
 	
 	
$@ 	
 	
 	

 
 
 
 
8 
 
 

 
 
 
 
: 
 
 
*
 
 
 
 
8 
 
 
4
 
 
 
 
8 
 
 
4	
 	
 	
 	
 	
7 	
 	
 	
	
 	
 	
 	
 	
8 	
 	
 	
	
 	
 	
 	
 	
1 	
 	
 	
K+ K+ K+ K+ K+ 5 K+ K+ K+d2 2 2 2 2/ 2 2 2    !4   
 
 
 
 
0 
 
 

 
 
 
 
6 
 
 

 
 
 
 
. 
 
 
 
 
 
 
 
0 
 
 
2t
 t
 t
 t
 t
')C t
 t
 t
n
 
 
 
 
. 
 
 
.
 
 
 
 
- 
 
 
	
 	
 	
 	
 	
. 	
 	
 	
	
 	
 	
 	
 	
' 	
 	
 	
+ + + + +EJ + + +&N+ N+ N+ N+ N++ N+ N+ N+h
 
 
 
 
O 
 
 
&
 &
 &
 &
 &
{O &
 &
 &
 &
 &
rh   