�
�Udac @ s, d d l Z d d d � � YZ d � Z d S( i����Nt InterfaceConfigurationc B s e Z d � Z d � Z RS( c C s g | _ t | _ d S( N( t commandst Falset merged( t self( ( s` /usr/lib/python2.7/site-packages/ansible/module_utils/network/edgeswitch/edgeswitch_interface.pyt __init__! s c C sO t | j � } t | j � } | | k oN | t t | j � j | j � � k S( N( t lenR t frozensett intersection( R t interfacet len1t len2( ( s` /usr/lib/python2.7/site-packages/ansible/module_utils/network/edgeswitch/edgeswitch_interface.pyt has_same_commands% s ( t __name__t
__module__R R ( ( ( s` /usr/lib/python2.7/site-packages/ansible/module_utils/network/edgeswitch/edgeswitch_interface.pyR s c
C s� i } x�| j � D]�\ } } | j r. q n t | _ t j d | � } t | j d � � } t | j d � � } | } xo t r� yP | d } d j | | � } | | } | j r� | j | � r� t | _ n PWq| t k
r� Pq| Xq| W| d } xo t rfyP | d } d j | | � } | | } | j rL| j | � rLt | _ n PWq� t k
rbPq� Xq� W| d } | | k r�d j | | � } n d j | | | | � } | | | <q W| S( s� to reduce commands generated by an edgeswitch module
we take interfaces one by one and we try to merge them with neighbors if everyone has same commands to run
s (\d+)\/(\d+)i i s {0}/{1}s {0}/{1}-{2}/{3}(
t itemsR t Truet ret matcht intt groupt formatR t KeyError(
t
interfacesR t iR R R t startt endt keyt neighbor( ( s` /usr/lib/python2.7/site-packages/ansible/module_utils/network/edgeswitch/edgeswitch_interface.pyt merge_interfaces+ sH
( ( R R R ( ( ( s` /usr/lib/python2.7/site-packages/ansible/module_utils/network/edgeswitch/edgeswitch_interface.pyt <module> s
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]