�
�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 m Z m Z m Z m Z d d l m Z m Z d e f d � � YZ d
S( s�
The junos_vlans 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_list( t Facts( t
locked_configt load_configt commit_configurationt discard_changest tostring( t build_root_xml_nodet build_child_xml_nodet Vlansc B` st 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 � Z
RS(
s
The junos_vlans class
s !alls !mint vlansc C` s t t | � j | � d S( N( t superR
t __init__( t selft module( ( sY /usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR 4 s c C` sH t | j � j | j | j � \ } } | d j d � } | sD g 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 vlans_facts( ( sY /usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyt get_vlans_facts7 s c C` s i t d 6} t � } | j � } | j | � } t | j � �� x) t | � D] } t | j | | � } qN W| j j } | r� | r� t | j � n
t
| j � t | d <| j j r� i | d 6| d <q� n Wd QX| | d <| j � } | | d <| d r
| | d <n | | d <| S( sm Execute the module
:rtype: A dictionary
:returns: The result from module execution
t changedt preparedt diffNt commandst beforet aftert warnings(
t Falset listR t
set_configR R R R t
check_modeR R t Truet _diff( R t resultR# t existing_vlans_factst config_xmlst
config_xmlR t committ changed_vlans_facts( ( sY /usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyt execute_moduleD s,
c C` s2 | j j d } | } | 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 config( R t paramst set_stateR ( R R+ t wantt havet resp( ( sY /usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR&