Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/onyx/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyc

�
�Udac@`sPddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZddlmZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZededede�Zeej��Zd�ZedkrLe�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: onyx_facts
version_added: "2.5"
author: "Waleed Mousa (@waleedym), Samer Deeb (@samerd)"
short_description: Collect facts from Mellanox ONYX network devices
description:
  - Collects a base set of device facts from a ONYX Mellanox network devices
    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.
notes:
  - Tested against ONYX 3.6
options:
  gather_subset:
    description:
      - When supplied, this argument will restrict the facts collected
        to a given subset.  Possible values for this argument include
        all, version, module, and interfaces.  Can specify a list of
        values to include a larger subset.  Values can also be used
        with an initial C(M(!)) to specify that a specific subset should
        not be collected.
    required: false
    default: version
s
---
- name: Collect all facts from the device
  onyx_facts:
    gather_subset: all
- name: Collect only the interfaces facts
  onyx_facts:
    gather_subset:
      - interfaces
- name: Do not collect version facts
  onyx_facts:
    gather_subset:
      - "!version"
sk
ansible_net_gather_subset:
  description: The list of fact subsets collected from the device
  returned: always
  type: list
# version
ansible_net_version:
  description: A hash of all currently running system image information
  returned: when version is configured or when no gather_subset is provided
  type: dict
# modules
ansible_net_modules:
  description: A hash of all modules on the systeme with status
  returned: when modules is configured
  type: dict
# interfaces
ansible_net_interfaces:
  description: A hash of all interfaces running on the system
  returned: when interfaces is configured
  type: dict
(t
AnsibleModule(t	iteritems(tBaseOnyxModule(tshow_cmdtOnyxFactsModulecB`s#eZd�Zd�Zd�ZRS(cC`st�}t�}x�|D]�}|dkr>|jt�qn|jd�r|d}|dkrv|jt�qnt}nt}|tkr�|jjdd�n|r�|j|�q|j|�qW|s�|jt�n|j	|�|s|jd�n|S(Ntallt!itmsgs
Bad subsettversion(
tsettupdatet
VALID_SUBSETSt
startswithtTruetFalset_modulet	fail_jsontaddtdifference_update(tselft
gather_subsettrunable_subsetstexclude_subsetstsubsettexclude((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pytget_runable_subsetVs0		



	
cC`s=tdtddgdd��}td|dt�|_dS(	s module initialization
        RtdefaultRttypetlistt
argument_spectsupports_check_modeN(tdictRRR(RR%((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pytinit_modulews
c
C`s�|j�|jjd}|j|�}t�}t|�|d<t�}x.|D]&}t|}|j||j��qRWx(|D] }|j�|j	|j
�q�Wt�}x.t|�D] \}}	d|}|	||<q�W|jjd|�dS(NRsansible_net_%st
ansible_facts(
R(RtparamsR!R'R$tFACT_SUBSETStappendtpopulateRtfactsR	t	exit_json(
RRRR.t	instancestkeyt
facter_clstinstR)tvalue((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pytrun�s"
		



	
(t__name__t
__module__R!R(R5(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyRTs	!	
t	FactsBasecB`s,eZdgZd�Zd�Zd�ZRS(tcC`s"||_t�|_d|_dS(N(tmoduleR'R.tNonet	responses(RR:((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyt__init__�s	cC`st|j|dt�S(Ntjson_fmt(RR:R(Rtcmd((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyt	_show_cmd�scC`s:g|_x*|jD]}|jj|j|��qWdS(N(R<tCOMMANDSR,R@(RR?((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyR-�s	(R6R7RAR=R@R-(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyR8�s			tVersioncB`seZdgZd�ZRS(sshow versioncC`s:tt|�j�|jd}|r6||jd<ndS(NiR(tsuperRBR-R<R.(Rtdata((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyR-�s
(R6R7RAR-(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyRB�s	tModulecB`seZdgZd�ZRS(sshow modulecC`s:tt|�j�|jd}|r6||jd<ndS(Nitmodules(RCRER-R<R.(RRD((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyR-�s
(R6R7RAR-(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyRE�s	t
InterfacescB`s/eZddgZd�Zd�Zd�ZRS(sshow versionsshow interfaces ethernetcC`s]tt|�j�|jd}|d}|jd}|rY|j||�|jd<ndS(NisProduct releaseit
interfaces(RCRGR-R<tpopulate_interfacesR.(Rtversion_datat
os_versionRD((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyR-�s


cC`s;i|dd6|dd6|dd6|dd6|dd	6S(
NsMac addresssMAC AddresssActual speedsActual SpeedtMTUsAdmin statesAdmin StatesOperational statesOperational State((Rtinterface_data((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyt
extractIfData�s
cC`s�t�}x�|D]�}t�}|tjkruxet|�D]3\}}|d}|j|�}|}|d<q;Wn!|j|�}|d}|d<|||<qW|S(NisInterface Nametheader(R'R
tONYX_API_VERSIONR	RN(RRHRKtinterfaces_dicttif_datatif_dicttif_nameRM((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyRI�s	
	
(R6R7RAR-RNRI(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyRG�s	
	RRFRHcC`stj�dS(s+ main entry point for module execution
    N(Rtmain(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyRU�st__main__N(t
__future__RRRR#t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRtansible.module_utils.sixR	t&ansible.module_utils.network.onyx.onyxR
RRtobjectR8RBRERGR'R+t	frozensettkeysRRUR6(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/onyx/onyx_facts.pyt<module>s0


D&		

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