%PDF- %PDF-
| Direktori : /proc/thread-self/root/proc/3522530/root/lib/python2.7/site-packages/salt/states/ |
| Current File : //proc/thread-self/root/proc/3522530/root/lib/python2.7/site-packages/salt/states/probes.pyc |
�
���^c @@ s� d Z d d l m Z d d l Z e j e � Z d d l m Z d d l m
Z
m Z d d l m
Z
d d l Z d Z d � Z d � Z d
� Z d � Z d � Z d
� Z d � Z d � Z d � Z d � Z d d � Z d S( sw
Network Probes
===============
Configure RPM (JunOS)/SLA (Cisco) probes on the device via NAPALM proxy.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com> & Jerome Fleury <jf@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`napalm probes management module <salt.modules.napalm_probes>`
.. versionadded: 2016.11.0
i ( t absolute_importN( t deepcopy( t loadst dumps( t sixt probesc C@ s t j j j t t t � S( s_
NAPALM library must be installed for this module to work and run in a (proxy) minion.
( t saltt utilst napalmt virtualt __opts__t __virtualname__t __file__( ( ( s6 /usr/lib/python2.7/site-packages/salt/states/probes.pyt __virtual__2 s c C@ s i | d 6t d 6i d 6d d 6S( sh
Returns a default structure of the dictionary to be returned as output of the state functions.
t namet resultt changest t comment( t False( R ( ( s6 /usr/lib/python2.7/site-packages/salt/states/probes.pyt _default_ret= s
c C@ s t d � S( sl
Will retrieve the probes from the network device using salt module "probes" throught NAPALM proxy.
s
probes.config( t __salt__( ( ( s6 /usr/lib/python2.7/site-packages/salt/states/probes.pyt _retrieve_rpm_probesK s c
C@ s� i } x� t j | � D]� \ } } | | j � k rA i | | <n | j d i � } x� t j | � D]x \ } } | j d i � } t | � } | j | � | j | � | j | � | | | j � k rc | | | | <qc qc Wq W| S( sP
Updates the probes dictionary with different levels of default values.
t defaults( R t iteritemst keyst popR t update(
R R t expected_probest
probe_namet
probe_testt probe_defaultst test_namet test_detailst
test_defaultst expected_test_details( ( s6 /usr/lib/python2.7/site-packages/salt/states/probes.pyt _expand_probesT s
c C@ s� t | � } t | � } x� t j | � D]~ \ } } | sM | j | � q( n xV t j | � D]E \ } } | s� | | j | � n | j | � s] | j | � q] q] Wq( Wt S( sJ
Will remove empty and useless values from the probes dictionary.
( t _ordered_dict_to_dictR R R R t gett True( R t probes_copyR t probe_testsR t test_params( ( s6 /usr/lib/python2.7/site-packages/salt/states/probes.pyt
_clean_probesl s
c C@ sQ i } i } i } | s# i | d 6S| s4 i | d 6St | j � � } t | j � � } | | } | | } x! | D] } | j | � | | <qs Wx! | D] } | j | � | | <q� Wx�t j | � D]p\ } }
| j | i � } t | j � � } t |
j � � }
|
| } | |
} xN | D]F } | | j � k rFi | | <n | | j i |
j | � | 6� q!WxN | D]F } | | j � k r�i | | <n | | j i | j | � | 6� qrWxu t j |
� D]d \ } } | j | i � } | | k r�| | j � k ri | | <n | | j i | | 6� q�q�Wq� Wi | d 6| d 6| d 6S( so
Compares configured probes on the device with the expected configuration and returns the differences.
t addt removeR ( t setR R R R R&