
    >Tf                        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
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 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$m%Z% d dl&m'Z' d dl(m)Z) ddl*m+Z+m,Z,m-Z- ddl.m/Z/ ddl0T ddl1T ddl2m3Z3m4Z4m5Z5  G d dej6                  Z7 e#e8           G d de!ej9                              Z: e#e8d           G d dej;                              Z< e#e8d           G d  d!ej=                              Z> G d" d#ej?                  Z@ G d$ d%ejA                  ZB G d& d'ejC                  ZD G d( d)ej6                  ZE e#eF           G d* d+ej9                              ZG e#eFd           G d, d-ej;                              ZH e#eFd           G d. d/ej=                              ZI G d0 d1ej?                  ZJ G d2 d3ejA                  ZK G d4 d5ejC                  ZL G d6 d7ej6                  ZM e#eN           G d8 d9e!ej9                              ZO e#eNd           G d: d;ej;                              ZP e#eNd           G d< d=ej=                              ZQ G d> d?ej?                  ZR G d@ dAejA                  ZS G dB dCejC                  ZT G dD dEej6                  ZU e#eV           G dF dGej9                              ZW e#eVdH           G dI dJejX                              ZY e#eVd           G dK dLej;                              ZZ e#eVd           G dM dNej=                              Z[ G dO dPej?                  Z\ G dQ dRejA                  Z] G dS dTejC                  Z^ G dU dVej6                  Z_ e#e`           G dW dXe!ej9                              Za e#e`d           G dY dZej;                              Zb e#e`d           G d[ d\ej=                              Zc G d] d^ej?                  Zd G d_ d`ejA                  Ze G da dbejC                  Zf G dc ddej6                  Zg e#eh           G de dfej9                              Zi e#ehdg           G dh diejX                              Zj e#ehd           G dj dkej;                              Zk e#ehd           G dl dmej=                              Zl G dn doej?                  Zm G dp dqejA                  Zn G dr dsejC                  Zo e#ehdt           G du dve                      Zp G dw dxej6                  Zq e#er           G dy dze!ej9                              Zs e#erd           G d{ d|ej;                              Zt e#erd           G d} d~ej=                              Zu G d dej?                  Zv G d dejA                  Zw G d dejC                  Zx G d dej6                  Zy e#ez           G d dej9                              Z{ e#ezdg           G d dejX                              Z| e#ezdd           G d dejX                              Z} e#ezdd           G d dejX                              Z~ e#ezd           G d dej;                              Z e#ezd           G d dej=                              Z G d dej?                  Z G d dejA                  Z G d dejC                  Z e#ezdt           G d de                      Z G d dej6                  Z e#e           G d dej9                              Z e#edd           G d dejX                              Z e#ed           G d dej;                              Z e#ed           G d dej=                              Z G d dej?                  Z G d dejA                  Z G d dejC                  Z e#edt           G d de                      Z G d dej6                  Z e#e           G d dej9                              Z e#ed           G d dej;                              Z G d dej9                  Z e#ed           G d dej=                              Z G d dej                  Z G d dej?                  Z G d dejA                  Z G d dejC                  Z e#eddŬ           G dƄ dejX                              Z e#edt           G dȄ de                      Z G dʄ dej6                  Z e#e           G d̄ de!ej9                              Z e#ed           G d΄ dej;                              Z e#ed           G dЄ dej=                              Z G d҄ dej?                  Z G dԄ dejA                  Z G dք dejC                  Z e#edئ           G dل dejX                              Z G dۄ dej6                  Z e#e           G d݄ dej9                              Z e#ed           G d߄ dej;                              Z e#ed           G d dej=                              Z G d dej?                  Z G d dejA                  Z G d dejC                  Z e#ed           G d dej;                              Z e#ed           G d dej=                              Z G d dej6                  Z e#e           G d dej9                              Z e#ed           G d dejX                              Z e#edd           G d dejX                              Z e#ed           G d dej;                              Z e#ed           G d dej=                              Z G d dej?                  Z G d dejA                  Z G d  dejC                  Z G d dej6                  Z e#e           G d dej9                              Z e#ed           G d dej;                              Z e#ed           G d d	ej=                              Z G d
 dej?                  Z G d dejA                  Z G d dejC                  Z G d dej6                  Z e#eæ           G d dej9                              Z G d dej;                  Z e#ed           G d dej;                              Z e#ed           G d dej=                              Z G d dej?                  Z G d dejA                  Z G d dejC                  Z e#edt           G d  d!e                      Zːd"S (#      )ContentType)Prefetch)RawSQL)get_object_or_404redirectrender)reverse)gettext)Provider)InterfaceFilterSet)InterfaceFilterForm)	InterfaceSite)generic)ObjectContactsView)count_related)get_table_ordering)GetRelatedModelsMixinViewTabregister_model_view)VMInterfaceFilterSet)VMInterfaceFilterForm)VMInterface   )
filtersetsformstables)PrefixStatusChoices)*)add_requested_prefixesadd_available_ipaddressesadd_available_vlansc                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )VRFListViewN)__name__
__module____qualname__VRFobjectsallquerysetr   VRFFilterSet	filtersetr   VRFFilterFormfilterset_formr   VRFTabletable     //var/www/html/netbox-4.1.3/netbox/ipam/views.pyr$   r$      s6        {  H'I(NOEEEr3   r$   c                   F    e Zd Zej                                        Zd ZdS )VRFViewc                    t          j        |j                                        d          }t          j        |j                                        d          }|                     ||t          t          g          ||dS )NF	orderable)omit)related_modelsimport_targets_tableexport_targets_table)r   RouteTargetTableimport_targetsr*   export_targetsget_related_modelsr   r   )selfrequestinstancer<   r=   s        r4   get_extra_contextzVRFView.get_extra_context*   s    %6#'')) 
  
  
  &6#'')) 
  
  
 #55gxyZeNf5gg$8$8
 
 	
r3   N)r%   r&   r'   r(   r)   r*   r+   rE   r2   r3   r4   r6   r6   &   s4        {  H
 
 
 
 
r3   r6   editc                   N    e Zd Zej                                        Zej        Z	dS )VRFEditViewN)
r%   r&   r'   r(   r)   r*   r+   r   VRFFormformr2   r3   r4   rH   rH   ;   &        {  H=DDDr3   rH   deletec                   @    e Zd Zej                                        ZdS )VRFDeleteViewN)r%   r&   r'   r(   r)   r*   r+   r2   r3   r4   rN   rN   A           {  HHHr3   rN   c                   N    e Zd Zej                                        Zej        Z	dS )VRFBulkImportViewN)
r%   r&   r'   r(   r)   r*   r+   r   VRFImportForm
model_formr2   r3   r4   rQ   rQ   F   '        {  H$JJJr3   rQ   c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )VRFBulkEditViewN)r%   r&   r'   r(   r)   r*   r+   r   r,   r-   r   r0   r1   r   VRFBulkEditFormrJ   r2   r3   r4   rV   rV   K   s6        {  H'IOE DDDr3   rV   c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )VRFBulkDeleteViewN)r%   r&   r'   r(   r)   r*   r+   r   r,   r-   r   r0   r1   r2   r3   r4   rY   rY   R   s.        {  H'IOEEEr3   rY   c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )RouteTargetListViewN)r%   r&   r'   RouteTargetr)   r*   r+   r   RouteTargetFilterSetr-   r   RouteTargetFilterFormr/   r   r>   r1   r2   r3   r4   r[   r[   \   s:        "&&((H/I0N#EEEr3   r[   c                   @    e Zd Zej                                        ZdS )RouteTargetViewNr%   r&   r'   r\   r)   r*   r+   r2   r3   r4   r`   r`   c   "        "&&((HHHr3   r`   c                   N    e Zd Zej                                        Zej        Z	dS )RouteTargetEditViewN)
r%   r&   r'   r\   r)   r*   r+   r   RouteTargetFormrJ   r2   r3   r4   rd   rd   h   s*        "&&((H DDDr3   rd   c                   @    e Zd Zej                                        ZdS )RouteTargetDeleteViewNra   r2   r3   r4   rg   rg   n   rb   r3   rg   c                   N    e Zd Zej                                        Zej        Z	dS )RouteTargetBulkImportViewN)
r%   r&   r'   r\   r)   r*   r+   r   RouteTargetImportFormrS   r2   r3   r4   ri   ri   s   s*        "&&((H,JJJr3   ri   c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )RouteTargetBulkEditViewN)r%   r&   r'   r\   r)   r*   r+   r   r]   r-   r   r>   r1   r   RouteTargetBulkEditFormrJ   r2   r3   r4   rl   rl   x   s:        "&&((H/I#E(DDDr3   rl   c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )RouteTargetBulkDeleteViewN)r%   r&   r'   r\   r)   r*   r+   r   r]   r-   r   r>   r1   r2   r3   r4   ro   ro      s2        "&&((H/I#EEEr3   ro   c                       e Zd Zej                             eed                    Ze	j
        Zej        Zej        ZdS )RIRListViewriraggregate_countN)r%   r&   r'   RIRr)   annotater   	Aggregater+   r   RIRFilterSetr-   r   RIRFilterFormr/   r   RIRTabler1   r2   r3   r4   rq   rq      sR        {##%i77 $  H 'I(NOEEEr3   rq   c                   F    e Zd Zej                                        Zd ZdS )RIRViewc                 2    d|                      ||          iS Nr;   rA   rB   rC   rD   s      r4   rE   zRIRView.get_extra_context   !    d55gxHH
 	
r3   N)r%   r&   r'   ru   r)   r*   r+   rE   r2   r3   r4   r|   r|      s4        {  H
 
 
 
 
r3   r|   c                   N    e Zd Zej                                        Zej        Z	dS )RIREditViewN)
r%   r&   r'   ru   r)   r*   r+   r   RIRFormrJ   r2   r3   r4   r   r      rK   r3   r   c                   @    e Zd Zej                                        ZdS )RIRDeleteViewN)r%   r&   r'   ru   r)   r*   r+   r2   r3   r4   r   r      rO   r3   r   c                   N    e Zd Zej                                        Zej        Z	dS )RIRBulkImportViewN)
r%   r&   r'   ru   r)   r*   r+   r   RIRImportFormrS   r2   r3   r4   r   r      rT   r3   r   c                       e Zd Zej                             eed                    Ze	j
        Zej        Zej        ZdS )RIRBulkEditViewrr   rs   N)r%   r&   r'   ru   r)   rv   r   rw   r+   r   rx   r-   r   rz   r1   r   RIRBulkEditFormrJ   r2   r3   r4   r   r      sR        {##%i77 $  H 'IOE DDDr3   r   c                   t    e Zd Zej                             eed                    Ze	j
        Zej        ZdS )RIRBulkDeleteViewrr   rs   N)r%   r&   r'   ru   r)   rv   r   rw   r+   r   rx   r-   r   rz   r1   r2   r3   r4   r   r      sJ        {##%i77 $  H 'IOEEEr3   r   c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )ASNRangeListViewN)r%   r&   r'   ASNRanger)   annotate_asn_countsr+   r   ASNRangeFilterSetr-   r   ASNRangeFilterFormr/   r   ASNRangeTabler1   r2   r3   r4   r   r      s:        3355H,I-N EEEr3   r   c                   @    e Zd Zej                                        ZdS )ASNRangeViewNr%   r&   r'   r   r)   r*   r+   r2   r3   r4   r   r      "        ##%%HHHr3   r   asnsc                       e Zd Zej                                        ZeZe	j
        Zej        Zej        Z e ed          d dd          Zd ZdS )ASNRangeASNsViewASNsc                 N    |                                                                  S N)get_child_asnscountxs    r4   <lambda>zASNRangeASNsView.<lambda>       ((**0022 r3   zipam.view_asn  labelbadge
permissionweightc                     |                                                     |j        d                              t	          t
          d          t	          t          d                    S )Nviewr   
site_countprovider_count)r   restrictuserrv   r   r   r   rB   rC   parents      r4   get_childrenzASNRangeASNsView.get_children   sX    $$&&//fEENN$T622(6:: O 
 
 	
r3   N)r%   r&   r'   r   r)   r*   r+   ASNchild_modelr   ASNTabler1   r   ASNFilterSetr-   r   ASNFilterFormr/   r   _tabr   r2   r3   r4   r   r      s        ##%%HKOE'I(N
'aii22"	  C
 
 
 
 
r3   r   c                   N    e Zd Zej                                        Zej        Z	dS )ASNRangeEditViewN)
r%   r&   r'   r   r)   r*   r+   r   ASNRangeFormrJ   r2   r3   r4   r   r      s*        ##%%HDDDr3   r   c                   @    e Zd Zej                                        ZdS )ASNRangeDeleteViewNr   r2   r3   r4   r   r      r   r3   r   c                   N    e Zd Zej                                        Zej        Z	dS )ASNRangeBulkImportViewN)
r%   r&   r'   r   r)   r*   r+   r   ASNRangeImportFormrS   r2   r3   r4   r   r      s*        ##%%H)JJJr3   r   c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )ASNRangeBulkEditViewN)r%   r&   r'   r   r)   r   r+   r   r   r-   r   r   r1   r   ASNRangeBulkEditFormrJ   r2   r3   r4   r   r      s:        3355H,I E%DDDr3   r   c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )ASNRangeBulkDeleteViewN)r%   r&   r'   r   r)   r   r+   r   r   r-   r   r   r1   r2   r3   r4   r   r      s2        3355H,I EEEr3   r   c                       e Zd Zej                             eed           eed                    Z	e
j        Zej        Zej        ZdS )ASNListViewr   r   N)r%   r&   r'   r   r)   rv   r   r   r   r+   r   r   r-   r   r   r/   r   r   r1   r2   r3   r4   r   r     sa        {## =v..$}Xv66 $  H 'I(NOEEEr3   r   c                   F    e Zd Zej                                        Zd ZdS )ASNViewc           
      "   d|                      ||t          j                            |j        d                              |g          dft          j                            |j        d                              |g          dff          iS )Nr;   r   )asns__inasn_id)extra)rA   r   r)   r   r   filterr   r   s      r4   rE   zASNView.get_extra_context  s    d55\**7<@@GGRZQ[G\\^fg%..w|VDDKKV^U_K``bjk 6  	
 		
r3   N)r%   r&   r'   r   r)   r*   r+   rE   r2   r3   r4   r   r     s4        {  H

 

 

 

 

r3   r   c                   N    e Zd Zej                                        Zej        Z	dS )ASNEditViewN)
r%   r&   r'   r   r)   r*   r+   r   ASNFormrJ   r2   r3   r4   r   r     rK   r3   r   c                   @    e Zd Zej                                        ZdS )ASNDeleteViewN)r%   r&   r'   r   r)   r*   r+   r2   r3   r4   r   r   $  rO   r3   r   c                   N    e Zd Zej                                        Zej        Z	dS )ASNBulkImportViewN)
r%   r&   r'   r   r)   r*   r+   r   ASNImportFormrS   r2   r3   r4   r   r   )  rT   r3   r   c                       e Zd Zej                             eed                    Ze	j
        Zej        Zej        ZdS )ASNBulkEditViewr   r   N)r%   r&   r'   r   r)   rv   r   r   r+   r   r   r-   r   r   r1   r   ASNBulkEditFormrJ   r2   r3   r4   r   r   .  sR        {## =v.. $  H 'IOE DDDr3   r   c                   t    e Zd Zej                             eed                    Ze	j
        Zej        ZdS )ASNBulkDeleteViewr   r   N)r%   r&   r'   r   r)   rv   r   r   r+   r   r   r-   r   r   r1   r2   r3   r4   r   r   7  sJ        {## =v.. $  H 'IOEEEr3   r   c                       e Zd Zej                             edd                    Zej	        Z
ej        Zej        ZdS )AggregateListViewSSELECT COUNT(*) FROM ipam_prefix WHERE ipam_prefix.prefix <<= ipam_aggregate.prefixr2   child_countN)r%   r&   r'   rw   r)   rv   r   r+   r   AggregateFilterSetr-   r   AggregateFilterFormr/   r   AggregateTabler1   r2   r3   r4   r   r   C  sV         ))Fprtuu *  H -I.N!EEEr3   r   c                   @    e Zd Zej                                        ZdS )AggregateViewNr%   r&   r'   rw   r)   r*   r+   r2   r3   r4   r   r   L  "         $$&&HHHr3   r   prefixesc                       e Zd Zej                                        ZeZe	j
        Zej        Zej        ZdZ e ed          d dd          Zd Zd Zd	 Zd
S )AggregatePrefixesViewzipam/aggregate/prefixes.htmlPrefixesc                 N    |                                                                  S r   get_child_prefixesr   r   s    r4   r   zAggregatePrefixesView.<lambda>[      ,,..4466 r3   ipam.view_prefixr   r   c                     t           j                            |j        d                              t          |j                                                ddddd          S )Nr   )prefix__net_contained_or_equalsiteroletenanttenant__groupvlan)Prefixr)   r   r   r   strprefixprefetch_relatedr   s      r4   r   z"AggregatePrefixesView.get_children`  sX    ~&&w|V<<CC+.v}+=+= D 
 


668_f
M
M	Nr3   c                     t          |j                            dd          dk              }t          |j                            dd          dk              }t          |j        |||          S Nshow_availabletrueshow_assignedboolGETgetr    r   rB   rC   r+   r   r  r  s         r4   prep_table_dataz%AggregatePrefixesView.prep_table_datae  ]    gkoo.>GG6QRRW[___fEEOPP%fmX~}]]]r3   c           	          d|j          |                                t          |j                            dd          dk              t          |j                            dd          dk              dS )Nzwithin=r  r  r  bulk_querystringfirst_available_prefixr  r  )r   get_first_available_prefixr  r  r	  r   s      r4   rE   z'AggregatePrefixesView.get_extra_contextl  so     ;(/ ; ;&.&I&I&K&K"7;??3CV#L#LPV#VWW!'+///6"J"Jf"TUU	
 
 	
r3   N)r%   r&   r'   rw   r)   r*   r+   r   r   r   PrefixTabler1   r   PrefixFilterSetr-   r   PrefixFilterFormr/   template_namer   r   r   r   r  rE   r2   r3   r4   r   r   Q  s         $$&&HKE*I+N2M
'a
mm66%	  CN N N
^ ^ ^
 
 
 
 
r3   r   c                   N    e Zd Zej                                        Zej        Z	dS )AggregateEditViewN)
r%   r&   r'   rw   r)   r*   r+   r   AggregateFormrJ   r2   r3   r4   r  r  u  *         $$&&HDDDr3   r  c                   @    e Zd Zej                                        ZdS )AggregateDeleteViewNr   r2   r3   r4   r  r  {  r   r3   r  c                   N    e Zd Zej                                        Zej        Z	dS )AggregateBulkImportViewN)
r%   r&   r'   rw   r)   r*   r+   r   AggregateImportFormrS   r2   r3   r4   r  r    *         $$&&H*JJJr3   r  c                       e Zd Zej                             edd                    Zej	        Z
ej        Zej        ZdS )AggregateBulkEditViewr   r2   r   N)r%   r&   r'   rw   r)   rv   r   r+   r   r   r-   r   r   r1   r   AggregateBulkEditFormrJ   r2   r3   r4   r!  r!    sV         ))Fprtuu *  H -I!E&DDDr3   r!  c                   t    e Zd Zej                             edd                    Zej	        Z
ej        ZdS )AggregateBulkDeleteViewr   r2   r   N)r%   r&   r'   rw   r)   rv   r   r+   r   r   r-   r   r   r1   r2   r3   r4   r$  r$    sN         ))Fprtuu *  H -I!EEEr3   r$  contactsc                   @    e Zd Zej                                        ZdS )AggregateContactsViewNr   r2   r3   r4   r'  r'    r   r3   r'  c                       e Zd Zej                             eed           eed           ee	d                    Z
ej        Zej        Zej        ZdS )RoleListViewr   )prefix_countiprange_count
vlan_countN)r%   r&   r'   Roler)   rv   r   r   IPRangeVLANr+   r   RoleFilterSetr-   r   RoleFilterFormr/   r   	RoleTabler1   r2   r3   r4   r)  r)    sq        |$$"]6622#mGV44 =v.. %  H
 (I)NEEEr3   r)  c                   F    e Zd Zej                                        Zd ZdS )RoleViewc                 2    d|                      ||          iS r~   r   r   s      r4   rE   zRoleView.get_extra_context  r   r3   N)r%   r&   r'   r-  r)   r*   r+   rE   r2   r3   r4   r4  r4    s6        |!!H
 
 
 
 
r3   r4  c                   N    e Zd Zej                                        Zej        Z	dS )RoleEditViewN)
r%   r&   r'   r-  r)   r*   r+   r   RoleFormrJ   r2   r3   r4   r7  r7    s(        |!!H>DDDr3   r7  c                   @    e Zd Zej                                        ZdS )RoleDeleteViewN)r%   r&   r'   r-  r)   r*   r+   r2   r3   r4   r:  r:    !        |!!HHHr3   r:  c                   N    e Zd Zej                                        Zej        Z	dS )RoleBulkImportViewN)
r%   r&   r'   r-  r)   r*   r+   r   RoleImportFormrS   r2   r3   r4   r=  r=    )        |!!H%JJJr3   r=  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )RoleBulkEditViewN)r%   r&   r'   r-  r)   r*   r+   r   r0  r-   r   r2  r1   r   RoleBulkEditFormrJ   r2   r3   r4   rA  rA    9        |!!H(IE!DDDr3   rA  c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )RoleBulkDeleteViewN)r%   r&   r'   r-  r)   r*   r+   r   r0  r-   r   r2  r1   r2   r3   r4   rE  rE    1        |!!H(IEEEr3   rE  c                   n    e Zd Zej                                        Zej        Z	e
j        Zej        ZdZdS )PrefixListViewzipam/prefix_list.htmlN)r%   r&   r'   r   r)   r*   r+   r   r  r-   r   r  r/   r   r  r1   r  r2   r3   r4   rH  rH    s>        ~!!##H*I+NE+MMMr3   rH  c                   F    e Zd Zej                                        Zd ZdS )
PrefixViewc                    	 t           j                            |j        d                              t          |j                            }n# t           j        $ r d }Y nw xY wt          j                            |j        d          	                    t          |j                  t          dt          j                  z            	                    t          |j                                                ddd	d
          }t          j        t#          |          dd          }t          j                            |j        d          	                    |j        t          |j                                                |j                                      ddd	d
          }t          j        t#          |          dd          }|||dS )Nr   prefix__net_contains_or_equalsvrfT)vrf__isnullstatus)prefix__net_containsr   r   r   r   rO  utilizationFexcluder9   )rO  r   pk)	aggregateparent_prefix_tableduplicate_prefix_table)rw   r)   r   r   r	  r   r   DoesNotExistr   r   QrO  r   STATUS_CONTAINERr   r   r  listrV  rX  )rB   rC   rD   rY  parent_prefixesrZ  duplicate_prefixesr[  s           r4   rE   zPrefixView.get_extra_context  s   	!)227<HHLL/28?/C/C M  II % 	 	 	III	 !.11',GGNN(,!=P=a"b"b"bb
 

&!$X_!5!5  
 


FHf
 
	 	 %0!!*
 
 
 $^44W\6JJQQS%9%9 R 
 

'{  
 


FHf
 
	 	 "(!3#$$*"
 "
 "
 ##6&<
 
 	
s   AA A"!A"N)r%   r&   r'   r   r)   r*   r+   rE   r2   r3   r4   rJ  rJ    s6        ~!!##H(
 (
 (
 (
 (
r3   rJ  c                       e Zd Zej                                        ZeZej	        Z
ej        Zej        ZdZ e ed          d dd          Zd Zd Zd	 Zd
S )PrefixPrefixesViewzipam/prefix/prefixes.htmlzChild Prefixesc                 N    |                                                                  S r   r   r   s    r4   r   zPrefixPrefixesView.<lambda>  r   r3   r   r   r   c                     |                                                     |j        d                              dddddd          S )Nr   r   rO  r   r   r   r   )r   r   r   r   r   s      r4   r   zPrefixPrefixesView.get_children  sE    ((**33GL&IIZZE668_
 
 	
r3   c                     t          |j                            dd          dk              }t          |j                            dd          dk              }t          |j        |||          S r  r  r
  s         r4   r  z"PrefixPrefixesView.prep_table_data   r  r3   c           	         d|j         r|j         j        nd d|j         |                                t	          |j                            dd          dk              t	          |j                            dd          dk              dS )Nvrf_id=0z&within=r  r  r  r  )rO  rX  r   r  r  r  r	  r   s      r4   rE   z$PrefixPrefixesView.get_extra_context'  s     mX\*R(,//s m m\d\k m m&.&I&I&K&K"7;??3CV#L#LPV#VWW!'+///6"J"Jf"TUU	
 
 	
r3   N)r%   r&   r'   r   r)   r*   r+   r   r   r  r1   r   r  r-   r   r  r/   r  r   r   r   r   r  rE   r2   r3   r4   rc  rc    s        ~!!##HKE*I+N/M
'a !!66%	  C
 
 

^ ^ ^
 
 
 
 
r3   rc  iprangesz	ip-ranges)pathc                       e Zd Zej                                        ZeZe	j
        Zej        Zej        ZdZ e ed          d dd          Zd Zd Zd	S )
PrefixIPRangesViewzipam/prefix/ip_ranges.htmlzChild Rangesc                 N    |                                                                  S r   )get_child_rangesr   r   s    r4   r   zPrefixIPRangesView.<lambda>:      **,,2244 r3   zipam.view_iprangeiX  r   c                     |                                                     |j        d                              d          S )Nr   r   )ro  r   r   r   r   s      r4   r   zPrefixIPRangesView.get_children?  s;    &&((11',GGXX
 
 	
r3   c                 l    d|j         r|j         j        nd d|j         |                                dS Nrh  ri  z&parent=)r  first_available_iprO  rX  r   get_first_available_ipr   s      r4   rE   z$PrefixIPRangesView.get_extra_contextD  F     mX\*R(,//s m m\d\k m m"*"A"A"C"C
 
 	
r3   N)r%   r&   r'   r   r)   r*   r+   r.  r   r   IPRangeTabler1   r   IPRangeFilterSetr-   r   IPRangeFilterFormr/   r  r   r   r   r   rE   r2   r3   r4   rm  rm  0  s        ~!!##HKE+I,N0M
'a44&	  C
 
 


 
 
 
 
r3   rm  ipaddresseszip-addressesc                       e Zd Zej                                        ZeZe	j
        Zej        Zej        ZdZ e ed          d dd          Zd Zd Zd	 Zd
S )PrefixIPAddressesViewzipam/prefix/ip_addresses.htmlIP Addressesc                 N    |                                                                  S r   get_child_ipsr   r   s    r4   r   zPrefixIPAddressesView.<lambda>U      ))//11 r3   ipam.view_ipaddressi  r   c                     |                                                     |j        d                              ddd          S )Nr   rO  r   r   )r  r   r   r   r   s      r4   r   z"PrefixIPAddressesView.get_childrenZ  s;    ##%%..w|VDDUUV[]egvwwwr3   c                     |j                             d          s0t          || j                  st	          |j        ||j                  S |S )Nq)r  r	  r   r1   r!   r   is_poolrB   rC   r+   r   s       r4   r  z%PrefixIPAddressesView.prep_table_data]  sI    {s## 	V,>w
,S,S 	V,V]HfnUUUr3   c                 l    d|j         r|j         j        nd d|j         |                                dS rs  ru  r   s      r4   rE   z'PrefixIPAddressesView.get_extra_contextb  rw  r3   N)r%   r&   r'   r   r)   r*   r+   	IPAddressr   r   IPAddressTabler1   r   IPAddressFilterSetr-   r   IPAddressFilterFormr/   r  r   r   r   r   r  rE   r2   r3   r4   r}  r}  K  s        ~!!##HK!E-I.N3M
'a11(	  Cx x x  

 
 
 
 
r3   r}  c                   N    e Zd Zej                                        Zej        Z	dS )PrefixEditViewN)
r%   r&   r'   r   r)   r*   r+   r   
PrefixFormrJ   r2   r3   r4   r  r  i  s)        ~!!##HDDDr3   r  c                   @    e Zd Zej                                        ZdS )PrefixDeleteViewNr%   r&   r'   r   r)   r*   r+   r2   r3   r4   r  r  o  !        ~!!##HHHr3   r  c                   N    e Zd Zej                                        Zej        Z	dS )PrefixBulkImportViewN)
r%   r&   r'   r   r)   r*   r+   r   PrefixImportFormrS   r2   r3   r4   r  r  t  s)        ~!!##H'JJJr3   r  c                   l    e Zd Zej                            d          Zej        Z	e
j        Zej        ZdS )PrefixBulkEditViewvrf__tenantN)r%   r&   r'   r   r)   r   r+   r   r  r-   r   r  r1   r   PrefixBulkEditFormrJ   r2   r3   r4   r  r  y  s;        ~..}==H*IE#DDDr3   r  c                   ^    e Zd Zej                            d          Zej        Z	e
j        ZdS )PrefixBulkDeleteViewr  N)r%   r&   r'   r   r)   r   r+   r   r  r-   r   r  r1   r2   r3   r4   r  r    s3        ~..}==H*IEEEr3   r  c                   @    e Zd Zej                                        ZdS )PrefixContactsViewNr  r2   r3   r4   r  r    r  r3   r  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )IPRangeListViewN)r%   r&   r'   r.  r)   r*   r+   r   ry  r-   r   rz  r/   r   rx  r1   r2   r3   r4   r  r    s9        ""$$H+I,NEEEr3   r  c                   F    e Zd Zej                                        Zd ZdS )IPRangeViewc                    t           j                            |j        d                              t          t          |j        j                            t          t          |j	        j                            |j
                                      ddddd          }t          j        t          |          dd	
          }d|iS )Nr   rL  rN  r   r   r   r   rS  FrU  parent_prefixes_table)r   r)   r   r   r   r]  r   start_addressipend_addressrO  r   r   r  r_  )rB   rC   rD   r`  r  s        r4   rE   zIPRangeView.get_extra_context  s     !.11',GGNNS1G1J-K-KLLLS1E1H-I-IJJJ O 
 
 
FHff
 
	 	 !' 2!!*!
 !
 !
 $%:
 	
r3   N)r%   r&   r'   r.  r)   r*   r+   rE   r2   r3   r4   r  r    s6        ""$$H
 
 
 
 
r3   r  c                       e Zd Zej                                        ZeZe	j
        Zej        Zej        ZdZ e ed          d dd          Zd ZdS )	IPRangeIPAddressesViewzipam/iprange/ip_addresses.htmlr~  c                 N    |                                                                  S r   r  r   s    r4   r   zIPRangeIPAddressesView.<lambda>  r  r3   r  r   r   c                 \    |                                                     |j        d          S Nr   )r  r   r   r   s      r4   r   z#IPRangeIPAddressesView.get_children  s&    ##%%..w|VDDDr3   N)r%   r&   r'   r.  r)   r*   r+   r  r   r   r  r1   r   r  r-   r   rz  r/   r  r   r   r   r   r2   r3   r4   r  r    s        ""$$HK!E-I,N4M
'a11(	  CE E E E Er3   r  c                   N    e Zd Zej                                        Zej        Z	dS )IPRangeEditViewN)
r%   r&   r'   r.  r)   r*   r+   r   IPRangeFormrJ   r2   r3   r4   r  r    )        ""$$HDDDr3   r  c                   @    e Zd Zej                                        ZdS )IPRangeDeleteViewNr%   r&   r'   r.  r)   r*   r+   r2   r3   r4   r  r    !        ""$$HHHr3   r  c                   N    e Zd Zej                                        Zej        Z	dS )IPRangeBulkImportViewN)
r%   r&   r'   r.  r)   r*   r+   r   IPRangeImportFormrS   r2   r3   r4   r  r    )        ""$$H(JJJr3   r  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )IPRangeBulkEditViewN)r%   r&   r'   r.  r)   r*   r+   r   ry  r-   r   rx  r1   r   IPRangeBulkEditFormrJ   r2   r3   r4   r  r    s9        ""$$H+IE$DDDr3   r  c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )IPRangeBulkDeleteViewN)r%   r&   r'   r.  r)   r*   r+   r   ry  r-   r   rx  r1   r2   r3   r4   r  r    s1        ""$$H+IEEEr3   r  c                   @    e Zd Zej                                        ZdS )IPRangeContactsViewNr  r2   r3   r4   r  r    r  r3   r  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )IPAddressListViewN)r%   r&   r'   r  r)   r*   r+   r   r  r-   r   r  r/   r   r  r1   r2   r3   r4   r  r    s:         $$&&H-I.N!EEEr3   r  c                   J    e Zd Zej                            dd          Zd ZdS )IPAddressViewr  r   c                    t           j                            |j        d                              |j        t          |j        j                            	                    dd          }t          j        t          |          dd          }t          j                            |j        d                              |j        t          |j                                                |j        	          	                    d
          }|j        t"          j        k    r |                    t"          j                  }t          j        |d d         d          }||dS )Nr   )rO  rM  r   r   rS  FrU  )rO  addressrW  
nat_inside)r   
   r8   )r  duplicate_ips_table)r   r)   r   r   r   rO  r   r  r  r   r   r  r_  r  rV  rX  r   IPAddressRoleChoicesROLE_ANYCASTr  )rB   rC   rD   r`  r  duplicate_ipsr  s          r4   rE   zIPAddressView.get_extra_context  sf    .11',GGNN+.x/?/B+C+C O 
 
 
F
 
 	 !' 2!!*!
 !
 !
 ")227<HHOO()) P 
 
 '{  
 



 
 	 =0===)117K7X1YYM$3M#2#4FRWXXX &;#6
 
 	
r3   N)r%   r&   r'   r  r)   r   r+   rE   r2   r3   r4   r  r    s;         11-JJH 
  
  
  
  
r3   r  c                   X    e Zd Zej                                        Zej        Z	dZ
d ZdS )IPAddressEditViewzipam/ipaddress_edit.htmlc                    d|j         v rN	 t          j                            |j         d                   |_        n# t
          t          j        f$ r Y nw xY wd|j         v rN	 t          j                            |j         d                   |_        ns# t
          t          j        f$ r Y n[w xY wd|j         v rN	 t          j                            |j         d                   |_        n# t
          t          j        f$ r Y nw xY w|S )N	interfacerW  vminterface	fhrpgroup)	r  r   r)   r	  assigned_object
ValueErrorr\  r   	FHRPGrouprB   objrC   url_args
url_kwargss        r4   alter_objectzIPAddressEditView.alter_object  s-   '+%%&/&7&;&;w{;?W&;&X&X##	 67    gk))&1&9&=&=]A[&=&\&\## 89    GK''&/&7&;&;w{;?W&;&X&X##	 67    
s3   0< AA"0B B,+B,90C* *DDN)r%   r&   r'   r  r)   r*   r+   r   IPAddressFormrJ   r  r  r2   r3   r4   r  r    sD         $$&&HD.M    r3   r  c                   `     e Zd ZdZej                                        Z fdZd Z	d Z
 xZS )IPAddressAssignViewz@
    Search for IPAddresses to be assigned to an Interface.
    c                     d|j         vrd|j         vrt          d          S  t                      j        |g|R i |S )Nr  r  zipam:ipaddress_add)r  r   superdispatch)rB   rC   argskwargs	__class__s       r4   r  zIPAddressAssignView.dispatch:  sT     gk))m7;.N.N0111uww9$999&999r3   c           	          t          j                    }t          |d||j                            dd          d          S )Nipam/ipaddress_assign.html
return_url )rJ   r  )r   IPAddressAssignFormr   r  r	  )rB   rC   rJ   s      r4   r	  zIPAddressAssignView.getB  sG    (**g;!+//,;;>
 >
   	r3   c           	      f   t          j        |j                  }d }|                                rV| j                            dd          }t          j        |j        |          j        d d         }t          j
        |          }t          |d|||j                            d          d          S )NrO  r   d   r  r  )rJ   r1   r  )r   r  POSTis_validr+   r   r   r  qsr   IPAddressAssignTabler   r  r	  )rB   rC   rJ   r1   	addressess        r4   postzIPAddressAssignView.postJ  s    (66==?? 	;66uhGGI"5glINNQRVSVRVWI/	::Eg;!+//,77>
 >
   	r3   )r%   r&   r'   __doc__r  r)   r*   r+   r  r	  r  __classcell__r  s   @r4   r  r  4  sv           $$&&H: : : : :        r3   r  c                   @    e Zd Zej                                        ZdS )IPAddressDeleteViewNr%   r&   r'   r  r)   r*   r+   r2   r3   r4   r  r  [  r   r3   r  c                   d    e Zd Zej                                        Zej        Z	ej
        ZdZdZdS )IPAddressBulkCreateViewr  zipam/ipaddress_bulk_add.htmlN)r%   r&   r'   r  r)   r*   r+   r   IPAddressBulkCreateFormrJ   IPAddressBulkAddFormrS   pattern_targetr  r2   r3   r4   r  r  `  s<         $$&&H(D+JN2MMMr3   r  c                   N    e Zd Zej                                        Zej        Z	dS )IPAddressBulkImportViewN)
r%   r&   r'   r  r)   r*   r+   r   IPAddressImportFormrS   r2   r3   r4   r  r  h  r  r3   r  c                   l    e Zd Zej                            d          Zej        Z	e
j        Zej        ZdS )IPAddressBulkEditViewr  N)r%   r&   r'   r  r)   r   r+   r   r  r-   r   r  r1   r   IPAddressBulkEditFormrJ   r2   r3   r4   r   r   m  s<         11-@@H-I!E&DDDr3   r   c                   ^    e Zd Zej                            d          Zej        Z	e
j        ZdS )IPAddressBulkDeleteViewr  N)r%   r&   r'   r  r)   r   r+   r   r  r-   r   r  r1   r2   r3   r4   r  r  t  s4         11-@@H-I!EEEr3   r  related_ipszrelated-ip-addressesc                       e Zd Zej                            dd          ZeZej	        Z
ej        Zej        Z e ed          d dd          Zd Zd	S )
IPAddressRelatedIPsViewr  r   zRelated IPsc                 N    |                                                                  S r   )get_related_ipsr   r   s    r4   r   z IPAddressRelatedIPsView.<lambda>      ))++1133 r3   r   T)r   r   r   hide_if_emptyc                 \    |                                                     |j        d          S r  )r  r   r   r   s      r4   r   z$IPAddressRelatedIPsView.get_children  s&    %%''00vFFFr3   N)r%   r&   r'   r  r)   r   r+   r   r   r  r1   r   r  r-   r   r  r/   r   r   r   r   r2   r3   r4   r  r  z  s         11-JJHK!E-I.N
'a33	  CG G G G Gr3   r  c                   @    e Zd Zej                                        ZdS )IPAddressContactsViewNr  r2   r3   r4   r  r    r   r3   r  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )VLANGroupListViewN)r%   r&   r'   	VLANGroupr)   annotate_utilizationr+   r   VLANGroupFilterSetr-   r   VLANGroupFilterFormr/   r   VLANGroupTabler1   r2   r3   r4   r  r    s:         5577H-I.N!EEEr3   r  c                   F    e Zd Zej                                        Zd ZdS )VLANGroupViewc                 2    d|                      ||          iS r~   r   r   s      r4   rE   zVLANGroupView.get_extra_context  r   r3   N)r%   r&   r'   r  r)   r  r+   rE   r2   r3   r4   r  r    s7         5577H
 
 
 
 
r3   r  c                   N    e Zd Zej                                        Zej        Z	dS )VLANGroupEditViewN)
r%   r&   r'   r  r)   r*   r+   r   VLANGroupFormrJ   r2   r3   r4   r  r    r  r3   r  c                   @    e Zd Zej                                        ZdS )VLANGroupDeleteViewN)r%   r&   r'   r  r)   r*   r+   r2   r3   r4   r  r    r   r3   r  c                   N    e Zd Zej                                        Zej        Z	dS )VLANGroupBulkImportViewN)
r%   r&   r'   r  r)   r*   r+   r   VLANGroupImportFormrS   r2   r3   r4   r  r    r  r3   r  c                       e Zd Zej                                                            d          Zej	        Z
ej        Zej        ZdS )VLANGroupBulkEditViewtagsN)r%   r&   r'   r  r)   r  r   r+   r   r  r-   r   r  r1   r   VLANGroupBulkEditFormrJ   r2   r3   r4   r!  r!    sH         5577HHPPH-I!E&DDDr3   r!  c                       e Zd Zej                                                            d          Zej	        Z
ej        ZdS )VLANGroupBulkDeleteViewr"  N)r%   r&   r'   r  r)   r  r   r+   r   r  r-   r   r  r1   r2   r3   r4   r%  r%    s@         5577HHPPH-I!EEEr3   r%  vlansc                       e Zd Zej                                        ZeZe	j
        Zej        Zej        Z e ed          d dd          Zd Zd ZdS )	VLANGroupVLANsViewVLANsc                 N    |                                                                  S r   )get_child_vlansr   r   s    r4   r   zVLANGroupVLANsView.<lambda>  r	  r3   zipam.view_vlanr   r   c                     |                                                     |j        d                              t	          dt
          j                            |j                            ddd          S )Nr   r   )r+   r   r   r   )r+  r   r   r   r   r   r)   r   s      r4   r   zVLANGroupVLANsView.get_children  sa    %%''00vFFWWZ&.*A*A',*O*OPPPff
 
 	
r3   c                 P    t          || j                  st          ||          S |S r   )r   r1   r"   r  s       r4   r  z"VLANGroupVLANsView.prep_table_data  s+    !'4:66 	9&x888r3   N)r%   r&   r'   r  r)   r*   r+   r/  r   r   	VLANTabler1   r   VLANFilterSetr-   r   VLANFilterFormr/   r   r   r   r   r  r2   r3   r4   r(  r(    s         $$&&HKE(I)N
'ajj33#	  C
 
 
    r3   r(  c                       e Zd Zej                             eed                    Ze	j
        Zej        Zej        ZdS )FHRPGroupListViewgroup)member_countN)r%   r&   r'   r  r)   rv   r   FHRPGroupAssignmentr+   r   FHRPGroupFilterSetr-   r   FHRPGroupFilterFormr/   r   FHRPGroupTabler1   r2   r3   r4   r2  r2    sU         ))"]#6@@ *  H -I.N!EEEr3   r2  c                   F    e Zd Zej                                        Zd ZdS )FHRPGroupViewc                 :   t          j        t          j                            |j        d                              |          d          }|j                            d           |t          j                            |          	                                dS )Nr   )r3  F)datar9   r3  )members_tabler4  )
r   FHRPGroupAssignmentTabler5  r)   r   r   r   columnshider   )rB   rC   rD   r=  s       r4   rE   zFHRPGroupView.get_extra_context  s    7$,55glFKKRRYaRbb
 
 
 	""7+++ +/7>>X>NNTTVV
 
 	
r3   N)r%   r&   r'   r  r)   r*   r+   rE   r2   r3   r4   r:  r:    s7         $$&&H
 
 
 
 
r3   r:  c                   f     e Zd Zej                                        Zej        Z	d fd	Z
d Z xZS )FHRPGroupEditViewNc                     t                                          ||          }|                    t          d                    r|d|j         z  }|S )Nzipam:fhrpgroupassignment_addz&group=)r  get_return_url
startswithr	   rX  )rB   rC   r  r  r  s       r4   rD  z FHRPGroupEditView.get_return_url  sX    WW++GS99
   )G!H!HII 	-,CF,,,Jr3   c                     |j         |_        |S r   )r   _userr  s        r4   r  zFHRPGroupEditView.alter_object  s     L	
r3   r   )r%   r&   r'   r  r)   r*   r+   r   FHRPGroupFormrJ   rD  r  r  r  s   @r4   rB  rB    sh         $$&&HD           r3   rB  c                   @    e Zd Zej                                        ZdS )FHRPGroupDeleteViewN)r%   r&   r'   r  r)   r*   r+   r2   r3   r4   rJ  rJ    r   r3   rJ  c                   N    e Zd Zej                                        Zej        Z	dS )FHRPGroupBulkImportViewN)
r%   r&   r'   r  r)   r*   r+   r   FHRPGroupImportFormrS   r2   r3   r4   rL  rL    r  r3   rL  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )FHRPGroupBulkEditViewN)r%   r&   r'   r  r)   r*   r+   r   r6  r-   r   r8  r1   r   FHRPGroupBulkEditFormrJ   r2   r3   r4   rO  rO    s:         $$&&H-I!E&DDDr3   rO  c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )FHRPGroupBulkDeleteViewN)r%   r&   r'   r  r)   r*   r+   r   r6  r-   r   r8  r1   r2   r3   r4   rR  rR  #  s2         $$&&H-I!EEEr3   rR  c                   Z    e Zd Zej                                        Zej        Z	d Z
d ZdS )FHRPGroupAssignmentEditViewc                     |j         snt          t          |j                            d                    }t          |                                |j                            d                    |_        |S )Ninterface_typerW  interface_id)rX  r   r   r  r	  model_classr  )rB   rD   rC   r  r  content_types         r4   r  z(FHRPGroupAssignmentEditView.alter_object2  sg    { 	s,[W[__M]=^=^___L!2<3K3K3M3MRYR]RaRabpRqRq!r!r!rHr3   c                 l    |j                             d          |j                             d          dS )NrV  rW  )rV  rW  )r  r	  )rB   rC   s     r4   get_extra_addanother_paramsz7FHRPGroupAssignmentEditView.get_extra_addanother_params9  s4    %koo.>??#KOON;;
 
 	
r3   N)r%   r&   r'   r5  r)   r*   r+   r   FHRPGroupAssignmentFormrJ   r  r[  r2   r3   r4   rT  rT  -  sN        "*..00H(D  
 
 
 
 
r3   rT  c                   @    e Zd Zej                                        ZdS )FHRPGroupAssignmentDeleteViewN)r%   r&   r'   r5  r)   r*   r+   r2   r3   r4   r^  r^  @  s"        "*..00HHHr3   r^  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )VLANListViewN)r%   r&   r'   r/  r)   r*   r+   r   r/  r-   r   r0  r/   r   r.  r1   r2   r3   r4   r`  r`  I  s9        |!!H(I)NEEEr3   r`  c                   F    e Zd Zej                                        Zd ZdS )VLANViewc                     t           j                            |j        d                              |                              dddd          }t          j        t          |          dd	          }d
|iS )Nr   )r   rO  r   r   r   )r   rT  FrU  prefix_table)	r   r)   r   r   r   r   r   r  r_  )rB   rC   rD   r   rd  s        r4   rE   zVLANView.get_extra_contextT  sw    >**7<@@GGXGVVgg668
 
 )$x..BYejkkk L
 	
r3   N)r%   r&   r'   r/  r)   r*   r+   rE   r2   r3   r4   rb  rb  P  s6        |!!H
 
 
 
 
r3   rb  
interfacesc                       e Zd Zej                                        ZeZe	j
        ZeZeZ e ed          d dd          Zd ZdS )VLANInterfacesViewzDevice Interfacesc                 N    |                                                                  S r   )get_interfacesr   r   s    r4   r   zVLANInterfacesView.<lambda>h  r   r3   zdcim.view_interfacer   r   c                 \    |                                                     |j        d          S r  )ri  r   r   r   s      r4   r   zVLANInterfacesView.get_childrenm  s&    $$&&//fEEEr3   N)r%   r&   r'   r/  r)   r*   r+   r   r   r   VLANDevicesTabler1   r   r-   r   r/   r   r   r   r   r2   r3   r4   rg  rg  _  s        |!!HK#E"I(N
'a#$$22(	  CF F F F Fr3   rg  vminterfaceszvm-interfacesc                       e Zd Zej                                        ZeZe	j
        ZeZeZ e ed          d dd          Zd ZdS )VLANVMInterfacesViewzVM Interfacesc                 N    |                                                                  S r   )get_vminterfacesr   r   s    r4   r   zVLANVMInterfacesView.<lambda>z  rp  r3   zvirtualization.view_vminterfacei  r   c                 \    |                                                     |j        d          S r  )rp  r   r   r   s      r4   r   z!VLANVMInterfacesView.get_children  s&    &&((11',GGGr3   N)r%   r&   r'   r/  r)   r*   r+   r   r   r   VLANVirtualMachinesTabler1   r   r-   r   r/   r   r   r   r   r2   r3   r4   rn  rn  q  s        |!!HK+E$I*N
'a  444	  CH H H H Hr3   rn  c                   R    e Zd Zej                                        Zej        Z	dZ
dS )VLANEditViewzipam/vlan_edit.htmlN)r%   r&   r'   r/  r)   r*   r+   r   VLANFormrJ   r  r2   r3   r4   rt  rt    s-        |!!H>D)MMMr3   rt  c                   @    e Zd Zej                                        ZdS )VLANDeleteViewN)r%   r&   r'   r/  r)   r*   r+   r2   r3   r4   rw  rw    r;  r3   rw  c                   N    e Zd Zej                                        Zej        Z	dS )VLANBulkImportViewN)
r%   r&   r'   r/  r)   r*   r+   r   VLANImportFormrS   r2   r3   r4   ry  ry    r?  r3   ry  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )VLANBulkEditViewN)r%   r&   r'   r/  r)   r*   r+   r   r/  r-   r   r.  r1   r   VLANBulkEditFormrJ   r2   r3   r4   r|  r|    rC  r3   r|  c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )VLANBulkDeleteViewN)r%   r&   r'   r/  r)   r*   r+   r   r/  r-   r   r.  r1   r2   r3   r4   r  r    rF  r3   r  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )ServiceTemplateListViewN)r%   r&   r'   ServiceTemplater)   r*   r+   r   ServiceTemplateFilterSetr-   r   ServiceTemplateFilterFormr/   r   ServiceTemplateTabler1   r2   r3   r4   r  r    s:        &**,,H3I4N'EEEr3   r  c                   @    e Zd Zej                                        ZdS )ServiceTemplateViewNr%   r&   r'   r  r)   r*   r+   r2   r3   r4   r  r    "        &**,,HHHr3   r  c                   N    e Zd Zej                                        Zej        Z	dS )ServiceTemplateEditViewN)
r%   r&   r'   r  r)   r*   r+   r   ServiceTemplateFormrJ   r2   r3   r4   r  r    s*        &**,,H$DDDr3   r  c                   @    e Zd Zej                                        ZdS )ServiceTemplateDeleteViewNr  r2   r3   r4   r  r    r  r3   r  c                   N    e Zd Zej                                        Zej        Z	dS )ServiceTemplateBulkImportViewN)
r%   r&   r'   r  r)   r*   r+   r   ServiceTemplateImportFormrS   r2   r3   r4   r  r    s*        &**,,H0JJJr3   r  c                   j    e Zd Zej                                        Zej        Z	e
j        Zej        ZdS )ServiceTemplateBulkEditViewN)r%   r&   r'   r  r)   r*   r+   r   r  r-   r   r  r1   r   ServiceTemplateBulkEditFormrJ   r2   r3   r4   r  r    s:        &**,,H3I'E,DDDr3   r  c                   \    e Zd Zej                                        Zej        Z	e
j        ZdS )ServiceTemplateBulkDeleteViewN)r%   r&   r'   r  r)   r*   r+   r   r  r-   r   r  r1   r2   r3   r4   r  r    s2        &**,,H3I'EEEr3   r  c                   n    e Zd Zej                            dd          Zej        Z	e
j        Zej        ZdS )ServiceListViewdevicevirtual_machineN)r%   r&   r'   Servicer)   r   r+   r   ServiceFilterSetr-   r   ServiceFilterFormr/   r   ServiceTabler1   r2   r3   r4   r  r    s>        //:KLLH+I,NEEEr3   r  c                   @    e Zd Zej                                        ZdS )ServiceViewNr%   r&   r'   r  r)   r*   r+   r2   r3   r4   r  r    r  r3   r  c                   N    e Zd Zej                                        Zej        Z	dS )ServiceCreateViewN)
r%   r&   r'   r  r)   r*   r+   r   ServiceCreateFormrJ   r2   r3   r4   r  r    s)        ""$$H"DDDr3   r  c                   N    e Zd Zej                                        Zej        Z	dS )ServiceEditViewN)
r%   r&   r'   r  r)   r*   r+   r   ServiceFormrJ   r2   r3   r4   r  r    r  r3   r  c                   @    e Zd Zej                                        ZdS )ServiceDeleteViewNr  r2   r3   r4   r  r    r  r3   r  c                   N    e Zd Zej                                        Zej        Z	dS )ServiceBulkImportViewN)
r%   r&   r'   r  r)   r*   r+   r   ServiceImportFormrS   r2   r3   r4   r  r    r  r3   r  c                   n    e Zd Zej                            dd          Zej        Z	e
j        Zej        ZdS )ServiceBulkEditViewr  r  N)r%   r&   r'   r  r)   r   r+   r   r  r-   r   r  r1   r   ServiceBulkEditFormrJ   r2   r3   r4   r  r    s>        //:KLLH+IE$DDDr3   r  c                   `    e Zd Zej                            dd          Zej        Z	e
j        ZdS )ServiceBulkDeleteViewr  r  N)r%   r&   r'   r  r)   r   r+   r   r  r-   r   r  r1   r2   r3   r4   r  r    s6        //:KLLH+IEEEr3   r  c                   @    e Zd Zej                                        ZdS )ServiceContactsViewNr  r2   r3   r4   r  r     r  r3   r  N)"django.contrib.contenttypes.modelsr   django.db.modelsr   django.db.models.expressionsr   django.shortcutsr   r   r   django.urlsr	   django.utils.translationr
   r   circuits.modelsr   dcim.filtersetsr   
dcim.formsr   dcim.modelsr   r   netbox.viewsr   tenancy.viewsr   utilities.queryr   utilities.tablesr   utilities.viewsr   r   r   virtualization.filtersetsr   virtualization.formsr   virtualization.modelsr   r  r   r   r   choicesr   	constantsmodelsutilsr    r!   r"   ObjectListViewr$   r(   
ObjectViewr6   ObjectEditViewrH   ObjectDeleteViewrN   BulkImportViewrQ   BulkEditViewrV   BulkDeleteViewrY   r[   r\   r`   rd   rg   ri   rl   ro   rq   ru   r|   r   r   r   r   r   r   r   r   ObjectChildrenViewr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rw   r   r   r  r  r  r!  r$  r'  r)  r-  r4  r7  r:  r=  rA  rE  rH  r   rJ  rc  rm  r}  r  r  r  r  r  r  r  r.  r  r  r  r  r  r  r  r  r  r  r  r  r  r  BulkCreateViewr  r  r   r  r  r  r  r  r  r  r  r  r!  r%  r(  r2  r  r:  rB  rJ  rL  rO  rR  r5  rT  r^  r`  r/  rb  rg  rn  rt  rw  ry  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r2   r3   r4   <module>r     sH   : : : : : : % % % % % % / / / / / / @ @ @ @ @ @ @ @ @ @       1 1 1 1 1 1 $ $ $ $ $ $ . . . . . . * * * * * * ' ' ' ' ' ' ' '             , , , , , , ) ) ) ) ) ) / / / / / / O O O O O O O O O O : : : : : : 6 6 6 6 6 6 - - - - - - ' ' ' ' ' ' ' ' ' ' ( ( ( ( ( (         Y Y Y Y Y Y Y Y Y Y    '(    S
 
 
 
 
#W%7 
 
 
( S&!!    '(   "!
 S(##! ! ! ! !G, ! ! $#!% % % % %. % % %
! ! ! ! !g* ! ! !    .   $ $ $ $ $'0 $ $ $ [!!) ) ) ) )g( ) ) "!) [&))! ! ! ! !'0 ! ! *)!
 [(++) ) ) ) )G4 ) ) ,+)- - - - - 6 - - -
) ) ) ) )g2 ) ) )$ $ $ $ $ 6 $ $ $    '(    S
 
 
 
 
#W%7 
 
 
 S&!!    '(   "!
 S(##! ! ! ! !G, ! ! $#!% % % % %. % % %
! ! ! ! !g* ! ! !    .   ! ! ! ! !w- ! ! ! X& & & & &7% & & & Xv&&
 
 
 
 
w1 
 
 '&
( Xv&&    w-   '&
 Xx((& & & & &1 & & )(&* * * * *W3 * * *
& & & & &7/ & & &! ! ! ! !W3 ! ! !    '(    S
 
 
 
 
#W%7 
 
 
  S&!!    '(   "!
 S(##! ! ! ! !G, ! ! $#!% % % % %. % % %
! ! ! ! !g* ! ! !    .   " " " " ". " " " Y' ' ' ' 'G& ' '  ' Y
++ 
  
  
  
  
G6  
  
 ,+ 
F Y''    .   ('
 Y))' ' ' ' ''2 ' ' *)'+ + + + +g4 + + +
' ' ' ' 'G0 ' ' '" " " " "g4 " " " Y
++' ' ' ' '. ' ' ,+'    7)    T
 
 
 
 
$g&8 
 
 
 T6""    7)   #"
 T8$$" " " " "W- " " %$"& & & & &/ & & &
" " " " "w+ " " "    /   , , , , ,W+ , , , V+
 +
 +
 +
 +
# +
 +
 +
\ VZ(( 
  
  
  
  
3  
  
 )( 
F VZk:::
 
 
 
 
3 
 
 ;:
4 V]@@@
 
 
 
 
G6 
 
 A@
: VV$$    W+   %$
 VX&&$ $ $ $ $w/ $ $ '&$( ( ( ( (71 ( ( (
$ $ $ $ $- $ $ $    71    VZ(($ $ $ $ $+ $ $ )($         g,       W
 
 
 
 
'$ 
 
 
0 Wm.AAAE E E E EW7 E E BAE$ Wf%%    g,   &%
 Wh''% % % % %0 % % ('%) ) ) ) )G2 ) ) )
% % % % %'. % % %         G2       Wj))% % % % %, % % *)%" " " " ". " " " Y#
 #
 #
 #
 #
G& #
 #
  #
L Y''    .   (':$ $ $ $ $', $ $ $N Y))' ' ' ' ''2 ' ' *)'3 3 3 3 3g4 3 3 3+ + + + +g4 + + +
' ' ' ' 'G0 ' ' '" " " " "g4 " " " Y4JKKKG G G G Gg8 G G LKG" Y
++' ' ' ' '. ' ' ,+'" " " " ". " " " Y
 
 
 
 
)7+= 
 
  
 Y''    .   ('
 Y))' ' ' ' ''2 ' ' *)'+ + + + +g4 + + +
' ' ' ' 'G0 ' ' '" " " " "g4 " " " Y((    3   )(:" " " " ". " " " Y
 
 
 
 
G& 
 
  
" Y''    .   ('* Y))' ' ' ' ''2 ' ' *)'+ + + + +g4 + + +
' ' ' ' 'G0 ' ' '" " " " "g4 " " " (&11
 
 
 
 
'"8 
 
 21
$ ((331 1 1 1 1G$< 1 1 431    7)    T
 
 
 
 
w! 
 
 
 T<((F F F F F3 F F )(F" T>@@@H H H H H75 H H A@H" T6""* * * * *7) * * #"* T8$$" " " " "W- " " %$"& & & & &/ & & &
" " " " "w+ " " "    /   ( ( ( ( (g4 ( ( ( _%%- - - - -', - - &%- _f--% % % % %g4 % % .-%
 _h//- - - - - 8 - - 0/-1 1 1 1 1G$: 1 1 1
- - - - -'"6 - - -( ( ( ( (G$: ( ( (         g,       W% % % % %'$ % % %# # # # #. # # #
 Wf%%    g,   &%
 Wh''% % % % %0 % % ('%) ) ) ) )G2 ) ) )
% % % % %'. % % %         G2       Wj))% % % % %, % % *)% % %r3   