Anons79 Mini Shell

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

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZmZd	dlm	Z	m
Z
d	d
lmZdd�Z
d�Zd�Zd�Zed�Zd�Zd�Zd�Zedkr�e�nd
S(s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys!
---
module: nxos_igmp_snooping
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages IGMP snooping global configuration.
description:
    - Manages IGMP snooping global configuration.
author:
    - Jason Edelman (@jedelman8)
    - Gabriele Gerbino (@GGabriele)
notes:
    - Tested against NXOSv 7.3.(0)D1(1) on VIRL
    - When C(state=default), params will be reset to a default state.
    - C(group_timeout) also accepts I(never) as an input.
options:
    snooping:
        description:
            - Enables/disables IGMP snooping on the switch.
        type: bool
    group_timeout:
        description:
            - Group membership timeout value for all VLANs on the device.
              Accepted values are integer in range 1-10080, I(never) and
              I(default).
    link_local_grp_supp:
        description:
            - Global link-local groups suppression.
        type: bool
    report_supp:
        description:
            - Global IGMPv1/IGMPv2 Report Suppression.
        type: bool
    v3_report_supp:
        description:
            - Global IGMPv3 Report Suppression and Proxy Reporting.
        type: bool
    state:
        description:
            - Manage the state of the resource.
        default: present
        choices: ['present','default']
sh
# ensure igmp snooping params supported in this module are in there default state
- nxos_igmp_snooping:
    state: default

# ensure following igmp snooping params are in the desired state
- nxos_igmp_snooping:
   group_timeout: never
   snooping: true
   link_local_grp_supp: false
   optimize_mcast_flood: false
   report_supp: true
   v3_report_supp: true
sa
commands:
    description: command sent to the device
    returned: always
    type: list
    sample: ["ip igmp snooping link-local-groups-suppression",
             "ip igmp snooping group-timeout 50",
             "no ip igmp snooping report-suppression",
             "no ip igmp snooping v3-report-suppression",
             "no ip igmp snooping"]
i����N(t
get_configtload_configtrun_commands(tnxos_argument_spect
check_args(t
AnsibleModulettextcCs$i|d6|d6}t||g�S(Ntcommandtoutput(R(RtmoduleR
((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytexecute_show_commandgs
cCsGg}x:|D]2}t|t�r2|j|�q
|j|�q
W|S(N(t
isinstancetlisttextendtappend(t
command_liststflat_command_listR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytflatten_listps
cCs:tjd|tj�}|r0|jd�}nd}|S(Ns!  Group timeout configured: (\S+)it(tretsearchtMtgroup(tconfigtmatchtvalue((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytget_group_timeoutzs
cCs�d}i}yt||dd�d}Wntk
rBg}nX|rtt|jd��j�}|dks||dkr�t|d<n
t|d<t|jd��j�}|dks�|dkr�t|d	<n
t|d	<t|jd
��j�}|dks|dkrt|d<n
t|d<t|jd��j�}|dksZ|dkrgt|d
<qtt|d
<nd}t||�d}|r�t|�|d<n|S(Nsshow ip igmp snoopingR
tjsonitenabledttruetsnoopingtgrepsuptreport_supptglinklocalgrpsuptlink_local_grp_suppt	gv3repsuptv3_report_suppt
group_timeout(Rt
IndexErrortstrtgettlowertTruetFalseR(RRtexistingtbodyR#R%R'R)((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytget_igmp_snooping�s8









c	Csiidd6dd6dd6dd6d	d
6}g}d}d}x|j�D]\}}|r|r�|dkr�|j|�rd|j|�j|j|��}qq/|dkr�|dkr�|j|�rd|j|�j|j|��}qq/|j|�j|�}nd|j|�j|�}|rE|j|�nd}qHW|re|j|�n|S(
Nsip igmp snoopingR#s!ip igmp snooping group-timeout {}R*s.ip igmp snooping link-local-groups-suppressionR's&ip igmp snooping v3-report-suppressionR)s#ip igmp snooping report-suppressionR%sno tdefault(tNonetitemsR-tformatR(	tdeltaR1R4tCMDStcommandsRt
gt_commandtkeyR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytconfig_igmp_snooping�s2
++
cCsed}t}t}t}t}td|d|d|d|d|�}td�|j�D��}|S(NtdummyR#R'R%R)R*css-|]#\}}|dk	r||fVqdS(N(R5(t.0tparamR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pys	<genexpr>�s	(R/R0tdictR6(R*R%R'R)R#targsR4((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytget_igmp_snooping_defaults�s	cCs�g|D]}|jd�r|^q}|r�d|ksV|dtkrod|krod}|jd|�q�|j|d�|j|d�ndS(Nsip igmp snooping group-timeoutsno ip igmp snoopingR#sip igmp snoopingsLgroup-timeout cannot be enabled or changed when ip igmp snooping is disabledtmsgi(t
startswithR0t	fail_jsontremoveR(RR1RtitgtRD((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytigmp_snooping_gt_dependency�s((cCs�tdtdtdd�dtdtdd�dtdtdd�dtdtdd�d	tdtdd�d
tddd
gd
d��}|jt�td|dt�}t�}t||�itd6gd6|d6}|jd}|jd}|jd}|jd	}|jd}|jd
}	td|d|d|d	|d|�}
td�|
j	�D��}t
|�}g}
|	dkrtt|j	��j|j	���}|rst
||�}|r�|r�t|||�n|
j|�q�qsns|	d
krst�}tt|j	��j|j	���}|rst
||d
t�}|rp|
j|�qpqsnt|
�}|r�t|d<|js�t||�nd|kr�|jd�n||d<n|j|�dS(NR#trequiredttypetboolR*R,R'R%R)tstatetchoicestpresentR4t
argument_spectsupports_check_modetchangedR:twarningscss-|]#\}}|dk	r||fVqdS(N(R5(R?R@R((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pys	<genexpr>s	t	configurei(RAR0tupdateRR
R/RR	tparamsR6R3tsett
differenceR=RJRRCRt
check_modeRtpopt	exit_json(RQRRTtresultsR#R'R%R)R*RNRBtproposedR1R:R8Rtcmds((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pytmain�sd
	






	$	$
	
t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRt&ansible.module_utils.network.nxos.nxosRRRRR	tansible.module_utils.basicR
RRRR3R0R=RCRJR`t__name__(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_snooping.pyt<module>s&


-		
			*#		
	C

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