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_interface.pyo

�
�Udac@sidd6dgd6dd6ZdZdZdZd	d
lmZmZmZd	dlmZm	Z	d	dlm
Z
d	d
lmZd	dl
Z
dd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkre�ndS(s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys1
---
module: nxos_igmp_interface
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages IGMP interface configuration.
description:
    - Manages IGMP interface configuration settings.
author:
    - Jason Edelman (@jedelman8)
    - Gabriele Gerbino (@GGabriele)
notes:
    - Tested against NXOSv 7.3.(0)D1(1) on VIRL
    - When C(state=default), supported params will be reset to a default state.
      These include C(version), C(startup_query_interval),
      C(startup_query_count), C(robustness), C(querier_timeout), C(query_mrt),
      C(query_interval), C(last_member_qrt), C(last_member_query_count),
      C(group_timeout), C(report_llg), and C(immediate_leave).
    - When C(state=absent), all configs for C(oif_ps), and
      C(oif_routemap) will be removed.
    - PIM must be enabled to use this module.
    - This module is for Layer 3 interfaces.
    - Route-map check not performed (same as CLI) check when configuring
      route-map with 'static-oif'
    - If restart is set to true with other params set, the restart will happen
      last, i.e. after the configuration takes place. However, 'restart' itself
      is not idempotent as it is an action and not configuration.
options:
    interface:
        description:
            - The full interface name for IGMP configuration.
              e.g. I(Ethernet1/2).
        required: true
    version:
        description:
            - IGMP version. It can be 2 or 3 or keyword 'default'.
        choices: ['2', '3', 'default']
    startup_query_interval:
        description:
            - Query interval used when the IGMP process starts up.
              The range is from 1 to 18000 or keyword 'default'.
              The default is 31.
    startup_query_count:
        description:
            - Query count used when the IGMP process starts up.
              The range is from 1 to 10 or keyword 'default'.
              The default is 2.
    robustness:
        description:
            - Sets the robustness variable. Values can range from 1 to 7 or
              keyword 'default'. The default is 2.
    querier_timeout:
        description:
            - Sets the querier timeout that the software uses when deciding
              to take over as the querier. Values can range from 1 to 65535
              seconds or keyword 'default'. The default is 255 seconds.
    query_mrt:
        description:
            - Sets the response time advertised in IGMP queries.
              Values can range from 1 to 25 seconds or keyword 'default'.
              The default is 10 seconds.
    query_interval:
        description:
            - Sets the frequency at which the software sends IGMP host query
              messages. Values can range from 1 to 18000 seconds or keyword
              'default'. The default is 125 seconds.
    last_member_qrt:
        description:
            - Sets the query interval waited after sending membership reports
              before the software deletes the group state. Values can range
              from 1 to 25 seconds or keyword 'default'. The default is 1 second.
    last_member_query_count:
        description:
            - Sets the number of times that the software sends an IGMP query
              in response to a host leave message.
              Values can range from 1 to 5 or keyword 'default'. The default is 2.
    group_timeout:
        description:
            - Sets the group membership timeout for IGMPv2.
              Values can range from 3 to 65,535 seconds or keyword 'default'.
              The default is 260 seconds.
    report_llg:
        description:
            - Configures report-link-local-groups.
              Enables sending reports for groups in 224.0.0.0/24.
              Reports are always sent for nonlink local groups.
              By default, reports are not sent for link local groups.
        type: bool
    immediate_leave:
        description:
            - Enables the device to remove the group entry from the multicast
              routing table immediately upon receiving a leave message for
              the group. Use this command to minimize the leave latency of
              IGMPv2 group memberships on a given IGMP interface because the
              device does not send group-specific queries.
              The default is disabled.
        type: bool
    oif_routemap:
        description:
            - Configure a routemap for static outgoing interface (OIF) or
              keyword 'default'.
    oif_prefix:
        description:
            - This argument is deprecated, please use oif_ps instead.
              Configure a prefix for static outgoing interface (OIF).
    oif_source:
        description:
            - This argument is deprecated, please use oif_ps instead.
              Configure a source for static outgoing interface (OIF).
    oif_ps:
        description:
            - Configure prefixes and sources for static outgoing interface (OIF). This
              is a list of dict where each dict has source and prefix defined or just
              prefix if source is not needed. The specified values will be configured
              on the device and if any previous prefix/sources exist, they will be removed.
              Keyword 'default' is also accepted which removes all existing prefix/sources.
        version_added: 2.6
    restart:
        description:
            - Restart IGMP. This is NOT idempotent as this is action only.
        type: bool
        default: False
    state:
        description:
            - Manages desired state of the resource.
        default: present
        choices: ['present', 'absent', 'default']
s�
- nxos_igmp_interface:
    interface: ethernet1/32
    startup_query_interval: 30
    oif_ps:
      - { 'prefix': '238.2.2.6' }
      - { 'source': '192.168.0.1', 'prefix': '238.2.2.5'}
    state: present
s3
proposed:
    description: k/v pairs of parameters passed into module
    returned: always
    type: dict
    sample: {"startup_query_count": "30",
             "oif_ps": [{'prefix': '238.2.2.6'}, {'source': '192.168.0.1', 'prefix': '238.2.2.5'}]}
existing:
    description: k/v pairs of existing igmp_interface configuration
    returned: always
    type: dict
    sample: {"startup_query_count": "2", "oif_ps": []}
end_state:
    description: k/v pairs of igmp interface configuration after module execution
    returned: always
    type: dict
    sample: {"startup_query_count": "30",
             "oif_ps": [{'prefix': '238.2.2.6'}, {'source': '192.168.0.1', 'prefix': '238.2.2.5'}]}
updates:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["interface Ethernet1/32", "ip igmp startup-query-count 30",
             "ip igmp static-oif 238.2.2.6", "ip igmp static-oif 238.2.2.5 source 192.168.0.1"]
changed:
    description: check to see if a change was made on the device
    returned: always
    type: bool
    sample: true
i����(t
get_configtload_configtrun_commands(tnxos_argument_spect
check_args(tget_interface_type(t
AnsibleModuleNtcli_showcCsJ|dkr&i|d6dd6g}ni|d6dd6g}t||�S(Ntcli_show_asciitcommandttexttoutputtjson(R(Rtmoduletcommand_typetcmds((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytexecute_show_command�s
cCs�dj|�}i}d}|dkr�t||�d}|dd}t|jdd	��}|d
ksx|dkr�d}q�n!|d
ks�|dkr�d	}n|S(Nsshow interface {0}tunknowntethernettportchannelitTABLE_interfacet
ROW_interfaceteth_modetlayer3taccessttrunktlayer2tloopbacktsvi(RR(tformatRtstrtget(t	interfacet	intf_typeRRtmodetbodytinterface_table((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytget_interface_mode�s	cCski}x^|j�D]P\}}|j|�}|r|j|�}|rV|||<qc|||<qqW|S(N(titemsR$(tkey_mapttabletnew_dicttkeytvaluetnew_key((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pyt
apply_key_map�s
cCsGg}x:|D]2}t|t�r2|j|�q
|j|�q
W|S(N(t
isinstancetlisttextendtappend(t
command_liststflat_command_listR((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytflatten_list�s
cCs
dj|�}i}i
dd6dd6dd6dd	6d
d6dd
6dd6dd6dd6dd6}t||�d}|rNd|kr�|S|dddd}t||�}t|d�j�}|dkr�t|d<n|dkr�t|d<nt|d �j�}tjd!|�r,t|d"<qNtjd#|�rNt|d"<qNnd$j|�}t||d%d&�d}g}	|r�|j	d'�}
d(}d)}x|
D]�}
i}y,tj
||
tj�}|j�d*}Wnt
k
r�d+}nXy<tj
||
tj�}|j�}|d,}|d-}Wnt
k
rQd+}d+}nX|re||d*<n|rx||d,<n|r�||d-<n|r�|	j|�q�q�Wnd|d.<g|d/<|	r	t|	�d0kr�|	djd*�r�|	dd*|d.<q	|	|d/<n|S(1Nsshow ip igmp interface {0}tversiontIGMPVersiontstartup_query_intervaltConfiguredStartupQueryIntervaltstartup_query_counttStartupQueryCountt
robustnesstRobustnessVariabletquerier_timeouttConfiguredQuerierTimeoutt	query_mrttConfiguredMaxResponseTimetquery_intervaltConfiguredQueryIntervaltlast_member_qrtt
LastMemberMTRtlast_member_query_counttLastMemberQueryCountt
group_timeouttConfiguredGroupTimeoutisnot runningt	TABLE_vrftROW_vrftTABLE_iftROW_iftReportingForLinkLocalttruet
report_llgtfalsetImmediateLeaves^en|^true|^enabledtimmediate_leaves^dis|^false|^disableds show run interface {0} | inc oifRR
s
s5.*ip igmp static-oif route-map\s+(?P<route_map>\S+).*sO.*ip igmp static-oif\s+(?P<prefix>((\d+.){3}\d+))(\ssource\s(?P<source>\S+))?.*t	route_mapttprefixtsourcetoif_routemaptoif_prefix_sourcei(R"RR2R#tlowertTruetFalsetretsearchtsplittmatchtDOTALLt	groupdicttAttributeErrorR6tNonetlenR$(RR%RtigmpR,R(tresourceRTRWt	staticoift
split_bodytroute_map_regextprefix_source_regextlinettemptmatch_route_mapRXtmatch_prefix_sourcetprefix_source_groupRZR[((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytget_igmp_interface�s�














%
cCs5idd6dd6dd6dd6d	d
6dd6d
d6dd6dd6dd6dd6dd6dd6dd6dd6}g}d}t�}x�|j�D]�\}}|dkr�|d kr�x�|D]�}	|	|kr�|j|	�q�|	d!}
d"}d#|	j�kr
|	d#}n|r8|j|jd�j|
|��q�|j|jd�j|
��q�W|rx�|D]�}	|	d!}
d"}d#|	j�kr�|	d#}n|r�|jd$|jd�j|
|��qh|jd$|jd�j|
��qhWqn	|dkrf|d krK|j|�rcd$|j|�j|j|��}qcq|j|�j|�}n�|r�|d kr�|j|�|j|�kr�|j|�j|j|��}q�q|j|�j|�}n*|sd%j|j|�j|��}n|r'||kr'|j|�q'nd}q�W|S(&Nsip igmp version {0}R:s"ip igmp startup-query-interval {0}R<sip igmp startup-query-count {0}R>sip igmp robustness-variable {0}R@sip igmp querier-timeout {0}RBs#ip igmp query-max-response-time {0}RDsip igmp query-interval {0}RFs+ip igmp last-member-query-response-time {0}RHs#ip igmp last-member-query-count {0}RJsip igmp group-timeout {0}RLs ip igmp report-link-local-groupsRTsip igmp immediate-leaveRWs"ip igmp static-oif {0} source {1} R]s ip igmp static-oif route-map {0}R\sip igmp static-oif {0}t
oif_prefixtoif_pstdefaultRZRYR[sno sno {0}(Rhtget_igmp_interface_defaultsR+tremovetkeysR6R$R"(tdeltatexistingtexisting_oif_prefix_sourcetCMDStcommandsRtdef_valsR/R0teachtpftsrc((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytconfig_igmp_interfaceZsr
	


%#


)-+'$
cCs�d}d}d}d}d}d}d}d}d}d}	t}
t}td|d	|d
|d|d|d
|d|d|d|d|	d|
d|�}td�|j�D��}
|
S(Nt2t31t255t10t125t1t260R:R<R>R@RBRDRFRHRJRLRTRWcss-|]#\}}|dk	r||fVqdS(N(Rh(t.0tparamR0((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pys	<genexpr>�s	(R`tdictR+(R:R<R>R@RBRDRFRHRJRLRTRWtargsRx((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pyRy�s*	cCsg}t�}tt|j��j|j���}|r{t||dd�}|r{x|D]}|j|�q^Wq{n|S(NR~(RyR�tsetR+t
differenceR�RhR6(R}R|R�tproposedRR�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytconfig_default_igmp_interface�s	'
cCs�g}d}|jd�r=|jdj|jd���n�|r�x�|D]�}|jd�r�|jd�r�dj|jd�|jd��}n*|jd�r�dj|jd��}n|r�|j|�nd}qJWn|S(NR\s#no ip igmp static-oif route-map {0}RZR[s%no ip igmp static-oif {0} source {1} sno ip igmp static-oif {0}(RhR$R6R"(R}R~R�RR�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytconfig_remove_oif�s "
!
c+s�tdtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�d	tdtdd�d
tdtdd�dtdtdd�dtdtdd�d
tdtdd�dtdtdd�dtdd�dtdd�dtdtdd�dtdtdddd�dtdtdddd�dtdtdd�dtdddt�dtddddgdd��}|jt�d<d=d>d?g}td|d |d!t�}t�}t||�|jd}|jd}|jd}|jd}|jd}|jd}	|r_|r_|j	d"d#�nF|r�|r�i|d$6|d%6g}	n |r�|r�i|d%6g}	nt
|�}
t||
|�d&kr�|j	d"d'�nt||�}|j
�}|}
|jd�s|j	d"d(�n|jd)�}|jd)�|rZ|rZ|j	d"d*�n|	r�|jd�r�|j	d"d+�nddddd	d
ddd
ddddg
�t}g}t�fd,�|jj�D��}ddddd	d
ddd
dddg}|dkrIx0|D]%}||kr|j	d"d-�qqWntt|j��j|j���}|	r�|	dkr�g|d<q�|	|d<n|dkr�|r�t|||�}|r�|j|�q�q�n�|dkrt||�}|r�|j|�q�nw|dkr�d}|jd�s7|rIt||�}n|r_|j|�nt||�}|r�|j|�q�ng}i}|r$|jd.d/j|�g�t|�}|jr�|jd0td1|�q$t||�t}t||�}
d2|kr$|jd.�q$n|jdrUid3d46d5d66}t||�n||d7<||d8<||d9<||d0<||d:<|
|d;<|j|�dS(@NR%trequiredttypeR#R:R<R>R@RBRDRFRHRJRLRTtboolRWR\Rvtremoved_in_versions2.10t
oif_sourceRwtrawtrestartRxtstatetchoicestpresenttabsentt
argument_spectmutually_exclusivetsupports_check_modetmsgs+oif_prefix required when setting oif_sourceR[RZRs,this module only works on Layer 3 interfacess(pim needs to be enabled on the interfaceR]sPDelete static-oif configurations on this interface if you want to use a routemaps`Delete static-oif route-map configuration on this interface if you want to config static entriesc3s9|]/\}}|dk	r|�kr||fVqdS(N(Rh(R�tktv(R�(sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pys	<genexpr>?s	sWonly params: oif_prefix, oif_source, oif_ps, oif_routemap can be used when state=absentis
interface {0}tchangedR�t	configuresrestart igmpRRRR�R}tupdatestwarningst	end_state(RwRv(RwR�(RwR\(RvR\(R�R_R`tupdateRRR4R	tparamst	fail_jsonR
R*RutcopyR$tpopR+R�R�R�R6R�RhR�tinsertR"R9t
check_modet	exit_jsonRR(R�R�RR�R�R%RvR�R\RwR&R}t
existing_copyR�R~R�R�R�t
CANNOT_ABSENTR�R|RRtresultstcmd((R�sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pytmain�s�
			









	%				
'

	







t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt&ansible.module_utils.network.nxos.nxosRRRRR	R
tansible.module_utils.basicRRaRR*R2R9RuR�RyR�R�R�t__name__(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_igmp_interface.pyt<module>s,


�			
	
	\	H				�

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