Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyc

�
�Udac@`s�dZddlmZmZmZeZddlmZm	Z	ddl
mZddlm
Z
ddlmZdefd��YZd	S(
s�
The vyos interfaces 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(tabsolute_importtdivisiontprint_function(tfindalltM(tdeepcopy(tutils(tInterfacesArgstInterfacesFactscB`sDeZdZddd�Zdd�Zd�Zd�Zd�ZRS(	s$ The vyos interfaces fact class
    tconfigtoptionscC`sj||_tj|_t|j�}|rN|rA|||}qT||}n|}tj|�|_dS(N(t_moduleRt
argument_specRRt
generate_dicttgenerated_spec(tselftmoduletsubspecR
tspectfacts_argument_spec((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyt__init__s	
cC`s,|s|jddg�}ng}td|t�}|r�xtt|�D]c}d|jd�}t||t�}|j|�}	|jd�|	d<|	rI|j|	�qIqIWni}
|rg|
d<tj|j	i|d6�}x/|dD] }|
djtj
|��q�Wn|d	j|
�|S(
s� Populate the facts for interfaces
        :param connection: the device connection
        :param ansible_facts: Facts dictionary
        :param data: previously collected conf
        :rtype: dictionary
        :returns: facts
        tflagss| grep interfacessK^set interfaces (?:ethernet|bonding|vti|loopback|vxlan) (?:\'*)(\S+)(?:\'*)s %s .+$t'tnamet
interfacesR	tansible_network_resources(t
get_configRRtsettstript
render_configtappendRtvalidate_configRtremove_emptiestupdate(Rt
connectiont
ansible_factstdatatobjstinterface_namest	interfacet
intf_regextcfgtobjtfactstparams((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pytpopulate_facts)s*
!cC`stdjtd�|��}djtd�|��}|jddddg|�}|j|�|d<tj|�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
cS`s
d|kS(Ntvif((tx((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyt<lambda>SscS`s
d|kS(NR.((R/((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyR0Tstdescriptiontspeedtmtutduplextvifs(tjointfiltert
parse_attribst
parse_vifsRR (Rtconftvif_confteth_confR	((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyRIs
cC`s�td|t�}d}|r�g}xwt|�D]i}d|}djt||t��}|jddg|�}t|�|d<|r1|j|�q1q1Wt|dd��}n|S(	Nsvif (?:\'*)(\d+)(?:\'*)s %s .+$s
R1R3tvlan_idtkeycS`s|dS(NR=((ti((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyR0hs(	RRtNoneRR6R8tintRtsorted(RR:t	vif_namest	vifs_listR.t	vif_regexR)R*((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyR9[s
cC`s�i}xt|D]l}tj||�}|rS|dkrSt|jd��||<q
|ro|jd�||<q
d||<q
Wd|kr�t|d<n
t|d<tj|�S(NR3Rtdisabletenabled(Rtparse_conf_argRARR@tFalsetTrueR (RtattribsR:R	titemtvalue((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyR8ls


N(	t__name__t
__module__t__doc__RR@R-RR9R8(((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyRs 		N(RPt
__future__RRRttypet
__metaclass__treRRtcopyRt#ansible.module_utils.network.commonRt?ansible.module_utils.network.vyos.argspec.interfaces.interfacesRtobjectR(((sa/usr/lib/python2.7/site-packages/ansible/module_utils/network/vyos/facts/interfaces/interfaces.pyt<module>s

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