File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__/bgp.cpython-310.pyc
Back
o ;j�E � @ s� d Z ddlZzddlmZ ddlmZmZ dZ W n e y# dZ Y nw dZdZd Z dZd Zg d�Zg d�Zd ddddddd�Zdd� Zdd� Zd!dd�Zdd� Zeefdd�Zdd � ZdS )"a� BGP Finder ========== .. versionadded:: 2017.7.0 Runner to search BGP neighbors details. Configuration ------------- - Minion (proxy) config The ``bgp.neighbors`` function must be appened in the list of ``mine_functions``: .. code-block:: yaml mine_functions: bgp.neighbors: [] Which instructs Salt to cache the data returned by the ``neighbors`` function from the :mod:`NAPALM BGP module <salt.modules.napalm_bgp.neighbors>`. How often the mines are refreshed, can be specified using: .. code-block:: yaml mine_interval: <X minutes> - Master config By default the following options can be configured on the master. They are not mandatory, but available in case the user has different requirements. tgt: ``*`` From what minions will collect the mine data. Default: ``*`` (collect mine data from all minions) tgt_type: ``glob`` Minion matching expression form. Default: ``glob``. return_fields What fields to return in the output. It can display all the fields from the ``neighbors`` function from the :mod:`NAPALM BGP module <salt.modules.napalm_bgp.neighbors>`. Some fields cannot be removed: - ``as_number``: the AS number of the neighbor - ``device``: the minion ID - ``neighbor_address``: the neighbor remote IP address By default, the following extra fields are returned (displayed): - ``connection_stats``: connection stats, as described below - ``import_policy``: the name of the import policy - ``export_policy``: the name of the export policy Special fields: - ``vrf``: return the name of the VRF. - ``connection_stats``: returning an output of the form ``<State> <Active>/<Received>/<Accepted>/<Damped>``, e.g. ``Established 398/399/399/0`` similar to the usual output from network devices. - ``interface_description``: matches the neighbor details with the corresponding interface and returns its description. This will reuse functionality from the :mod:`net runner <salt.runners.net.interfaces>`, so the user needs to enable the mines as specified in the documentation. - ``interface_name``: matches the neighbor details with the corresponding interface and returns the name. Similar to ``interface_description``, this will reuse functionality from the :mod:`net runner <salt.runners.net.interfaces>`, so the user needs to enable the mines as specified in the documentation. display: ``True`` Display on the screen or return structured object? Default: ``True`` (return on the CLI). outputter: ``table`` Specify the outputter name when displaying on the CLI. Default: :mod:`table <salt.output.table_out>`. Configuration example: .. code-block:: yaml runners: bgp: tgt: 'edge*' tgt_type: 'glob' return_fields: - up - connection_state - previous_connection_state - suppress_4byte_as - holdtime - flap_count outputter: yaml � N)�helpers)� IPAddress� IPNetworkTF�bgp�*�glob�table)�device� as_number�neighbor_address)�connection_stats� import_policy� export_policyZDevicez AS NumberzNeighbor IPz&State|#Active/Received/Accepted/Dampedz Policy INz Policy OUTZVRF)r r r r r r �vrfc C s t rtS dS )N)Fz'The napalm module could not be imported)� HAS_NAPALM�__virtualname__� r r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/bgp.py�__virtual__� s r c C sP t �di ��di �} | �dt�| �dt�| �dt�t| �dt� | �dt�d�S ) z( Return the bgp runner options. Zrunnersr �tgt�tgt_type�display� return_fields� outputter)r r r r r )�__opts__�get�_DEFAULT_TARGET�_DEFAULT_EXPR_FORM�_DEFAULT_DISPLAY�_DEFAULT_INCLUDED_FIELDS�_DEFAULT_RETURN_FIELDS�_DEFAULT_OUTPUTTER)Zrunner_optsr r r �_get_bgp_runner_opts� s � �r"