Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/routeros/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyo

�
�Udac	@`skddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
lm
Z
ddlmZddlmZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZedededede�Zeej��Ze�Zd�Ze dkrge�ndS( i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: routeros_facts
version_added: "2.8"
author: "Egor Zaitsev (@heuels)"
short_description: Collect facts from remote devices running MikroTik RouterOS
description:
  - Collects a base set of device facts from a remote device that
    is running RotuerOS.  This module prepends all of the
    base network fact keys with C(ansible_net_<fact>).  The facts
    module will always collect a base set of facts from the device
    and can enable or disable collection of additional facts.
options:
  gather_subset:
    description:
      - When supplied, this argument will restrict the facts collected
        to a given subset.  Possible values for this argument include
        C(all), C(hardware), C(config), and C(interfaces).  Can specify a list of
        values to include a larger subset.  Values can also be used
        with an initial C(!) to specify that a specific subset should
        not be collected.
    required: false
    default: '!config'
s	
# Collect all facts from the device
- routeros_facts:
    gather_subset: all

# Collect only the config and default facts
- routeros_facts:
    gather_subset:
      - config

# Do not collect hardware facts
- routeros_facts:
    gather_subset:
      - "!hardware"
s`
ansible_net_gather_subset:
  description: The list of fact subsets collected from the device
  returned: always
  type: list

# default
ansible_net_model:
  description: The model name returned from the device
  returned: always
  type: str
ansible_net_serialnum:
  description: The serial number of the remote device
  returned: always
  type: str
ansible_net_version:
  description: The operating system version running on the remote device
  returned: always
  type: str
ansible_net_hostname:
  description: The configured hostname of the device
  returned: always
  type: str

# hardware
ansible_net_spacefree_mb:
  description: The available disk space on the remote device in MiB
  returned: when hardware is configured
  type: dict
ansible_net_spacetotal_mb:
  description: The total disk space on the remote device in MiB
  returned: when hardware is configured
  type: dict
ansible_net_memfree_mb:
  description: The available free memory on the remote device in MiB
  returned: when hardware is configured
  type: int
ansible_net_memtotal_mb:
  description: The total memory on the remote device in MiB
  returned: when hardware is configured
  type: int

# config
ansible_net_config:
  description: The current active config from the device
  returned: when config is configured
  type: str

# interfaces
ansible_net_all_ipv4_addresses:
  description: All IPv4 addresses configured on the device
  returned: when interfaces is configured
  type: list
ansible_net_all_ipv6_addresses:
  description: All IPv6 addresses configured on the device
  returned: when interfaces is configured
  type: list
ansible_net_interfaces:
  description: A hash of all interfaces running on the system
  returned: when interfaces is configured
  type: dict
ansible_net_neighbors:
  description: The list of neighbors from the remote device
  returned: when interfaces is configured
  type: dict
N(trun_commands(trouteros_argument_spec(t
AnsibleModule(t	iteritemst	FactsBasecB`s,eZe�Zd�Zd�Zd�ZRS(cC`s"||_t�|_d|_dS(N(tmoduletdicttfactstNonet	responses(tselfR
((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyt__init__�s	cC`s%t|jd|jdt�|_dS(Ntcommandstcheck_rc(RR
tCOMMANDStFalseR(R((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pytpopulate�scC`st|jd|dt�S(NRR(RR
R(Rtcmd((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pytrun�s(t__name__t
__module__tlistRRRR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR�s			tDefaultcB`sDeZdddgZd�Zd�Zd�Zd�Zd�ZRS(s%/system identity print without-pagings%/system resource print without-pagings(/system routerboard print without-pagingcC`s�tt|�j�|jd}|r?|j|�|jd<n|jd}|rk|j|�|jd<n|jd}|r�|j|�|jd<|j|�|jd<ndS(Nithostnameitversionitmodelt	serialnum(	tsuperRRRtparse_hostnameRt
parse_versiontparse_modeltparse_serialnum(Rtdata((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR�s


cC`s/tjd|tj�}|r+|jd�SdS(Nsname:\s(.*)\s*$i(tretsearchtMtgroup(RR(tmatch((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR$�scC`s/tjd|tj�}|r+|jd�SdS(Nsversion:\s(.*)\s*$i(R)R*R+R,(RR(R-((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR%�scC`s/tjd|tj�}|r+|jd�SdS(Nsmodel:\s(.*)\s*$i(R)R*R+R,(RR(R-((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR&�scC`s/tjd|tj�}|r+|jd�SdS(Nsserial-number:\s(.*)\s*$i(R)R*R+R,(RR(R-((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR'�s(RRRRR$R%R&R'(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR�s					tHardwarecB`s5eZdgZd�Zd�Zd�Zd�ZRS(s%/system resource print without-pagingcC`sGtt|�j�|jd}|rC|j|�|j|�ndS(Ni(R#R.RRtparse_filesystem_infotparse_memory_info(RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR�s


cC`srtjd|tj�}|r7|j|�|jd<ntjd|tj�}|rn|j|�|jd<ndS(Nsfree-hdd-space:\s(.*)([KMG]iB)tspacefree_mbstotal-hdd-space:\s(.*)([KMG]iB)t
spacetotal_mb(R)R*R+tto_megabytesR(RR(R-((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR/�scC`srtjd|tj�}|r7|j|�|jd<ntjd|tj�}|rn|j|�|jd<ndS(Ns"free-memory:\s(\d+\.?\d*)([KMG]iB)t
memfree_mbs#total-memory:\s(\d+\.?\d*)([KMG]iB)tmemtotal_mb(R)R*R+R3R(RR(R-((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR0�scC`s�|jd�dkr,t|jd��dS|jd�dkrTt|jd��S|jd�dkr�t|jd��dSdSdS(NitKiBiitMiBtGiB(R,tfloatR(RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR3�s(RRRRR/R0R3(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR.�s
				tConfigcB`seZdgZd�ZRS(s/exportcC`s:tt|�j�|jd}|r6||jd<ndS(Nitconfig(R#R:RRR(RR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR�s
(RRRR(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR:�s	t
InterfacescB`s�eZddddgZejd�Zejd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�ZRS(s&/interface print detail without-pagings'/ip address print detail without-pagings)/ipv6 address print detail without-pagings(/ip neighbor print detail without-pagingsC([\w\d\-]+)=\"?(\w{3}/\d{2}/\d{4}\s\d{2}:\d{2}:\d{2}|[\w\d\-\.:/]+)s
^\s+(?!\d)cC`stt|�j�t�|jd<t�|jd<t�|jd<t�|jd<|jd}|r�|j|�}|j|�n|jd}|r�|j	|�}|j
|�n|jd}|r�|j	|�}|j|�n|jd}|r|j|�|jd<ndS(	Nt
interfacestall_ipv4_addressestall_ipv6_addressest	neighborsiiii(
R#R<RRRRRtparse_interfacestpopulate_interfacestparse_addressestpopulate_ipv4_interfacestpopulate_ipv6_interfacestparse_neighbors(RR(R=((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR�s(



cC`s2x+t|�D]\}}||jd|<q
WdS(NR=(RR(RR(tkeytvalue((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRBscC`s�x�t|�D]�\}}d|jd|krKt�|jd|d<n|djd�\}}td|j�d|j��}|j|j�d�|jd|dj|�q
WdS(Ntipv4R=taddresst/tsubnet(RRRtsplitRtstriptadd_ip_addresstappend(RR(RGRHtaddrRLRI((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRDs!cC`s�x�t|�D]�\}}|dkr)Pnd|jd|kr[t�|jd|d<n|djd�\}}td|j�d|j��}|j|j�d�|jd|dj|�q
WdS(Ntipv6R=RJRKRL(	RRRRRMRRNRORP(RR(RGRHRQRLRR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRE#s!cC`s;|dkr#|jdj|�n|jdj|�dS(NRIR>R?(RRP(RRJtfamily((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRO.scC`s�t�}xt|jd�D]c}t|�dks|d dkrGqqtj|j|�sl|j|�q|dc|7<qW|S(Ns
iitFlagsi����(RRMtlenR)R-tWRAPPED_LINE_RERP(RR(tpreprocessedtline((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyt
preprocess4s	"cC`s}t�}|j|�}x^|D]V}|j|�}t�||<x1tj|j|�D]\}}||||<qWWqW|S(N(RRYt
parse_nameR)tfindallt	DETAIL_RE(RR(RRXtnameRGRH((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRA?s	

"cC`s}t�}|j|�}x^|D]V}|j|�}t�||<x1tj|j|�D]\}}||||<qWWqW|S(N(RRYtparse_interfaceR)R[R\(RR(RRXR]RGRH((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRCIs	

"cC`s}t�}|j|�}x^|D]V}|j|�}t�||<x1tj|j|�D]\}}||||<qWWqW|S(N(RRYR^R)R[R\(RR(RRXR]RGRH((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRFSs	

"cC`s/tjd|tj�}|r+|jd�SdS(Nsname=\"([\w\d\-]+)\"i(R)R*R+R,(RR(R-((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyRZ]scC`s/tjd|tj�}|r+|jd�SdS(Nsinterface=([\w\d\-]+)i(R)R*R+R,(RR(R-((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR^bs(RRRR)tcompileR\RVRRBRDRERORYRARCRFRZR^(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyR<�s"									
	
	
	tdefaultthardwareR=R;c
C`stdtddgdd��}|jt�td|dt�}|jd}t�}t�}x�|D]�}|dkr�|jt�qin|jd	�r�|d
}|dkr�|jt�qint}nt	}|tkr�|j
dd|�n|r|j|�qi|j|�qiW|s5|jt�n|j|�|jd�t�}t
|�|d<t
�}x%|D]}	|jt|	|��qxWx(|D] }
|
j�|j|
j�q�Wt�}x.t|�D] \}	}d
|	}	|||	<q�W|jd|dt�dS(s*main entry point for module execution
    t
gather_subsetR`s!configttypeRt
argument_spectsupports_check_modetallt!itmsgsBad subset: %ssansible_net_%st
ansible_factstwarningsN(RtupdateR	R
tTruetparamstsett
VALID_SUBSETSt
startswithRt	fail_jsontaddtdifference_updateRRPtFACT_SUBSETSRRRt	exit_jsonRj(
RdR
Rbtrunable_subsetstexclude_subsetstsubsettexcludeRt	instancesRGtinstRiRH((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pytmaintsR
	
		



	

		


	
t__main__(!t
__future__RRRRct
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR)t.ansible.module_utils.network.routeros.routerosRR	tansible.module_utils.basicR
tansible.module_utils.sixRtobjectRRR.R:R<RRtt	frozensettkeysRoRRjR|R(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/routeros/routeros_facts.pyt<module>s6


C,(y			@

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