�
�Udac @` s� d Z d d l m Z m Z m Z e Z d d l m Z d d l m
Z
d d l m Z d d l
m Z d d l m Z d d l m Z y d d l m Z e Z Wn e k
r� e Z n Xd
e f d � � YZ d S(
s�
The junos interfaces fact class
It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated
based on the configuration.
i ( t absolute_importt divisiont print_function( t deepcopy( t to_bytes( t utils( t InterfacesArgs( t get_resource_config( t string_types( t etreet InterfacesFactsc B` s2 e Z d Z d d d � Z d d � Z d � Z RS( s% The junos interfaces fact class
t configt optionsc C` sj | | _ t j | _ t | j � } | rN | rA | | | } qT | | } n | } t j | � | _ d S( N( t _moduleR t
argument_specR R t
generate_dictt generated_spec( t selft modulet subspecR t spect facts_argument_spec( ( sb /usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/facts/interfaces/interfaces.pyt __init__ s
c C` sC t s | j j d d � n | s= d } t | d | �} n t | t � rj t j t | d d �� } n | j d � } g } xH | D]@ } | d k r� | j | j | � } | r� | j
| � q� q� q� Wi } | r.g | d <t j | j i | d 6� }
x/ |
d D] } | d j
t j | � � qWn | d
j | � | S( s Populate the facts for interfaces
:param connection: the device connection
:param data: previously collected configuration as lxml ElementTree root instance
or valid xml sting
:rtype: dictionary
:returns: facts
t msgs lxml is not installed.sp
<configuration>
<interfaces/>
</configuration>
t
config_filtert errorst surrogate_then_replaces"