Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyo

�
�Udac@`s�dZddlmZmZmZeZddlmZddl	m
Z
ddlmZddl
mZmZmZmZmZddlmZmZdefd	��YZd
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(tabsolute_importtdivisiontprint_function(t
ConfigBase(tto_list(tFacts(t
locked_configtload_configtcommit_configurationtdiscard_changesttostring(tbuild_root_xml_nodetbuild_child_xml_nodetVlanscB`steZdZddgZdgZd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
RS(
s
    The junos_vlans class
    s!alls!mintvlanscC`stt|�j|�dS(N(tsuperR
t__init__(tselftmodule((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR4scC`sHt|j�j|j|j�\}}|djd�}|sDgS|S(s� Get the 'facts' (the current configuration)

        :rtype: A dictionary
        :returns: The current configuration as a dictionary
        tansible_network_resourcesR(Rt_modulet	get_factst
gather_subsettgather_network_resourcestget(Rtfactst	_warningstvlans_facts((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pytget_vlans_facts7sc		C`sitd6}t�}|j�}|j|�}t|j���x)t|�D]}t|j||�}qNW|jj}|r�|r�t	|j�n
t
|j�t|d<|jjr�i|d6|d<q�nWdQX||d<|j�}||d<|dr
||d<n||d<|S(	sm Execute the module

        :rtype: A dictionary
        :returns: The result from module execution
        tchangedtpreparedtdiffNtcommandstbeforetaftertwarnings(
tFalsetlistRt
set_configRRRRt
check_modeRR	tTruet_diff(	RtresultR#texisting_vlans_factstconfig_xmlst
config_xmlRtcommittchanged_vlans_facts((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pytexecute_moduleDs,
	







cC`s2|jjd}|}|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
        tconfig(Rtparamst	set_stateR(RR+twantthavetresp((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR&jscC`s�td�}|jjd}|dkr=|j||�}nc|dkr^|j||�}nB|dkr|j||�}n!|dkr�|j||�}nx|D]}|j|�q�Wt|�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
        Rtstatet
overriddentdeletedtmergedtreplaced(	RRR2t_state_overriddent_state_deletedt
_state_mergedt_state_replacedtappendR
(RR4R5trootR7R,txml((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR3ws	
cC`s<g}|j|j||��|j|j||��|S(s� The command generator when state is replaced

        :rtype: A list
        :returns: the xml necessary to migrate the current configuration
                  to the desired configuration
        (textendR=R>(RR4R5tintf_xml((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR?�scC`s<g}|j|j||��|j|j||��|S(s� The command generator when state is overridden

        :rtype: A list
        :returns: the xml necessary to migrate the current configuration
                  to the desired configuration
        (RCR=R>(RR4R5RD((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR<�sc	C`s�g}x�|D]�}t|d�}t|d�}|jd�}td�}t|d|�t|d|�|r�t|d|�n|j|�q
W|S(s� The command generator when state is merged

        :rtype: A list
        :returns: the xml necessary to merge the provided into
                  the current configuration
        tnametvlan_idtdescriptiontvlansvlan-id(tstrRRRR@(	RR4R5RDR1t	vlan_nameRFtvlan_descriptiont	vlan_root((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR>�s
	
cC`stg}|s|}nxX|D]P}|d}td�}|jjidd6�t|d|�|j|�qW|S(s� The command generator when state is deleted

        :rtype: A list
        :returns: the xml necessary to remove the current configuration
                  of the provided objects
        RERHtdelete(RtattribtupdateRR@(RR4R5RDR1RJRL((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR=�s	

(t__name__t
__module__t__doc__RRRRR0R&R3R?R<R>R=(((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyR
&s				
	&	
				N(RRt
__future__RRRttypet
__metaclass__t,ansible.module_utils.network.common.cfg.baseRt)ansible.module_utils.network.common.utilsRt.ansible.module_utils.network.junos.facts.factsRt(ansible.module_utils.network.junos.junosRRRR	R
t+ansible.module_utils.network.common.netconfRRR
(((sY/usr/lib/python2.7/site-packages/ansible/module_utils/network/junos/config/vlans/vlans.pyt<module>s(

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]