Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/net_tools/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pyc

�
�Udac@`sCddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dZydd
lmZeZWn#ek
r�ej�ZeZnXddlmZmZddlmZdefd��YZd�Zd�Zd�Z d�Z!d�Z"e#dkr?e"�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysF
---
module: snmp_facts
version_added: "1.9"
author:
- Patrick Ogenstad (@ogenstad)
short_description: Retrieve facts for a device using SNMP
description:
    - Retrieve facts for a device using SNMP, the facts will be
      inserted to the ansible_facts key.
requirements:
    - pysnmp
options:
    host:
        description:
            - Set to target snmp server (normally C({{ inventory_hostname }})).
        type: str
        required: true
    version:
        description:
            - SNMP Version to use, v2/v2c or v3.
        type: str
        required: true
        choices: [ v2, v2c, v3 ]
    community:
        description:
            - The SNMP community string, required if version is v2/v2c.
        type: str
    level:
        description:
            - Authentication level.
            - Required if version is v3.
        type: str
        choices: [ authNoPriv, authPriv ]
    username:
        description:
            - Username for SNMPv3.
            - Required if version is v3.
        type: str
    integrity:
        description:
            - Hashing algorithm.
            - Required if version is v3.
        type: str
        choices: [ md5, sha ]
    authkey:
        description:
            - Authentication key.
            - Required if version is v3.
        type: str
    privacy:
        description:
            - Encryption algorithm.
            - Required if level is authPriv.
        type: str
        choices: [ aes, des ]
    privkey:
        description:
            - Encryption key.
            - Required if version is authPriv.
        type: str
s�
- name: Gather facts with SNMP version 2
  snmp_facts:
    host: '{{ inventory_hostname }}'
    version: v2c
    community: public
  delegate_to: local

- name: Gather facts using SNMP version 3
  snmp_facts:
    host: '{{ inventory_hostname }}'
    version: v3
    level: authPriv
    integrity: sha
    privacy: aes
    username: snmp-user
    authkey: abc12345
    privkey: def6789
  delegate_to: localhost
s�
ansible_sysdescr:
  description: A textual description of the entity.
  returned: success
  type: str
  sample: Linux ubuntu-user 4.4.0-93-generic #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017 x86_64
ansible_sysobjectid:
  description: The vendor's authoritative identification of the network management subsystem contained in the entity.
  returned: success
  type: str
  sample: 1.3.6.1.4.1.8072.3.2.10
ansible_sysuptime:
  description: The time (in hundredths of a second) since the network management portion of the system was last re-initialized.
  returned: success
  type: int
  sample: 42388
ansible_syscontact:
  description: The textual identification of the contact person for this managed node, together with information on how to contact this person.
  returned: success
  type: str
  sample: Me <[email protected]>
ansible_sysname:
  description: An administratively-assigned name for this managed node.
  returned: success
  type: str
  sample: ubuntu-user
ansible_syslocation:
  description: The physical location of this node (e.g., `telephone closet, 3rd floor').
  returned: success
  type: str
  sample: Sitting on the Dock of the Bay
ansible_all_ipv4_addresses:
  description: List of all IPv4 addresses.
  returned: success
  type: list
  sample: ["127.0.0.1", "172.17.0.1"]
ansible_interfaces:
  description: Dictionary of each network interface and its metadata.
  returned: success
  type: dict
  sample: {
    "1": {
        "adminstatus": "up",
        "description": "",
        "ifindex": "1",
        "ipv4": [
            {
                "address": "127.0.0.1",
                "netmask": "255.0.0.0"
            }
        ],
        "mac": "",
        "mtu": "65536",
        "name": "lo",
        "operstatus": "up",
        "speed": "65536"
    },
    "2": {
        "adminstatus": "up",
        "description": "",
        "ifindex": "2",
        "ipv4": [
            {
                "address": "192.168.213.128",
                "netmask": "255.255.255.0"
            }
        ],
        "mac": "000a305a52a1",
        "mtu": "1500",
        "name": "Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)",
        "operstatus": "up",
        "speed": "1500"
    }
  }
N(tdefaultdict(tcmdgen(t
AnsibleModuletmissing_required_lib(tto_textt	DefineOidcB`seZed�ZRS(cC`s�|rd}nd}|d|_|d|_|d|_|d|_|d|_|d|_|d	|_|d
|_|d|_|d|_	|d
|_
|d|_|d|_|d|_
|d|_|d|_|d|_dS(Nt.ts1.3.6.1.2.1.1.1.0s1.3.6.1.2.1.1.2.0s1.3.6.1.2.1.1.3.0s1.3.6.1.2.1.1.4.0s1.3.6.1.2.1.1.5.0s1.3.6.1.2.1.1.6.0s1.3.6.1.2.1.2.2.1.1s1.3.6.1.2.1.2.2.1.2s1.3.6.1.2.1.2.2.1.4s1.3.6.1.2.1.2.2.1.5s1.3.6.1.2.1.2.2.1.6s1.3.6.1.2.1.2.2.1.7s1.3.6.1.2.1.2.2.1.8s1.3.6.1.2.1.31.1.1.1.18s1.3.6.1.2.1.4.20.1.1s1.3.6.1.2.1.4.20.1.2s1.3.6.1.2.1.4.20.1.3(tsysDescrtsysObjectIdt	sysUpTimet
sysContacttsysNametsysLocationtifIndextifDescrtifMtutifSpeedt
ifPhysAddresst
ifAdminStatustifOperStatustifAliastipAdEntAddrtipAdEntIfIndextipAdEntNetMask(tselft	dotprefixtdp((sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pyt__init__�s(	















(t__name__t
__module__tFalseR$(((sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pyR
�scC`sEt|�dkr|S|d dkr=ttj|d��S|SdS(Niit0x(tlenRtbinasciit	unhexlify(t	hexstring((sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pyt
decode_hex�s
cC`s6t|�dkr|S|d dkr.|dS|SdS(NiiR((R)(R,((sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pyt
decode_mac�s
cC`s7idd6dd6dd6}||kr/||SdSdS(NtupitdownittestingiR((tint_adminstatustadminstatus_options((sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pytlookup_adminstatus�s
cC`sSidd6dd6dd6dd6d	d
6dd6d
d6}||krK||SdSdS(NR/iR0iR1itunknownitdormantit
notPresentitlowerLayerDowniR((tint_operstatustoperstatus_options((sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pytlookup_operstatus�s
c`s�	tdtdtdddt�dtdddtddd	d
g�dtdd�dtdd�d
tdddddg�dtdddddg�dtdddddg�dtdddt�dtdddt��	ddd
ddgddgfdt�}|j}ts6|jdtd�dt�nt	j
�}|ddksb|dd	kr�|ddkr�|jdd�q�n|dd
kra|ddkr�|jdd�n|d
dkr�|ddkr�|jdd �n|ddkr
t	j}n|ddkr&t	j
}n|ddkrBt	j}qa|ddkrat	j}qan|ddks�|dd	kr�t	j|d�}ni|d
dkr�t	j|dd!|dd"|�}n3t	j|dd!|dd#|dd"|d$|�}td%t�}td%t�}�fd&����}|j|t	j|dd'f�t	j|j�t	j|j�t	j|j�t	j|j�t	j|j�t	j|j�d(t�\}	}
}}|	r�|jdt|	��nx�|D]�\}
}|
j�}|j�}||jkr3t|�|d)<q�||jkrO||d*<q�||jkrk||d+<q�||jkr�||d,<q�||jkr�||d-<q�||jkr�||d.<q�q�W|j|t	j|dd'f�t	j|j �t	j|j!�t	j|j"�t	j|j#�t	j|j$�t	j|j%�t	j|j&�t	j|j'�t	j|j(�t	j|j)�t	j|j*�d(t�
\}	}
}}|	r�|jdt|	��ng}g}��}xD|D]<}x3|D]+\}
}|
j�}|j�}|j |krXt+|j,d/d0�d1�}||d2|d3<|j-|�n|j!|kr�t+|j,d/d0�d1�}||d2|d4<n|j"|kr�t+|j,d/d0�d1�}||d2|d5<n|j#|krt+|j,d/d0�d1�}||d2|d6<n|j$|kr^t+|j,d/d0�d1�}t.|�|d2|d7<n|j%|kr�t+|j,d/d0�d1�}t/t+|��|d2|d8<n|j&|kr�t+|j,d/d0�d1�}t0t+|��|d2|d9<n|j'|krH|j,d/d:�d;}d/j1|�}|||d<<|j-|�n|j(|kr�|j,d/d:�d;}d/j1|�}|||d=<n|j)|kr�|j,d/d:�d;}d/j1|�}|||d><n|j*|kr�t+|j,d/d0�d1�}||d2|d?<q�q�Wq�Wi}x{|D]s}||d=}i||d<d<6||d>d>6}||kr�	g||<||j-|�q'	||j-|�q'	Wx*|D]"}|||d2t+|�d@<q�	W||dA<|j2dB|�dS(CNt
argument_specthostttypetstrtrequiredtversiontchoicestv2tv2ctv3Rtusernametlevelt
authNoPrivtauthPrivt	integritytmd5tshatprivacytaestdestauthkeytno_logtprivkeytrequired_togethertsupports_check_modetmsgtpysnmpt	exceptions+Community not set when using snmp version 2s*Username not set when using snmp version 3s-Privacy algorithm not set when using authPrivtauthKeytauthProtocoltprivKeytprivProtocolR"c`s
t��S(N(R((tTree(sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pyR\Qsi�t	lookupMibtansible_sysdescrtansible_sysobjectidtansible_sysuptimetansible_syscontacttansible_sysnametansible_syslocationRii����tansible_interfacestifindextnametmtutspeedtmactadminstatust
operstatusii����taddresst	interfacetnetmasktdescriptiontipv4tansible_all_ipv4_addressest
ansible_facts(3R
tdicttTrueR'tparamst
has_pysnmpt	fail_jsonRtPYSNMP_IMP_ERRR	tCommandGeneratortNonetusmHMACSHAAuthProtocoltusmHMACMD5AuthProtocoltusmAesCfb128ProtocoltusmDESPrivProtocolt
CommunityDatatUsmUserDataR
tgetCmdtUdpTransportTargettMibVariableRRRRRRR?tprettyPrintR-tnextCmdRRRRRRRRRR RtinttrsplittappendR.R4R;tjoint	exit_json(tmoduletm_argstcmdGentintegrity_protot
privacy_protot	snmp_authtptvtresultsterrorIndicationterrorStatust
errorIndextvarBindstoidtvaltcurrent_oidtcurrent_valtvarTabletinterface_indexestall_ipv4_addressest
ipv4_networksRt	curIPListtcurIPtinterface_to_ipv4tipv4_networktcurrent_interfacetcurrent_networkRm((R\sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pytmains&$		   &*		



	
!!


 
t__main__($t
__future__RRRR>t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR*t	tracebacktcollectionsRRzRxtpysnmp.entity.rfc3413.onelinerR	RtRvt	Exceptiont
format_excR'tansible.module_utils.basicR
Rtansible.module_utils._textRtobjectR
R-R.R4R;R�R%(((sH/usr/lib/python2.7/site-packages/ansible/modules/net_tools/snmp_facts.pyt<module>s6


?L


 	
	
			�

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