Anons79 Mini Shell

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

�
�Udac@`s�dZddlmZmZmZeZddlmZddl	m
Z
ddlmZddl
mZmZddl
mZmZddl
mZmZd	efd
��YZdS(s�
The iosxr_interfaces 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(tget_interface_typetdict_to_set(tremove_command_from_config_listtadd_command_to_config_list(tfilter_dict_having_none_valuetremove_duplicate_interfacet
InterfacescB`s�eZdZddgZdgZdZd�Zd	�Zd
�Zd�Z	d�Z
d
�Zd�Zd�Z
d�Zd�Zd�ZRS(s$
    The iosxr_interfaces class
    s!alls!mint
interfacestdescriptiontmtutspeedtduplexcC`stt|�j|�dS(N(tsuperRt__init__(tselftmodule((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyR(scC`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	_warningstinterfaces_facts((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pytget_interfaces_facts+s
'cC`s�itd6}t�}t�}|j�}|j|j|��|rs|jjsf|jj|�nt	|d<n||d<|j�}||d<|dr�||d<n||d<|S(sl Execute the module
        :rtype: A dictionary
        :returns: The result from module execution
        tchangedtcommandstbeforetaftertwarnings(
tFalsetlistRtextendt
set_configRt
check_modet_connectiontedit_configtTrue(RtresultR!R$texisting_interfaces_factstchanged_interfaces_facts((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pytexecute_module6s 
		





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((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyR(PscC`s�g}|jjd}|dkrH|rH|jjddj|��n|dkri|j||�}nc|dkr�|j||�}nB|dkr�|j||�}n!|dkr�|j||�}n|S(	sW 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
        tstatet
overriddentmergedtreplacedtmsgs9value of config parameter must not be empty for state {0}tdeleted(R8R9R:(RR2t	fail_jsontformatt_state_overriddent_state_deletedt
_state_mergedt_state_replaced(RR4R5R!R7((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyR3]scC`s�g}x�|D]�}xA|D]6}|d|dkr8Pq|d|dkrPqqWq
t||�}t�}|j|j||��|j|j||��q
Wt|�}|S(s� The command generator when state is replaced
        :rtype: A list
        :returns: the commands necessary to migrate the current configuration
                  to the desired configuration
        tname(R
tdictR't
_clear_configt_set_configR(RR4R5R!t	interfaceteacht	have_dict((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyRBus

	cC`s�g}x�|D]�}xm|D]6}|d|dkr8Pq|d|dkrPqqWtd|d�}|j|j||��q
t||�}t�}|j|j||��|j|j||��q
Wt|�}|S(s� The command generator when state is overridden
        :rtype: A list
        :returns: the commands necessary to migrate the current configuration
                  to the desired configuration
        RC(RDR'RER
RFR(RR4R5R!RHRGRI((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyR?�s 

	cC`sxg}xk|D]c}xA|D]6}|d|dkr8Pq|d|dkrPqqWq
|j|j||��q
W|S(s� The command generator when state is merged
        :rtype: A list
        :returns: the commands necessary to merge the provided into
                  the current configuration
        RC(R'RF(RR4R5R!RGRH((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyRA�s

cC`s�g}|r�x�|D]v}xA|D]6}|d|dkr>Pq |d|dkr Pq q Wqtd|d�}|j|j||��qWn3x0|D](}t�}|j|j||��q�W|S(s� The command generator when state is deleted
        :rtype: A list
        :returns: the commands necessary to remove the current configuration
                  of the provided objects
        RC(RDR'RE(RR4R5R!RGRH((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyR@�s

 
	c
C`s�g}d|d}t|�}t|�}||}|r�t|�}xP|jD]E}|j|�rR|dt|j|��}	t||	|�qRqRW|jd�r�t|d|�q�|jd�tkr�t|d|�q�n|S(Ns
interface RCt tenabledsno shutdowntshutdown(RRDR2RtstrR	R%(
RR4R5R!RGt	want_dictRItdifftitemtcmd((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyRF�s 
cC`s�g}|jd�r6t|d�}d|d}nt|d�}d|d}|jd�r�|jd�|jd�kr�t|d|�n|jd�r�|jd�|jd�kr�t|d|�n|j�dkr�|jd�r<|jd�dkr<|jd�|jd�kr<t|d|�n|jd	�r�|jd	�dkr�|jd	�|jd	�kr�t|d	|�n|jd
�r�|jd
�|jd
�kr�t|d
|�q�n|S(NRCs
interface RRKRLtgigabitethernetRtautoRR(RRRtlower(RR4R5R!tinterface_typeRG((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyRE�s$-.BB-(sdescriptionsmtusspeedsduplex(t__name__t
__module__t__doc__RRR2RRR0R(R3RBR?RAR@RFRE(((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyRs 						
						N(RXt
__future__RRRttypet
__metaclass__t,ansible.module_utils.network.common.cfg.baseRt)ansible.module_utils.network.common.utilsRt.ansible.module_utils.network.iosxr.facts.factsRt.ansible.module_utils.network.iosxr.utils.utilsRRRR	R
RR(((sc/usr/lib/python2.7/site-packages/ansible/module_utils/network/iosxr/config/interfaces/interfaces.pyt<module>
s

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