�
�Udac @` sr 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 e
f d � � YZ d S( s�
The ios lldp_global 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 utils( t Lldp_globalArgst Lldp_globalFactsc B` s2 e Z d Z d d d � Z d d � Z d � Z RS( s$ The ios lldp_global 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/ios/facts/lldp_global/lldp_global.pyt __init__ s
c
C` s� t � } | s! | j d � } n | j d � } xB | D]: } | r7 | j | j | � } | rq | j | � qq q7 q7 Wi } | r� t j | j i t j | � d 6� } t j | d � | d <n | d j | � | S( s� Populate the facts for lldp_global
:param connection: the device connection
:param ansible_facts: Facts dictionary
:param data: previously collected conf
:rtype: dictionary
:returns: facts
s# show running-config | section ^lldps
R t lldp_globalt ansible_network_resources(
t dictt gett splitt
render_configR t updateR t validate_configR
t remove_empties(
R
t
connectiont
ansible_factst datat objsR t conft objt factst params( ( sb /usr/lib/python2.7/site-packages/ansible/module_utils/network/ios/facts/lldp_global/lldp_global.pyt populate_facts( s
%c C` s� t | � } t j | d � } t j | d � } t j | d � } | r[ t | � | d <n d | k rt t | d <n | r� t | � | d <n | r� t | � | d <n t j | � S( s
Render config as dictionary structure and delete keys from spec for null values
:param spec: The facts tree, generated from the argspec
:param conf: The configuration
:rtype: dictionary
:returns: The generated config
s
lldp holdtimes
lldp timers lldp reinitt holdtimes lldp runt enabledt timert reinit( R R t parse_conf_argt intt TrueR ( R
R R R R% R'