
    >TfD              
       \   d dl Z d dl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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T d dlT 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'm(Z( d dl)m*Z*m+Z+ d dl,m-Z-m.Z.m/Z/ d dl0m1Z1 ddl2T ddl3m4Z4m5Z5 dZ6 G d de*e'          Z7 G d de+e(e5          Z8 G d de+e(e5          Z9 G d d e'          Z: G d! d"e'          Z;d,d#Z< G d$ d%e*e+e4ee1e(          Z= G d& d'e(e          Z> G d( d)e(          Z? G d* d+e(          Z@dS )-    N)cached_property)ValidationError)default_storage)MaxValueValidatorMinValueValidator)models)FProtectedError)Lower)	post_save)reverse)	mark_safe)gettext_lazy)*)ConfigContextModelCustomField)ConfigContextModelQuerySet)ColorChoices)
ConfigItem)OrganizationalModelPrimaryModel)ContactsMixinImageAttachmentsMixin)
ColorFieldCounterCacheFieldNaturalOrderingField)TrackingModelMixin   )RenderConfigMixinWeightMixin)	Device
DeviceRole
DeviceTypeManufacturerModule
ModuleTypePlatformVirtualChassisVirtualDeviceContextc                   2    e Zd ZdZ G d d          Zd ZdS )r$   zl
    A Manufacturer represents a company which produces hardware devices; for example, Juniper or Dell.
    c                   >    e Zd ZdZ ed          Z ed          ZdS )Manufacturer.MetanamemanufacturermanufacturersN__name__
__module____qualname__ordering_verbose_nameverbose_name_plural     8/var/www/html/netbox-4.1.3/netbox/dcim/models/devices.pyMetar,   4   s4        q((a00r:   r<   c                 0    t          d| j        g          S )Nzdcim:manufacturerargsr   pkselfs    r;   get_absolute_urlzManufacturer.get_absolute_url9   s    *$';;;;r:   N)r2   r3   r4   __doc__r<   rD   r9   r:   r;   r$   r$   0   sU         1 1 1 1 1 1 1 1
< < < < <r:   r$   c            
           e Zd ZdZ ej        dej        d          Z ej         e	d          d          Z
 ej         e	d          d          Z ej        d	ej        d
dd e	d                    Z ej         e	d          dd e	d                    Z ej        ddd e	d                    Z ej        d e	d           e	d                    Z ej        d e	d           e	d                    Z ej        ded e	d           e	d                    Z ej         e	d           ded!          Z ej        d"d#          Z ej        d"d#          Z ed$d%&          Z ed'd%&          Z ed(d%&          Z ed)d%&          Z  ed*d%&          Z! ed+d%&          Z" ed,d%&          Z# ed-d%&          Z$ ed.d%&          Z% ed/d%&          Z&d0Z'd1Z( G d2 d3          Z)d4 Z* fd5Z+d6 Z,e-d7             Z.d8 Z/ fd9Z0 fd:Z1 fd;Z2e-d<             Z3e-d=             Z4 xZ5S )>r#   ay  
    A DeviceType represents a particular make (Manufacturer) and model of device. It specifies rack height and depth, as
    well as high-level functional role(s).

    Each DeviceType can have an arbitrary number of component templates assigned to it, which define console, power, and
    interface objects. For example, a Juniper EX4300-48T DeviceType would have:

      * 1 ConsolePortTemplate
      * 2 PowerPortTemplates
      * 48 InterfaceTemplates

    When a new Device of this type is created, the appropriate console, power, and interface objects (as defined by the
    DeviceType) are automatically created as well.
    dcim.Manufacturerdevice_typesto	on_deleterelated_namemodeld   r7   
max_lengthslugdcim.Platform+Tzdefault platformrJ   rK   rL   blanknullr7   part number2   Discrete part number (optional)r7   rP   rU   	help_text   r   g      ?z
height (U))
max_digitsdecimal_placesdefaultr7   Fzexclude from utilizationzDDevices of this type are excluded when calculating rack utilization.r_   r7   r[   zis full depthz/Device consumes both front and rear rack faces.zparent/child statuszsParent devices house child devices in device bays. Leave blank if this device type is neither a parent nor a child.)rP   choicesrU   r7   r[   airflowr7   rP   ra   rU   zdevicetype-images)	upload_torU   zdcim.ConsolePortTemplatedevice_typeto_modelto_fieldzdcim.ConsoleServerPortTemplatezdcim.PowerPortTemplatezdcim.PowerOutletTemplatezdcim.InterfaceTemplatezdcim.FrontPortTemplatezdcim.RearPortTemplatezdcim.DeviceBayTemplatezdcim.ModuleBayTemplatezdcim.InventoryItemTemplate)r/   default_platformu_heightis_full_depthsubdevice_rolerb   weightweight_unitrG   c                       e Zd ZddgZ ej        dd           ej        dd          fZ ed          Z ed	          Z	d
S )DeviceType.Metar/   rM   r/   rM   1%(app_label)s_%(class)s_unique_manufacturer_modelfieldsr.   )r/   rQ   z0%(app_label)s_%(class)s_unique_manufacturer_slugzdevice typezdevice typesN
r2   r3   r4   r5   r   UniqueConstraintconstraintsr6   r7   r8   r9   r:   r;   r<   rq      s~        "G,#F#0H   $F#/G  	
 q''a//r:   r<   c                     | j         S NrM   rB   s    r;   __str__zDeviceType.__str__   
    zr:   c                      t                      j        |i | | j                            d          | _        | j                            d          | _        | j                            d          | _        d S )Nrj   front_image
rear_image)super__init____dict__get_original_u_height_original_front_image_original_rear_imagerC   r?   kwargs	__class__s      r;   r   zDeviceType.__init__   sq    $)&))) #'-"3"3J"?"? &*]%6%6}%E%E"$(M$5$5l$C$C!!!r:   c                 0    t          d| j        g          S )Nzdcim:devicetyper>   r@   rB   s    r;   rD   zDeviceType.get_absolute_url       (y9999r:   c                 $    | j          d| j         S N rr   rB   s    r;   	full_namezDeviceType.full_name       #22dj222r:   c                    | j         j        | j        | j        | j        | j        r| j        j        nd | j        t          | j                  | j	        | j
        | j        | j        t          | j                  nd | j        | j        d}| j                                        r&d | j                                        D             |d<   | j                                        r&d | j                                        D             |d<   | j                                        r&d | j                                        D             |d<   | j                                        r&d | j                                        D             |d	<   | j                                        r&d
 | j                                        D             |d<   | j                                        r&d | j                                        D             |d<   | j                                        r&d | j                                        D             |d<   | j                                        r&d | j                                        D             |d<   | j                                        r&d | j                                        D             |d<   t5          j        t9          |          d          S )N)r/   rM   rQ   descriptionri   part_numberrj   rk   rl   rb   rm   rn   commentsc                 6    g | ]}|                                 S r9   to_yaml.0cs     r;   
<listcomp>z&DeviceType.to_yaml.<locals>.<listcomp>   -     % % % !		% % %r:   console-portsc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>   -     , , , !		, , ,r:   console-server-portsc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>   -     # # # !		# # #r:   power-portsc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>  r   r:   power-outletsc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>  -     " " " !		" " "r:   
interfacesc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>
  r   r:   front-portsc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>  r   r:   
rear-portsc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>  r   r:   zmodule-baysc                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&DeviceType.to_yaml.<locals>.<listcomp>  r   r:   zdevice-baysF	sort_keys)r/   r.   rM   rQ   r   ri   r   floatrj   rk   rl   rb   rm   rn   r   consoleporttemplatesexistsallconsoleserverporttemplatespowerporttemplatespoweroutlettemplatesinterfacetemplatesfrontporttemplatesrearporttemplatesmodulebaytemplatesdevicebaytemplatesyamldumpdictrC   datas     r;   r   zDeviceType.to_yaml   sG    -2ZI+>B>S ] 5 : :Y]+dm,,!/"1|,0K,CeDK(((+
 
" $++-- 	% %%)%>%B%B%D%D% % %D! *1133 	, ,%)%D%H%H%J%J, , ,D'( "))++ 	# #%)%<%@%@%B%B# # #D $++-- 	% %%)%>%B%B%D%D% % %D! "))++ 	" "%)%<%@%@%B%B" " "D "))++ 	# #%)%<%@%@%B%B# # #D !((** 	" "%)%;%?%?%A%A" " "D "))++ 	# #%)%<%@%@%B%B# # #D "))++ 	# #%)%<%@%@%B%B# # #D ydu5555r:   c           	         t                                                       t          j        | j                  t          j        d          z  rt          dt          d          i          | j        j        s| j        | j	        k    rt          j                            | d          D ]}| j        rd n|j        }|j                            | j        ||j        g          }|j        |vr>t          dt          d                              ||j        | j                  i          n| j        j        s| j	        d	k    r| j        d	k    rt          j                            | d                                          }|rat+          d
           d| j         d| j         }t          dt/          t          d                              ||                    i          | j        t2          j        k    r>| j        r7| j                                        rt          dt          d          i          | j        r3| j        t2          j        k    r t          dt          d          i          d S d S )N      ?rj   z1U height must be in increments of 0.5 rack units.F)re   position__isnullrj   	rack_faceexcludezbDevice {device} in rack {rack} does not have sufficient space to accommodate a height of {height}U)devicerackheightr   zdcim:device_listz?manufactuer_id=z&device_type_id=zrUnable to set 0U height: Found <a href="{url}">{racked_instance_count} instances</a> already mounted within racks.)urlracked_instance_countrl   zlMust delete all device bay templates associated with this device before declassifying it as a parent device.zChild device types must be 0U.)r   cleandecimalDecimalrj   r   r6   _stateaddingr   r!   objectsfilterrk   facer   get_available_unitsrA   positionformatcountr   manufacturer_idr   rl   SubdeviceRoleChoicesROLE_PARENTr   
ROLE_CHILD)rC   dface_requiredu_availabler   r   r   s         r;   r   zDeviceType.clean  s    ?4=))GOC,@,@@ 	!AQRR#    {! 	dmd6M&M&M^**te*TT  (,(: Ff88!]+TF 9  
 :[00)"A2% % !&t}&MM	+    1  # 	(?!(C(CYZHZHZ$*N$9$9 !& %: % % egg " %  !344uudFZuulplsuu%	!0+ + f<QfRR!T !T'    #';'GGGg H17799 H! ! %I #J #J#   
 = 	T04H4SSS!A>??#   	 	SSr:   c                      t                      j        |i |}| j        r)| j        | j        k    rt	          j        | j                   | j        r)| j        | j        k    rt	          j        | j                   |S rz   )r   saver   r   r   deleter   r   )rC   r?   r   retr   s       r;   r   zDeviceType.saveT  s    egglD+F++ % 	?$*:d>X*X*X"4#=>>>$ 	>D<U)U)U"4#<===
r:   c                      t                      j        |i | | j        r| j                            d           | j        r| j                            d           d S d S )NF)r   )r   r   r   r   r   s      r;   r   zDeviceType.delete_  sx    ''''  	0###///? 	/O""".....	/ 	/r:   c                 ,    | j         t          j        k    S rz   )rl   r   r   rB   s    r;   is_parent_devicezDeviceType.is_parent_deviceh  s    "&:&FFFr:   c                 ,    | j         t          j        k    S rz   )rl   r   r   rB   s    r;   is_child_devicezDeviceType.is_child_devicel  s    "&:&EEEr:   )6r2   r3   r4   rE   r   
ForeignKeyPROTECTr/   	CharFieldr6   rM   	SlugFieldrQ   SET_NULLri   r   DecimalFieldrj   BooleanFieldexclude_from_utilizationrk   r   rl   DeviceAirflowChoicesrb   
ImageFieldr   r   r   console_port_template_count"console_server_port_template_countpower_port_template_countpower_outlet_template_countinterface_template_countfront_port_template_countrear_port_template_countdevice_bay_template_countmodule_bay_template_countinventory_item_template_countclone_fieldsprerequisite_modelsr<   r|   r   rD   propertyr   r   r   r   r   r   r   __classcell__r   s   @r;   r#   r#   =   s         %6$.#  L
 FQwZZ  E 6QvYY  D )v(/Q)**   #&"Q}%%!566	  K #v"Q|__	  H  3v2Q122!Z[[     
 (F'Q''!EFF  M
 &V%$Q,--! K L L  N fQy\\$	  G $&#%  K #"%  J #4"3+# # # *;):1* * *& !2 1)! ! ! #4"3+# # #  10)      !2 1)! ! !  10(      !2 1)! ! ! !2 1)! ! ! %6$5-% % %!
L0 0 0 0 0 0 0 0  D D D D D: : : 3 3 X376 76 76r6 6 6 6 6p	 	 	 	 	/ / / / / G G XG F F XF F F F Fr:   r#   c                   H   e Zd ZdZ ej        dej        d          Z ej         e	d          d          Z
 ej         e	d          d	d
 e	d                    Z ej         e	d          d	ed
          ZdZdZ G d d          Zd Zd Zed             Zd ZdS )r&   a  
    A ModuleType represents a hardware element that can be installed within a device and which houses additional
    components; for example, a line card within a chassis-based switch such as the Cisco Catalyst 6500. Like a
    DeviceType, each ModuleType can have console, power, interface, and pass-through port templates assigned to it. It
    cannot, however house device bays or module bays.
    rG   module_typesrI   rM   rN   rO   rW   rX   TrY   rZ   rb   rc   )r/   rm   rn   rb   ro   c                   d    e Zd ZdZ ej        dd          fZ ed          Z ed          Z	dS )ModuleType.Metarr   rs   rt   zmodule typezmodule typesNrv   r9   r:   r;   r<   r    sZ        ,#F#0H  
 q''a//r:   r<   c                     | j         S rz   r{   rB   s    r;   r|   zModuleType.__str__  r}   r:   c                 0    t          d| j        g          S )Nzdcim:moduletyper>   r@   rB   s    r;   rD   zModuleType.get_absolute_url  r   r:   c                 $    | j          d| j         S r   rr   rB   s    r;   r   zModuleType.full_name  r   r:   c                 J   | j         j        | j        | j        | j        | j        t          | j                  nd | j        | j        d}| j	        
                                r&d | j	                                        D             |d<   | j        
                                r&d | j                                        D             |d<   | j        
                                r&d | j                                        D             |d<   | j        
                                r&d | j                                        D             |d	<   | j        
                                r&d
 | j                                        D             |d<   | j        
                                r&d | j                                        D             |d<   | j        
                                r&d | j                                        D             |d<   t%          j        t)          |          d          S )N)r/   rM   r   r   rm   rn   r   c                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&ModuleType.to_yaml.<locals>.<listcomp>  r   r:   r   c                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&ModuleType.to_yaml.<locals>.<listcomp>  r   r:   r   c                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&ModuleType.to_yaml.<locals>.<listcomp>  r   r:   r   c                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&ModuleType.to_yaml.<locals>.<listcomp>  r   r:   r   c                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&ModuleType.to_yaml.<locals>.<listcomp>  r   r:   r   c                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&ModuleType.to_yaml.<locals>.<listcomp>  r   r:   r   c                 6    g | ]}|                                 S r9   r   r   s     r;   r   z&ModuleType.to_yaml.<locals>.<listcomp>  r   r:   r   Fr   )r/   r.   rM   r   r   rm   r   rn   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s     r;   r   zModuleType.to_yaml  sw    -2Z++,0K,CeDK(((+
 
 $++-- 	% %%)%>%B%B%D%D% % %D! *1133 	, ,%)%D%H%H%J%J, , ,D'( "))++ 	# #%)%<%@%@%B%B# # #D $++-- 	% %%)%>%B%B%D%D% % %D! "))++ 	" "%)%<%@%@%B%B" " "D "))++ 	# #%)%<%@%@%B%B# # #D !((** 	" "%)%;%?%?%A%A" " "D ydu5555r:   N)r2   r3   r4   rE   r   r   r   r/   r   r6   rM   r   ModuleAirflowChoicesrb   r   r   r<   r|   rD   r   r   r   r9   r:   r;   r&   r&   q  sX         %6$.#  L
 FQwZZ  E #&"Q}%%!566	  K fQy\\$	  G HL	0 	0 	0 	0 	0 	0 	0 	0  : : : 3 3 X3)6 )6 )6 )6 )6r:   r&   c                       e Zd ZdZ e ed          ej                  Z e	j
        d ed           ed                    Z e	j        de	j        d	dd
          Z G d d          Zd ZdS )r"   a  
    Devices are organized by functional role; for example, "Core Switch" or "File Server". Each DeviceRole is assigned a
    color to be used when displaying rack elevations. The vm_role field determines whether the role is applicable to
    virtual machines as well.
    color)r7   r_   TzVM rolez-Virtual machines may be assigned to this roler`   extras.ConfigTemplatedevice_rolesrJ   rK   rL   rU   rV   c                   >    e Zd ZdZ ed          Z ed          ZdS )DeviceRole.Metar-   zdevice rolezdevice rolesNr1   r9   r:   r;   r<   r    s4        q''a//r:   r<   c                 0    t          d| j        g          S )Nzdcim:deviceroler>   r@   rB   s    r;   rD   zDeviceRole.get_absolute_url  r   r:   N)r2   r3   r4   rE   r   r6   r   
COLOR_GREYr  r   r   vm_roler   r   config_templater<   rD   r9   r:   r;   r"   r"     s         
 JQwZZ'  E "f!Qy\\!CDD  G
 (f'".#  O0 0 0 0 0 0 0 0
: : : : :r:   r"   c            
           e Zd ZdZ ej        dej        ddd ed                    Z ej        dej        ddd          Z	 G d	 d
          Z
d ZdS )r'   z
    Platform refers to the software or firmware running on a Device. For example, "Cisco IOS-XR" or "Juniper Junos". A
    Platform may optionally be associated with a particular Manufacturer.
    rG   	platformsTzCOptionally limit this platform to devices of a certain manufacturer)rJ   rK   rL   rU   rV   r[   r  r  c                   >    e Zd ZdZ ed          Z ed          ZdS )Platform.Metar-   platformr  Nr1   r9   r:   r;   r<   r!    s0        q}}annr:   r<   c                 0    t          d| j        g          S )Nzdcim:platformr>   r@   rB   s    r;   rD   zPlatform.get_absolute_url  s    dgY7777r:   N)r2   r3   r4   rE   r   r   r   r6   r/   r  r<   rD   r9   r:   r;   r'   r'     s          %6$. !YZZ  L (f'".   O- - - - - - - -
8 8 8 8 8r:   r'   c                 ~   |                     d          D ]}t          j                            | |                    |                    }|j        rgt          j                            | |j                            |                    |_        |                                 |                                 dS )z
    Used for device and module instantiation. Iterates all InterfaceTemplates with a bridge assigned
    and applies it to the actual interfaces.
    N)bridge)moduler   r.   )r   	Interfacer   r   resolve_namer%  
full_cleanr   )r   interface_templatesr&  interface_template	interfaces        r;   update_interface_bridgesr.    s    
 2999FF  %))>P>]>]ek>]>l>l)mm	$ 	(044FI[IbIoIow}IoI~I~4I  """NN r:   c                   0    e Zd ZdZ ej        dej        d          Z ej        dej        d ed                    Z	 ej        d	ej        dd
d
          Z
 ej        dej        dd
d
          Z ej         ed          dd
d
          Z eddd
d
          Z ej        dd
 ed           ed                    Z ej        dd
d
d
 ed           ed                    Z ej        dej        d          Z ej        dej        dd
d
          Z ej        dej        dd
d
          Z ej        ddd
d
 ed           eedz             g ed           ed           !          Z ej        dd
e ed"          #          Z ej         ed$          deej        %          Z ej         ed&          de d
'          Z! ej"        d(ej        d)d
d
 ed*          +          Z# ej"        d(ej        d)d
d
 ed,          +          Z$ ej"        d(ej        d)d
d
 ed-          +          Z% ej        d.ej        dd
d
          Z& ej        d/ej        d0d
d
          Z' ej(         ed1          d
d
 ed2          3          Z) ej*         ed4          d
d
 ed5          g ed6          7          Z+ ej         ed8          d9d:d
d
 ed;          <          Z, ej         ed=          d>d:d
d
 ed;          <          Z- e.d?d@A          Z/ e.dBd@A          Z0 e.dCd@A          Z1 e.dDd@A          Z2 e.dEd@A          Z3 e.dFd@A          Z4 e.dGd@A          Z5 e.dHd@A          Z6 e.dId@A          Z7 e.dJd@A          Z8 e9j:                    Z;dKZ<dLZ= G dM dN          Z> fdOZ?dP Z@ fdQZAd^dRZB fdSZCeDdT             ZEeDdU             ZFeDdV             ZGdW ZHd^dXZId_dZZJd[ ZKd\ ZLeMd]             ZN xZOS )`r!   a  
    A Device represents a piece of physical hardware mounted within a Rack. Each Device is assigned a DeviceType,
    DeviceRole, and (optionally) a Platform. Device names are not required, however if one is set it must be unique.

    Each Device must be assigned to a site, and optionally to a rack within that site. Associating a device with a
    particular rack face or unit is optional (for example, vertically mounted PDUs do not consume rack units).

    When a new Device is created, console/power/interface/device bay components are created along with it as dictated
    by the component templates assigned to its DeviceType. Components can also be added, modified, or deleted after the
    creation of a Device.
    dcim.DeviceType	instancesrI   dcim.DeviceRoledeviceszThe function this device serves)rJ   rK   rL   r[   tenancy.TenantTr  rR   r.   @   )r7   rP   rU   rV   rN   )target_fieldrP   rU   rV   rX   serial numberz3Chassis serial number, assigned by the manufacturer)rP   rU   r7   r[   	asset tag)A unique tag used to identify this devicerP   rU   rV   uniquer7   r[   	dcim.Sitezdcim.Locationz	dcim.Rackr\   r   r   zposition (U)z/The lowest-numbered unit occupied by the device)r]   r^   rU   rV   
validatorsr7   r[   z	rack face)rP   rU   ra   r7   statusr7   rP   ra   r_   rb   rc   ipam.IPAddressrS   primary IPv4rT   primary IPv6zout-of-band IPzvirtualization.Clusterr(   memberszVC positionzVirtual chassis position)r7   rU   rV   r[   zVC priority   z(Virtual chassis master election priority)r7   rU   rV   r=  r[   latitude      z,GPS coordinate in decimal format (xx.yyyyyy))r7   r]   r^   rU   rV   r[   	longitude	   zdcim.ConsolePortr   rf   zdcim.ConsoleServerPortzdcim.PowerPortzdcim.PowerOutletzdcim.Interfacezdcim.FrontPortzdcim.RearPortzdcim.DeviceBaydcim.ModuleBayzdcim.InventoryItem)re   roletenantr"  sitelocationr   r   r>  rb   clustervirtual_chassis)r<  r2  r0  c            
          e Zd ZdZ ej         ed          ddd           ej         ed          dd ed	           ed
                     ej        dd           ej        dd          fZ	 ed          Z
 ed          ZdS )Device.Meta)_namerA   r.   rM  rL  z/%(app_label)s_%(class)s_unique_name_site_tenantr-   z(%(app_label)s_%(class)s_unique_name_siteT)tenant__isnullz$Device name must be unique per site.)r.   	conditionviolation_error_message)r   r   r   z1%(app_label)s_%(class)s_unique_rack_position_facert   )rP  vc_positionz:%(app_label)s_%(class)s_unique_virtual_chassis_vc_positionr   r3  N)r2   r3   r4   r5   r   rw   r   Qr6   rx   r7   r8   r9   r:   r;   r<   rR    s        "#F#fvxF   $F#fv?!4000()*P(Q(Q	   $F#3H   $F#9Q  
( q{{a	llr:   r<   c                     | j         r| j        r| j          d| j         dS | j         r| j         S | j        r&| j        r| j        j          d| j         d| j         dS | j        r| j        j          d| j         d| j         dS | j        r+| j        r$| j        j         d| j        j         d| j         dS | j        r$| j        j         d| j        j         d| j         dS t                      	                                S )N ():r   )
r.   	asset_tagrP  rW  rA   re   r/   rM   r   r|   rC   r   s    r;   r|   zDevice.__str__+  sP   9 	[ 	[i444>4444Y 		[9! 	[dn 	[*/WW$2BWWdnWWWW! 	[*/PP$2BPPdgPPPP 	[$. 	[&3aad6F6LaaPTP^aaaa 	[&3ZZd6F6LZZPTPWZZZZww   r:   c                 0    t          d| j        g          S )Nzdcim:devicer>   r@   rB   s    r;   rD   zDevice.get_absolute_url:      }DG95555r:   c                    t                                                       | j        rR| j        | j        j        k    r=t	          dt          d                              | j        | j                  i          | j        rR| j        | j        j        k    r=t	          dt          d                              | j        | j                  i          | j        rY| j        rR| j        j        | j        k    r=t	          dt          d                              | j        | j                  i          | j        J| j        rt	          d	t          d
          i          | j	        rt	          dt          d          i          | j	        r:| j	        t          j        d          z  rt	          dt          d          i          | j	        r%| j        st	          d	t          d          i          t          | d          rN| j	        rG| j        j        dk    r7t	          dt          d                              | j                  i          | j        r	 | j        j        r%| j        rt	          d	t          d          i          | j        j        r%| j	        rt	          dt          d          i          | j        j        s| j        nd }| j        r| j        gng }| j                            | j        j        ||          }| j	        rQ| j	        |vrHt	          dt          d                              | j	        | j        | j        j                  i          n# t&          j        $ r Y nw xY w|                     d          }| j        r| j        j        dk    r7t	          dt          d                              | j                  i          | j        j        |v rnW| j        j        | j        j        j        |v rn7t	          dt          d                              | j                  i          | j        r| j        j        d k    r7t	          d!t          d"                              | j                  i          | j        j        |v rnW| j        j        | j        j        j        |v rn7t	          d!t          d                              | j                  i          | j        rI| j        j        |v rn:| j        j        | j        j        j        |v rnt	          d#d$| j         d%i          t          | d          rt| j        rm| j        j        ra| j        j        | j        j        k    rGt	          d&t          d'                              | j        j        | j        j        (          i          | j        r]| j        j        Q| j        j        | j        k    r<t	          d)t          d*                              | j        j        +          i          | j        r%| j          t	          d,t          d-          i          d S d S ).Nr   z+Rack {rack} does not belong to site {site}.)r   rM  rN  z3Location {location} does not belong to site {site}.)rN  rM  z3Rack {rack} does not belong to location {location}.)r   rN  r   z3Cannot select a rack face without assigning a rack.r   z7Cannot select a rack position without assigning a rack.r   z1Position must be in increments of 0.5 rack units.z3Must specify rack face when defining rack position.re   r   zGA 0U device type ({device_type}) cannot be assigned to a rack position.)re   z`Child device types cannot be assigned to a rack face. This is an attribute of the parent device.zdChild device types cannot be assigned to a rack position. This is an attribute of the parent device.r   z~U{position} is already occupied or does not have sufficient space to accommodate this device type: {device_type} ({u_height}U))r   re   rj   F	if_masterr\   primary_ip4z{ip} is not an IPv4 address.)ipz?The specified IP address ({ip}) is not assigned to this device.rG  primary_ip6z{ip} is not an IPv6 address.oob_ipzThe specified IP address (z!) is not assigned to this device.r"  zThe assigned platform is limited to {platform_manufacturer} device types, but this device's type belongs to {devicetype_manufacturer}.)platform_manufacturerdevicetype_manufacturerrO  z9The assigned cluster belongs to a different site ({site}))rM  rW  zFA device assigned to a virtual chassis must have its position defined.)!r   r   r   rM  r   r6   r   rN  r   r   r   r   hasattrre   rj   r   rk   rA   r   r#   DoesNotExistvc_interfacesrd  familyassigned_object
nat_insiderf  rg  r"  r/   rO  rP  rW  )rC   r   exclude_listavailable_unitsrl  r   s        r;   r   zDevice.clean=  se    9 	din44!GHHOOUYU^eienOoo#    = 	TY$-*<<<!AI &$-di&@@#   
 9 	 	49+=+N+N!I &di$-&@@#    9y %ASTT'    } %"[ \ \'   
 = 	T]W_S-A-AA 	!AQRR#    = 	 	!OPP#   
 4'' 	} !1!:a!?!?%a! !f)9f::'    9 $	"#3 	 )&! !+    #3  )"A-% %+    .2-=-KUDIIQU	,0G;yy"&)"?"?!-6)Ua #@ # # = T]/%I%I)"AG% % !&%)]@P[_[k[t !  	+    *    **U*;; 	&!++%!1%C#D#D#K#KtO_#K#`#`'    /=@@!,8T=M=X=hly=y=y%!1Y$ $f 0f11'   
  	&!++%!1%C#D#D#K#KtO_#K#`#`'    /=@@!,8T=M=X=hly=y=y%!1Y$ $f 0f11'   
 ; 	{*m;;'38N8^bo8o8o%i4;iii'   
 4'' 
	DM 
	}) 	dm.HDL\Li.i.i%E! ! f.2m.H040@0M   	'    < 	DL-9dl>OSWS\>\>\!1XYY``* a  #     	D$4$<!q!ijj#   	 	$<$<s   DM! !M32M3c           	          |j         j        }|rz fd|D             }|sdS t          j                            |          x}r|D ]	}||_        
|j                            |           |D ]}t          j        ||dddd           dS |D ]T}|	                               }t          j                            |          x}r||_        |
                                 UdS )a<  
        Instantiate components for the device from the specified component templates.

        Args:
            bulk_create: If True, bulk_create() will be called to create all components in a single query
                         (default). Otherwise, save() will be called on each instance individually.
        c                 <    g | ]}|                                S )r   )instantiate)r   objrC   s     r;   r   z2Device._instantiate_components.<locals>.<listcomp>  s'    KKK3#///66KKKr:   NTFr_   senderinstancecreatedrawusingupdate_fieldsrt  )rM   component_modelr   r   get_defaults_for_modelcustom_field_databulk_creater   sendru  r   )rC   querysetr  rM   
componentscf_defaults	componentrv  s   `       r;   _instantiate_componentszDevice._instantiate_components  s;    . 	!KKKK(KKKJ )1HHOOO{ >!+ > >I2=I//M%%j111'  	 & #"&        ! !OO4O88	"-"5"L"LU"S"SS; >2=I/    ! !r:   c                    t          | j                   }|r| j        s| j        j        | _        |r| j        s| j        j        | _        | j        r| j        j        r| j        j        | _         t                      j	        |i | |r| 
                    | j        j                                                   | 
                    | j        j                                                   | 
                    | j        j                                                   | 
                    | j        j                                                   | 
                    | j        j                                                   | 
                    | j        j                                                   | 
                    | j        j                                                   | 
                    | j        j                                        d           | 
                    | j        j                                                   | 
                    | j        j                                        d           t-          | | j        j                                                   t.          j                            |           }|D ]:}| j        |_        | j        |_        | j        |_        |	                                 ;d S )NF)r  parent_bay__device)boolrA   rb   re   r"  ri   r   rN  r   r   r  r   r   r   r   r   r   r   r   r   r   inventoryitemtemplatesr.  r!   r   r   rM  )rC   r?   r   is_newr3  r   r   s         r;   r   zDevice.save  s   $']]"  	4$, 	4+3DL  	>$- 	> ,=DM 9 	/+ 	/ I.DMd%f%%%  	V(()9)N)R)R)T)TUUU(()9)T)X)X)Z)Z[[[(()9)L)P)P)R)RSSS(()9)N)R)R)T)TUUU(()9)L)P)P)R)RSSS(()9)K)O)O)Q)QRRR(()9)L)P)P)R)RSSS(()9)L)P)P)R)R`e(fff(()9)L)P)P)R)RSSS(()9)P)T)T)V)Vdi(jjj$T4+;+N+R+R+T+TUUU .''4'@@ 	 	F)FK)FK"mFOKKMMMM		 	r:   c                 R    | j         | j         S d                    | j                  S )zb
        Return the device name if set; otherwise return the Device's primary key as {pk}
        Nz{{{}}})r.   r   rA   rB   s    r;   
identifierzDevice.identifier)  s(    
 9 9tw'''r:   c                      t          d                      r| j        r| j        S | j        r| j        S | j        r| j        S d S NPREFER_IPV4r   rd  rf  rB   s    r;   
primary_ipzDevice.primary_ip2  Z    $:m$$&& 	4+; 	## 	## 	##4r:   c                 N    |                                                                  S rz   )rl  r   rB   s    r;   interfaces_countzDevice.interfaces_count=  s     !!##))+++r:   c                 ,    | j         r| j         j        ndS )zj
        If this Device is a VirtualChassis member, return the VC master. Otherwise, return None.
        N)rP  masterrB   s    r;   get_vc_masterzDevice.get_vc_masterA  s     /3.BLt#**Lr:   c                     | j         rt          |           nt                      }| j        r+| j        j        | k    s|s|t          | j        d          z  }t          j                            |          S )a  
        Return a QuerySet matching all Interfaces assigned to this Device or, if this Device is a VC master, to another
        Device belonging to the same VirtualChassis.

        :param if_master: If True, return VC member interfaces only if this Device is the VC master.
        rt  F)device__virtual_chassis	mgmt_only)rA   rX  rP  r  r(  r   r   )rC   rc  r   s      r;   rl  zDevice.vc_interfacesG  st     $(73$ 	WT%9%@D%H%HPY%Ha0DPUVVVVF ''///r:   Fc                    ddl m} g }t          t          t          t
          t          t          t          fD ]6}||j	        
                    | d                              dd          z  }7|r|S |j	        
                    |          S )	zk
        Return a QuerySet or PK list matching all Cables connected to a component of this Device.
        r   )CableF)r   cable__isnullcableT)flat)pk__in)cablesr  ConsolePortConsoleServerPort	PowerPortPowerOutletr(  	FrontPortRearPortr   r   values_list)rC   pk_listr  	cable_pksr~  s        r;   
get_cableszDevice.get_cablesS  s     	"!!!!!	*I{IyZb 
 	. 	.O 0775 8  k'k--.II  	}##9#555r:   c                 L    t           j                            | j                  S )z]
        Return the set of child Devices installed in DeviceBays within this Device.
        r  )r!   r   r   rA   rB   s    r;   get_childrenzDevice.get_childrenc  s     ~$$$@@@r:   c                 J    t           j                            | j                  S rz   )DeviceStatusChoicescolorsr   r>  rB   s    r;   get_status_colorzDevice.get_status_colori      ")--dk:::r:   c                    t          d t          j                            |                               d                              d          D                       }| j        j        r|| j        j        z  }t          |dz  d          S )Nc              3   .   K   | ]}|j         j        V  d S rz   )module_type_abs_weight)r   r&  s     r;   	<genexpr>z&Device.total_weight.<locals>.<genexpr>n  s<       
 
 *
 
 
 
 
 
r:   rt  T) module_type___abs_weight__isnullr  i     )	sumr%   r   r   r   prefetch_relatedre   r  round)rC   total_weights     r;   r  zDevice.total_weightl  s     
 
 .//t/<<WdW;;m,,	
 
 
 
 
 ' 	9D,88L\D(!,,,r:   )T)F)Pr2   r3   r4   rE   r   r   r   re   r6   rK  rL  r   r"  r   r.   r   rS  serialr]  rM  rN  r   r   r   r   RACK_U_HEIGHT_MAXr   DeviceFaceChoicesr   r  STATUS_ACTIVEr>  r   rb   OneToOneFieldrd  rf  rg  rO  rP  PositiveIntegerFieldrW  PositiveSmallIntegerFieldvc_priorityrE  rH  r   console_port_countconsole_server_port_countpower_port_countpower_outlet_countinterface_countfront_port_countrear_port_countdevice_bay_countmodule_bay_countinventory_item_countr   
as_managerr   r   r   r<   r|   rD   r   r  r   r   r  r  r  r  rl  r  r  r  r   r  r  r  s   @r;   r!   r!   $  s       
 
 $&#.   K
 6.!566	  D V.  F !v /  H 6QvYY	  D ! 	  E VQ''!IJJ	  F ! Q{^^!?@@  I 6.  D
 !v .  H 6.  D #v"%%a((*;*;<MPS<S*T*TUQ~&&!EFF  H 6!Q{^^	  D VQx[[##1	  F fQy\\$	  G '&&/Q~&&  K '&&/Q~&&  K "V!/Q'((  F  f#/  G (f'/  O .&-Q}%%!.//	  K 3&2Q}%%%%c**+!>??  K #v"Qz]]!BCC  H $#Q{^^!BCC  I +*#   !2 1)! ! ! )(!   +*#   ('!  O )(!   ('   O )(!   )(!   -,%  
 4(355GL+ + + + + + + +2! ! ! ! !6 6 6[ [ [ [ [z#! #! #! #!J( ( ( ( (T ( ( X(   X , , X,M M M
0 
0 
0 
06 6 6 6 A A A; ; ; 	- 	- _	- 	- 	- 	- 	-r:   r!   c            
           e Zd ZdZ ej        dej        d          Z ej        dej        d          Z	 ej        dej
        d          Z ej         ed	          d
eej                  Z ej        d
d ed                    Z ej        d
ddd ed           ed                    ZdZ G d d          Zd Zd Zd Z fdZ fdZ xZS )r%   z
    A Module represents a field-installable component within a Device which may itself hold multiple device components
    (for example, a line card within a chassis switch). Modules are instantiated from ModuleTypes.
    dcim.DevicemodulesrI   rJ  installed_modulezdcim.ModuleTyper1  r>  rX   r?  Tr7  )rP   rU   r7   r8  r9  r:  )r   r  r>  c                   >    e Zd ZdZ ed          Z ed          ZdS )Module.Meta)
module_bayr&  r  Nr1   r9   r:   r;   r<   r    s0        "q{{a	llr:   r<   c                 @    | j         j         d| j         d| j         dS )Nz: rZ  r[  )r  r.   r  rA   rB   s    r;   r|   zModule.__str__  s+    /&HH$*:HHdgHHHHr:   c                 0    t          d| j        g          S )Nzdcim:moduler>   r@   rB   s    r;   rD   zModule.get_absolute_url  r`  r:   c                 J    t           j                            | j                  S rz   )ModuleStatusChoicesr  r   r>  rB   s    r;   r  zModule.get_status_color  r  r:   c                    t                                                       t          | d          rJ| j        j        | j        k    r5t          t          d                              | j                            | }g }g }|r|j        |v s|j        j        |v rt          t          d                    |	                    |j                   |	                    |j        j                   |j        r|j        j
        nd }|d S d S )Nr  zYModule must be installed within a module bay belonging to the assigned device ({device}).rt  z;A module bay cannot belong to a module installed within it.)r   r   rj  r  r   r   r6   r   rA   appendr&  )rC   r&  module_baysr  r   s       r;   r   zModule.clean  s'   4&& 	DO,Bdk,Q,Q!mnnuu; v      	MyG##v'8';{'J'J%a(e&f&fgggNN69%%%v03444171BLV&--F  	M 	M 	M 	M 	Mr:   c           
      V   | j         d u } t                      j        |i | t          | dd          }t          | dd          }|r|r|sd S ddt          fddt
          fdd	t          fd
dt          fddt          fddt          fddt          fddt          ffD ]o\  }}}g }	g }
d t          | j        |                              d          D             }t          | j        |                                          D ]p}|                    | j        |           }|r9|                    |j                  }|r| |_        |
                    |           Y|s|	                    |           q|t          ur:|j                            |	           |	D ]}t/          j        ||dddd            n|	D ]}|                                 dg}|j                            |
|           |
D ]}t/          j        ||ddd|           qt5          | j        | j        j        |            d S )N_adopt_componentsF_disable_replicationr   consoleportsr   consoleserverportsr   r   r   
powerportsr   poweroutletsr   	rearportsr   
frontportsr   
modulebaysc                     i | ]
}|j         |S r9   r-   )r   r  s     r;   
<dictcomp>zModule.save.<locals>.<dictcomp>  s,     $ $ $ 	$ $ $r:   T)module__isnull)r   r&  r_   rw  r&  )rA   r   r   getattrr  r  r(  r  r  r  r  	ModuleBayr   r   r  r   ru  r   r.   r&  r  r   r  r   r  bulk_updater.  r   )rC   r?   r   r  adopt_componentsdisable_replication	templatescomponent_attributer~  create_instancesupdate_instancesinstalled_componentstemplatetemplate_instanceexisting_itemr  ry  r}  r   s                     r;   r   zModule.save  s   Dd%f%%%"4)<eDD%d,BEJJ  	- 	6F 	F $^[A)+?ARS!<;!<;#^[A +x8!<;!<;	@
 A	 A	;I*O  "!$ $!(6I!J!J!Q!Qae!Q!f!f$ $ $  $D$4i@@DDFF ? ?$,$8$8TX$8$Y$Y!# !$8$<$<=N=S$T$TM % !/3,(//>>>  + ?$++,=>>>i//'334DEEE!1  IN.!* $!'&*     !1 $ $HMMOOOO%JM#//0@-PPP-  	*&!#"/     	!d.>.QSWXXXXXr:   )r2   r3   r4   rE   r   r   CASCADEr   r  r  r   r  r   r6   r  r  r>  r  r]  r   r<   r|   rD   r  r   r   r  r  s   @r;   r%   r%   y  s         V.  F
 &%.'  J
 $&#.   K
 VQx[[##1	  F VQ''  F
 ! Q{^^!?@@  I 7L+ + + + + + + +
I I I6 6 6; ; ;M M M M M*RY RY RY RY RY RY RY RY RYr:   r%   c                       e Zd ZdZ ej        dej        ddd          Z ej         e	d          d          Z
 ej         e	d	          d
d          Z edd          Z G d d          Zd Zd Z fdZ fdZ xZS )r(   zb
    A collection of Devices which operate with a shared control plane (e.g. a switch stack).
    r!   vc_master_forTr  r.   r5  rO   domain   )r7   rP   rU   r  rP  rf   c                   @    e Zd ZdgZ ed          Z ed          ZdS )VirtualChassis.Metar.   zvirtual chassisNr1   r9   r:   r;   r<   r  :  s8        8q*++a 122r:   r<   c                     | j         S rz   r-   rB   s    r;   r|   zVirtualChassis.__str__?  
    yr:   c                 2    t          dd| j        i          S )Nzdcim:virtualchassisrA   r   r@   rB   s    r;   rD   zVirtualChassis.get_absolute_urlB  s    ,dDG_EEEEr:   c                 $   t                                                       | j        j        s^| j        rY| j        | j                                        vr;t          dt          d          	                    | j                  i          d S d S d S )Nr  zGThe selected master ({master}) is not assigned to this virtual chassis.)r  )
r   r   r   r   r  rC  r   r   r6   r   r^  s    r;   r   zVirtualChassis.cleanE  s     {! 	dk 	dkIYIYI[I[6[6[!!effmm; n  #   	 	 	 	6[6[r:   c                 X   t           j                            | j                                        d                              t          d                    }|r6t          t          d          	                    | t                               t                      j        |i |S )NF)
device__inlag__isnullr   )lag__devicezoUnable to delete virtual chassis {self}. There are member interfaces which form a cross-chassis LAG interfaces.)rC   r   )r(  r   r   rC  r   r   r	   r
   r6   r   InterfaceSpeedChoicesr   r   )rC   r?   r   r   r   s       r;   r   zVirtualChassis.deleteQ  s     &--|'')) . 
 
 '(  
 
 	  	C " " f$+@fAAC C C
 uww~t.v...r:   )r2   r3   r4   rE   r   r  r   r  r   r6   r.   r  r   member_countr<   r|   rD   r   r   r  r  s   @r;   r(   r(     sD         "V!.$  F 6QvYY  D VQx[[  F %$"  L
3 3 3 3 3 3 3 3
  F F F
 
 
 
 
/ / / / / / / / /r:   r(   c            
       H    e Zd Z ej        dej        ddd          Z ej         ed          d          Z	 ej         ed          d	e

          Z ej         ed           ed          dd          Z ej        dej        ddd ed                    Z ej        dej        ddd ed                    Z ej        dej        ddd          Z ej         ed          d          Z G d d          Zd Zd Zd Zed             Z fdZ xZS )r)   r!   vdcsTr  r.   r5  rO   r>  rX   )r7   rP   ra   r  z.Numeric identifier unique to the parent device)r7   r[   rU   rV   r@  rS   rA  rT   rB  r4  r   )r7   rU   c                       e Zd ZdgZ ej        dd           ej        dd          fZ ed          Z ed          Z	d	S )
VirtualDeviceContext.Metar.   )r   r  z)%(app_label)s_%(class)s_device_identifierrt   r'  z#%(app_label)s_%(class)s_device_namezvirtual device contextzvirtual device contextsNrv   r9   r:   r;   r<   r    s}        8#F#0@   $F#*:  	
 q122a 9::r:   r<   c                     | j         S rz   r-   rB   s    r;   r|   zVirtualDeviceContext.__str__  r  r:   c                 2    t          dd| j        i          S )Nzdcim:virtualdevicecontextrA   r  r@   rB   s    r;   rD   z%VirtualDeviceContext.get_absolute_url  s    2D$'?KKKKr:   c                 J    t           j                            | j                  S rz   )!VirtualDeviceContextStatusChoicesr  r   r>  rB   s    r;   r  z%VirtualDeviceContext.get_status_color  s    07;;DKHHHr:   c                      t          d                      r| j        r| j        S | j        r| j        S | j        r| j        S d S r  r  rB   s    r;   r  zVirtualDeviceContext.primary_ip  r  r:   c                    t                                                       | j        df| j        dffD ]\  }}|s|j        |k    r6t          d| t          d                              ||          i          | j        	                    d          }|j
        |vr!t          d| t          d          i          d S )	Nr\   rG  r  z#{ip} is not an IPv{family} address.)rm  re  Frb  zFPrimary IP address must belong to an interface on the assigned device.)r   r   rd  rf  rm  r   r6   r   r   rl  rn  )rC   r  rm  device_interfacesr   s       r;   r   zVirtualDeviceContext.clean  s    %)$4a#84;KQ:O"P 	 	J  F**%)))1=, ,fFzf::'   
 !% 9 9E 9 J J)1BBB%)))1-u+v+v'    C	 	r:   )r2   r3   r4   r   r   r   r   r   r6   r.   r  r>  r  r  r  r   rd  rf  rL  	TextFieldr   r<   r|   rD   r  r   r  r   r  r  s   @r;   r)   r)   c  s.       V.  F 6QvYY  D VQx[[1  F
 21Q|__!DEE	  J '&&/Q~&&  K '&&/Q~&&  K V.  F  vQz]]  H
; ; ; ; ; ; ; ;  L L LI I I   X        r:   r)   rz   )Ar   r   	functoolsr   django.core.exceptionsr   django.core.files.storager   django.core.validatorsr   r   	django.dbr   django.db.modelsr	   r
   django.db.models.functionsr   django.db.models.signalsr   django.urlsr   django.utils.safestringr   django.utils.translationr   r6   dcim.choicesdcim.constantsextras.modelsr   r   extras.querysetsr   netbox.choicesr   netbox.configr   netbox.modelsr   r   netbox.models.featuresr   r   utilities.fieldsr   r   r   utilities.trackingr   device_componentsmixinsr   r    __all__r$   r#   r&   r"   r'   r.  r!   r%   r(   r)   r9   r:   r;   <module>r2     s     % % % % % % 2 2 2 2 2 2 5 5 5 5 5 5 G G G G G G G G       . . . . . . . . , , , , , , . . . . . .       - - - - - - 6 6 6 6 6 6         9 9 9 9 9 9 9 9 7 7 7 7 7 7 ' ' ' ' ' ' $ $ $ $ $ $ ; ; ; ; ; ; ; ; G G G G G G G G P P P P P P P P P P 1 1 1 1 1 1         2 2 2 2 2 2 2 2
"
< 
< 
< 
< 
<="5 
< 
< 
<qF qF qF qF qF&k qF qF qFh	`6 `6 `6 `6 `6&k `6 `6 `6N: : : : :$ : : :@8 8 8 8 8" 8 8 8<   R	- R	- R	- R	- R	-R	- R	- R	-j_Y _Y _Y _Y _Y\- _Y _Y _YLA/ A/ A/ A/ A/\ A/ A/ A/Hg g g g g< g g g g gr:   