�
�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
m Z m Z d d l
m Z d d l m Z d d l m Z m Z d e f d � � YZ d
S( s�
The iosxr_lldp_global class
It is in this file where the current configuration (as dict)
is compared to the provided configuration (as dict) and the command set
necessary to bring the current configuration to it's desired end-state is
created
i ( t absolute_importt divisiont print_function( t
ConfigBase( t to_listt dict_difft remove_empties( t Facts( t iteritems( t flatten_dictt dict_deletet Lldp_globalc B` sz e Z d Z d d g Z d g Z d � Z d � Z d � Z d � Z d � Z d � Z
d
� Z d � Z d
e d � Z RS( s
The iosxr_lldp class
s !alls !mint lldp_globalc C` s t t | � j | � d S( N( t superR t __init__( t selft module( ( se /usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/lldp_global/lldp_global.pyR ( s c C` sH t | j � j | j | j � \ } } | d j d � } | sD i S| S( s� Get the 'facts' (the current configuration)
:rtype: A dictionary
:returns: The current configuration as a dictionary
t ansible_network_resourcesR ( R t _modulet get_factst
gather_subsett gather_network_resourcest get( R t factst _warningst
lldp_facts( ( se /usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/lldp_global/lldp_global.pyt get_lldp_global_facts+ s
'c C` s� i t d 6} t � } t � } | j � } | j | j | � � | rs | j j sf | j j | � n t | d <n | | d <| j � } | | d <| d r� | | d <n | | d <| S( sm Execute the module
:rtype: A dictionary
:returns: The result from module execution
t changedt commandst beforet aftert warnings(
t Falset listR t extendt
set_configR t
check_modet _connectiont edit_configt True( R t resultR R t existing_lldp_global_factst changed_lldp_global_facts( ( se /usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/lldp_global/lldp_global.pyt execute_module7 s
c C` sX | j j d } | r6 | j j d d k r6 i } n | } | j | | � } t | � S( s! Collect the configuration from the args passed to the module,
collect the current configuration (as a dict from facts)
:rtype: A list
:returns: the commands necessary to migrate the current configuration
to the desired configuration
t configt statet deleted( R t paramst set_stateR ( R R) t wantt havet resp( ( se /usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/lldp_global/lldp_global.pyR# R s c C` s� | j j d } | d k rB | rB | j j d d j | � � n | d k rc | j | | � } nB | d k r� | j | | � } n! | d k r� | j | | � } n | S( sX Select the appropriate function based on the state provided
:param want: the desired configuration as a dictionary
:param have: the current configuration as a dictionary
:rtype: A list
:returns: the commands necessary to migrate the current configuration
to the desired configuration
R- t mergedt replacedt msgs9 value of config parameter must not be empty for state {0}R. ( R4 R5 ( R R/ t fail_jsont formatt _state_deletedt
_state_mergedt _state_replaced( R R1 R2 R- R ( ( se /usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/lldp_global/lldp_global.pyR0 a s c C` s<