%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/modules/ |
Current File : //lib/python2.7/site-packages/salt/modules/arista_pyeapi.pyc |
� ���^c @@ sh d Z d d l m Z m Z m Z d d l Z d d l Z d d l m Z d d l m Z y d d l m Z Wn! e k r� d d l m Z n Xy d d l Z e Z Wn e k r� e Z n Xd g Z d Z e j e � Z d d d d d d d d g Z d � Z d � Z d � Z d � Z d � Z d d d d d d d � Z d d e d � Z d d � Z! d S( u4 Arista pyeapi ============= .. versionadded:: 2019.2.0 Execution module to interface the connection with Arista switches, connecting to the remote network device using the `pyeapi <http://pyeapi.readthedocs.io/en/master/index.html>`_ library. It is flexible enough to execute the commands both when running under an Arista Proxy Minion, as well as running under a Regular Minion by specifying the connection arguments, i.e., ``device_type``, ``host``, ``username``, ``password`` etc. :codeauthor: Mircea Ulinic <ping@mirceaulinic.net> :maturity: new :depends: pyeapi :platform: unix .. note:: To understand how to correctly enable the eAPI on your switch, please check https://eos.arista.com/arista-eapi-101/. Dependencies ------------ The ``pyeapi`` Execution module requires the Python Client for eAPI (pyeapi) to be installed: ``pip install pyeapi``. Usage ----- This module can equally be used via the :mod:`pyeapi <salt.proxy.arista_pyeapi>` Proxy module or directly from an arbitrary (Proxy) Minion that is running on a machine having access to the network device API, and the ``pyeapi`` library is installed. When running outside of the :mod:`pyeapi Proxy <salt.proxy.arista_pyeapi>` (i.e., from another Proxy Minion type, or regular Minion), the pyeapi connection arguments can be either specified from the CLI when executing the command, or in a configuration block under the ``pyeapi`` key in the configuration opts (i.e., (Proxy) Minion configuration file), or Pillar. The module supports these simultaneously. These fields are the exact same supported by the ``pyeapi`` Proxy Module: transport: ``https`` Specifies the type of connection transport to use. Valid values for the connection are ``socket``, ``http_local``, ``http``, and ``https``. host: ``localhost`` The IP address or DNS host name of the connection device. username: ``admin`` The username to pass to the device to authenticate the eAPI connection. password The password to pass to the device to authenticate the eAPI connection. port The TCP port of the endpoint for the eAPI connection. If this keyword is not specified, the default value is automatically determined by the transport type (``80`` for ``http``, or ``443`` for ``https``). enablepwd The enable mode password if required by the destination node. Example (when not running in a ``pyeapi`` Proxy Minion): .. code-block:: yaml pyeapi: username: test password: test In case the ``username`` and ``password`` are the same on any device you are targeting, the block above (besides other parameters specific to your environment you might need) should suffice to be able to execute commands from outside a ``pyeapi`` Proxy, e.g.: .. code-block:: bash salt '*' pyeapi.send_commands 'show version' 'show interfaces' salt '*' pyeapi.config 'ntp server 1.2.3.4' .. note:: Remember that the above applies only when not running in a ``pyeapi`` Proxy Minion. If you want to use the :mod:`pyeapi Proxy <salt.proxy.arista_pyeapi>`, please follow the documentation notes for a proper setup. i ( t absolute_importt print_functiont unicode_literalsN( t six( t CommandExecutionError( t clean_kwargsu *u pyeapiu transportu hostu usernameu passwordu enablepwdu portu timeoutu return_nodec C@ s t s t d f St S( uA Execution module available only if pyeapi is installed. u[ The pyeapi execution module requires pyeapi library to be installed: ``pip install pyeapi``( t HAS_PYEAPIt Falset __virtualname__( ( ( s>