U
    -_g	                     @   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 )
BirdzBIRD 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)Znetwork)r   c                 C   s   zJt dddd2}|D ]&}|dr| | d d qW 5 Q R X W n2 tk
r| } z| d|  W 5 d }~X Y nX | d	dg | d
dddddddddddddddddddg 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
startswithZadd_copy_specsplitstrip	ExceptionZ
_log_debugZadd_cmd_output)selfZbfilelineerr r   9/usr/lib/python3/dist-packages/sos/report/plugins/bird.pysetup   sB    
("z
Bird.setupc                 C   s   |  ddd d S )Nz/etc/bird(.*)?.confz((.*password)\s\"(.*)\"(.*))z\2 *******\4)Zdo_path_regex_sub)r   r   r   r   postprocA   s    zBird.postprocN)
__name__
__module____qualname____doc__Zplugin_nameZprofilesZpackagesservicesr   r   r   r   r   r   r      s   'r   N)Zsos.report.pluginsr   r   r   r   r   r   r   <module>   s   