o
    Û1jŸ	  ã                   @   s&   d dl mZmZ G dd„ deeƒZdS )é    )ÚPluginÚIndependentPluginc                   @   s0   e Zd ZdZdZdZdZdZdd„ Zdd„ Z	d	S )
ÚBirdzÙBIRD is an Internet Routing Daemon used in many *nix and nix-like
    distributions. This plugin will capture the configuration files for a local
    bird installation, as well as runtime information and metrics.
    Úbird)Únetwork)r   c              
   C   s´   z/t dddd��}|D ]}| d¡r|  | ¡ d  d¡¡ qW d   ƒ n1 s)w   Y  W n tyI } z|  d|› �¡ W Y d }~nd }~ww |  d	dg¡ |  g d
¢¡ d S )Nz/etc/bird.confÚrzutf-8)ÚencodingÚlogé   ú"zUnable to parse bird.conf: z/etc/bird/*)zbirdc show statuszbirdc show memoryzbirdc show protocols allzbirdc show interfaceszbirdc show route allzbirdc show symbolszbirdc show bfd sessionszbirdc show babel interfaceszbirdc show babel neighborszbirdc show babel entrieszbirdc show babel routeszbirdc show ospfzbirdc show ospf neighborszbirdc show ospf interfacezbirdc show ospf topologyzbirdc show ospf state allzbirdc show ospf lsadbzbirdc show rip interfaceszbirdc show rip neighborszbirdc show static)ÚopenÚ
startswithÚadd_copy_specÚsplitÚstripÚ	ExceptionÚ
_log_debugÚadd_cmd_output)ÚselfÚbfileÚlineÚerr© r   ú9/usr/lib/python3/dist-packages/sos/report/plugins/bird.pyÚsetup   s$   
€ýÿ€€ÿþz
Bird.setupc                 C   s   |   ddd¡ d S )Nz/etc/bird(.*)?.confz((.*password)\s\"(.*)\"(.*))z\2 *******\4)Údo_path_regex_sub)r   r   r   r   ÚpostprocA   s   þzBird.postprocN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úplugin_nameÚprofilesÚpackagesÚservicesr   r   r   r   r   r   r      s    'r   N)Úsos.report.pluginsr   r   r   r   r   r   r   Ú<module>   s   