
    Vh                     p    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZmZ d Zd Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona  
module: nxos_igmp
extends_documentation_fragment:
- cisco.nxos.nxos
short_description: Manages IGMP global configuration.
description:
- Manages IGMP global configuration configuration settings.
version_added: 1.0.0
author:
- Jason Edelman (@jedelman8)
- Gabriele Gerbino (@GGabriele)
notes:
- Tested against NXOSv 7.3.(0)D1(1) on VIRL
- Unsupported for Cisco MDS
- When C(state=default), all supported params will be reset to a default state.
- If restart is set to true with other params set, the restart will happen last, i.e.
  after the configuration takes place.
options:
  flush_routes:
    description:
    - Removes routes when the IGMP process is restarted. By default, routes are not
      flushed.
    type: bool
  enforce_rtr_alert:
    description:
    - Enables or disables the enforce router alert option check for IGMPv2 and IGMPv3
      packets.
    type: bool
  restart:
    description:
    - Restarts the igmp process (using an exec config command).
    type: bool
    default: False
  state:
    description:
    - Manages desired state of the resource.
    default: present
    choices:
    - present
    - default
    type: str
aH  
- name: Default igmp global params (all params except restart)
  cisco.nxos.nxos_igmp:
    state: default

- name: Ensure the following igmp global config exists on the device
  cisco.nxos.nxos_igmp:
    flush_routes: true
    enforce_rtr_alert: true

- name: Restart the igmp process
  cisco.nxos.nxos_igmp:
    restart: true
z
updates:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["ip igmp flush-routes"]
)AnsibleModule)load_configrun_commandsc                 >    t        | ddd      }d|d   v d|d   v dS )Nzshow running-configtextcommandoutputzip igmp flush-routesr   zip igmp enforce-router-alertflush_routesenforce_rtr_alert)r   )moduler   s     h/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/nxos/plugins/modules/nxos_igmp.pyget_currentr   `   s6    &.Cv"VWF.&);;vayH     c                 @    | j                   d   | j                   d   dS )Nr   r   r   )params)r   s    r   get_desiredr   h   s%    n5#]]+>? r   c            	      $   t        t        d      t        d      t        dd      t        ddgd            } t        | d	
      }t               }t        |      }t	        |      }|j
                  d   }t               }|dk(  r-|d   r|j                  d       |d   r|j                  d       n|dk(  rddd}dD ]w  }||   r5||   s0|j                  dj                  |j                  |                   =||   sC||   rI|j                  dj                  |j                  |                   y d||d}	|r|j                  st        ||       d	|	d<   |j
                  d   rddd}
t        ||
        |j                  di |	 y )Nbool)typeF)r   defaultpresentr   )choicesr   )r   r   restartstateT)argument_specsupports_check_moder   r   zno ip igmp flush-routesr   zno ip igmp enforce-router-alertzflush-routeszenforce-router-alertr   zip igmp {0}zno ip igmp {0})changedupdateswarningsr"   r   zrestart igmpr
   r    )dictr   listr   r   r   appendformatget
check_moder   r   	exit_json)r    r   r$   currentdesiredr   commandsldictargresultcmds              r   mainr4   o   s   v&F+&%0Iy19E	M DQFvH&!G&!GMM'"EvH	>"OO56&'OO=>	)	*!7
 9 	ICs|GCL 4 4UYYs^ DEgcl 0 7 7		# GH		I 8JF  ) y}}Y(F;VS!Fvr   __main__N)
__future__r   r   r   r   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   Eansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxosr   r   r   r   r4   __name__r%   r   r   <module>r>      sY   $ A @ )T
 5/d zF r   