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_pim_interface.pyc

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lZd	dlmZd	dlmZm	Z	m
Z
d	d
lmZmZd	dlm
Z
d	dlmZi
dd6dd6dd6dd6dd6dd6dd6dd6d d!6dd"6dd#6d$d%6dd&6Zid'd6d(d6d)d6ed6ed6ed6Zid
d
6d*d'6d+d,6dd-6Zed.�Zd/�Zd0�Zd1�Zd2�Zd3�Zd4�Zd5�Zd6�Zd7�Zd8�Zd9�Z e!d:kr�e �nd
S(;s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�

---
module: nxos_pim_interface
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages PIM interface configuration.
description:
  - Manages PIM interface configuration settings.
author:
  - Jason Edelman (@jedelman8)
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(dr_prio), C(hello_auth_key), C(hello_interval), C(jp_policy_out),
    C(jp_policy_in), C(jp_type_in), C(jp_type_out), C(border), C(neighbor_policy),
    C(neighbor_type).
  - The C(hello_auth_key) param is not idempotent.
  - C(hello_auth_key) only supports clear text passwords.
  - When C(state=absent), pim interface configuration will be set to defaults and pim-sm
    will be disabled on the interface.
  - PIM must be enabled on the device to use this module.
  - This module is for Layer 3 interfaces.
options:
  interface:
    description:
      - Full name of the interface such as Ethernet1/33.
    type: str
    required: true
  sparse:
    description:
      - Enable/disable sparse-mode on the interface.
    type: bool
    default: no
  bfd:
    description:
      - Enables BFD for PIM at the interface level. This overrides the bfd variable set at the pim global level.
      - Valid values are 'enable', 'disable' or 'default'.
      - "Dependency: 'feature bfd'"
    version_added: "2.9"
    type: str
    choices: ['enable', 'disable', 'default']
  dr_prio:
    description:
      - Configures priority for PIM DR election on interface.
    type: str
  hello_auth_key:
    description:
      - Authentication for hellos on this interface.
    type: str
  hello_interval:
    description:
      - Hello interval in milliseconds for this interface.
    type: int
  jp_policy_out:
    description:
      - Policy for join-prune messages (outbound).
    type: str
  jp_policy_in:
    description:
      - Policy for join-prune messages (inbound).
    type: str
  jp_type_out:
    description:
      - Type of policy mapped to C(jp_policy_out).
    type: str
    choices: [ prefix, routemap ]
  jp_type_in:
    description:
      - Type of policy mapped to C(jp_policy_in).
    type: str
    choices: [ prefix, routemap ]
  border:
    description:
      - Configures interface to be a boundary of a PIM domain.
    type: bool
    default: no
  neighbor_policy:
    description:
      - Configures a neighbor policy for filtering adjacencies.
    type: str
  neighbor_type:
    description:
      - Type of policy mapped to neighbor_policy.
    type: str
    choices: [ prefix, routemap ]
  state:
    description:
      - Manages desired state of the resource.
    type: str
    choices: [ present, default ]
    default: present
s�
- name: Ensure PIM is not running on the interface
  nxos_pim_interface:
    interface: eth1/33
    state: absent

- name: Ensure the interface has pim-sm enabled with the appropriate priority and hello interval
  nxos_pim_interface:
    interface: eth1/33
    dr_prio: 10
    hello_interval: 40
    state: present

- name: Ensure join-prune policies exist
  nxos_pim_interface:
    interface: eth1/33
    jp_policy_in: JPIN
    jp_policy_out: JPOUT
    jp_type_in: routemap
    jp_type_out: routemap

- name: disable bfd on the interface
  nxos_pim_interface:
    interface: eth1/33
    bfd: disable

- name: Ensure defaults are in place
  nxos_pim_interface:
    interface: eth1/33
    state: default
s
commands:
    description: command sent to the device
    returned: always
    type: list
    sample: ["interface eth1/33",
             "ip pim neighbor-policy test",
             "ip pim bfd-instance disable",
             "ip pim neighbor-policy test"
            ]
i����N(t
AnsibleModule(t
get_configtload_configtrun_commands(tnxos_argument_spect
check_args(tget_interface_type(tstring_typestt	interfacesip pim bfd-instancetbfdsip pim sparse-modetsparsesip pim dr-priority {0}tdr_priosip pim hello-interval {0}thello_intervals&ip pim hello-authentication ah-md5 {0}thello_auth_keys
ip pim bordertborders$ip pim jp-policy prefix-list {0} outt
jp_policy_outs#ip pim jp-policy prefix-list {0} intjp_policy_int
jp_type_intjp_type_outs&ip pim neighbor-policy prefix-list {0}tneighbor_policyt
neighbor_typetdefaultt1t30000sno ip pim bfd-instancesip pim bfd-instance disabletdisabletenablecCsD|r i|d6dd6g}ni|d6dd6g}t||�S(Ntcommandttexttoutputtjson(R(R tmoduleR!tcmds((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytexecute_show_command�s
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_pim_interface.pytflatten_list�s
cCsit}t}|r\|jd�}|jd�}|r\|r\|jd�|jd�q\n|||fS(Ntjp_bidirtisauth(tFalsetgettpop(t	gexistingR.R/((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytlocal_existing�s
cCs�d}dj|�}t||�}y|ddd}Wntttfk
rW|SX|dkr�t|jdd	��}|dkr�d}q�|d
kr�d	}q�n|dkr�d	}n|S(Ntunknownsshow interface {0}itTABLE_interfacet
ROW_interfacetethernettportchannelteth_modetlayer3taccessttrunktlayer2troutedtloopbacktsvi(R8R9(saccessR=(R@RA(tformatR&tKeyErrortAttributeErrort
IndexErrortstrR1(Rt	intf_typeR$tmodeR tbodytinterface_table((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytget_interface_mode�s 		c
Cs�i}t|ddj|�g�}d|d<d|d<d|d<d|d<d|d<d|d	<d|d
<t|d<t|d<|r�|j�}x|D]�}d
|krFtjd|�jd�}d|kr�d}nd}d|kr||d<||d
<q�d|kr%||d<||d	<q�||d<||d<t|d<q�d|kr�tjd|�jd�|d<d|kr�d|d<q�d|d<q�d|kr�t|d<q�d|kr�t|d<q�d|krd}tjd|�}	|	r�|	jd�rdnd|d<q�q�d|kr1t|d<q�d|kr_tjd |�jd�|d!<q�d"|kr�tjd#|�jd�|d$<q�q�Wn|S(%Ntflagss
interface {0}RRRRRRRRR.R/s	jp-policys0ip pim jp-policy(?: prefix-list)? (\S+)(?: \S+)?isprefix-listtprefixtroutemaptouttinsneighbor-policys-ip pim neighbor-policy(?: prefix-list)? (\S+)sah-md5ssparse-modeRsbfd-instances)ip pim bfd-instance(?P<disable> disable)?RRRshello-intervalsip pim hello-interval (\d+)Rsdr-prioritysip pim dr-priority (\d+)R(	RRBtNoneR0t
splitlinestretsearchtgrouptTrue(
R$Rt
pim_interfaceRIt	all_linesteachtpolicy_nametptypetvaluetm((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytget_pim_interface�sb









	










%
")cCsmxft|�D]X}|dkr
|j|�tj|�kre|j|�dkre|j|�qeq
q
W|S(NRRRR(sdr_prioshello_intervalssparsesborder(R(R1tPARAM_TO_DEFAULT_KEYMAPRQR2(tdeltatexistingtkey((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pyt	fix_delta5s
3c		CsBd}g}t||�}|r�|jd�s?|jd�r�|jd�dkrodj|jd��}ndj|jd��}|r�|j|�q�q�nxo|j�D]a\}}|dkrU|dkr�t|}n[|rtj|�j|�}n:|d
kr |r<d
}q<ndtj|�j|�}|r|j|�qn�|dkr|dkr<|jd�p�|jd�}|jd�dkr�tj|�j|�}q�|jd�dkr�dj|�}q�|jd�dkrtj|�j|�}q�|jd�dkr�dj|�}q�n�|dkr|jd�pc|jd�}|jd�dkr�tj|�j|�}q�|jd�dkr�dj|�}q�|jd�dkr�tj|�j|�}q�|jd�dkr�dj|�}q�n�|dkr�|jd�p>|jd�}|jd�dkrqtj|�j|�}q�|jd�dkr�dj|�}q�|jd�dkr�tj|�j|�}q�|jd�dkr�dj|�}q�n|r|j|�qnd}q�Wd|kr>|jd�|jd�n|S(NRRRRMs#no ip pim jp-policy prefix-list {0}sno ip pim jp-policy {0}RRRRRRs%no ip pim hello-authentication ah-md5sno RRRNsip pim neighbor-policy {0}sip pim jp-policy {0} inRsip pim jp-policy {0} outsno ip pim sparse-mode(sbfdsdr_prioshello_intervalshello_auth_keysborderssparse(sneighbor_policysjp_policy_ins
jp_policy_outs
neighbor_type(sneighbor_policys
neighbor_type(sjp_policy_ins
jp_type_in(s
jp_policy_outsjp_type_out(	RQRcR1RBR*titemst
BFD_KEYMAPtPARAM_TO_COMMAND_KEYMAPtremove(	R`RaR.R/R tcommandstktvttemp((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytconfig_pim_interface=s�	
				

cCs�tdtjd�dtjd�dtjd�dtjd�dtjd�dtjd��}td�|j�D��}|S(NRRRRRRcss-|]#\}}|dk	r||fVqdS(N(RQ(t.0tparamR\((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pys	<genexpr>�s	(tdictR_R1Rd(targsR((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytget_pim_interface_defaults�scCs�g}|rv|jd�s*|jd�r]|jd�dkr]dj|jd��}q]n|r�|j|�q�n|s�d}x�|D]�}|dkr�|jd�ra|jd�dkr�dj|jd��}q�dj|jd��}qani|dkra|jd�ra|jd�dkrCd	j|jd��}q^d
j|jd��}qan|rw|j|�nd}q�Wn|jd�r�d}|j|�n|S(
NRRRRMs#no ip pim jp-policy prefix-list {0}s&no ip pim jp-policy prefix-list {0} insno ip pim jp-policy {0} inRs'no ip pim jp-policy prefix-list {0} outsno ip pim jp-policy {0} outRsno ip pim neighbor-policy(R1RBR*RQ(RaR.RhR Ri((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytdefault_pim_interface_policies�s>

cCs�g}t�}tt|j��j|j���}|rTt||||�}nt||�}|r�x|D]}|j|�qpWn|S(N(RqRotsetRdt
differenceRlRrR*(RaR.R/R tdefaultsR`tcommRY((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytconfig_pim_interface_defaults�s		
cCsZ|j�}d|kr/|dj�|d<nd|krVt|dd�|d<ndS(NRRi�(tkeystlowerRF(tproposedRx((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytnormalize_proposed_values�s
c%sFtdtdddt�dtdddt�dtdd�d	tddd
t�dtdd�d
tdd�dtdd�dtdddddg�dtdddddg�dtddddddg�dtdddt�dtdd�dtdddddg�dtddddddddg��}|jt�td|dt�}t�}t||�itd6gd 6|d!6}|jd}|jd}|jd}|jd}|jd}|jd
}	|jd}
|jd}|jd}t	|�}
t
||
|�d"kr:|jd#d$�n|r\|s\|jd#d%�q\n|	r~|s~|jd#d&�q~n|
r�|s�|jd#d'�q�nt||�}t
|�\}}}tj��t�fd(�|jj�D��}t|�tt|j��j|j���}g}|dkro|r�t||||�}|rl|j|�qlq�nC|dks�|dkr�t|||�}|r�|j|�q�n|r�|jd)d*j|�g�nt|�}|r+t|d<|jst||�nd+|kr+|jd)�q+n||d <|j|�dS(,NRttypeRFtrequiredRtboolRRRtno_logRtintRRRtchoicesRMRNRRRRRRRtstatetpresenttabsentt
argument_spectsupports_check_modetchangedRhtwarningsR>tmsgs-this module only works on Layer 3 interfaces.s,jp_type_in required when using jp_policy_in.s.jp_type_out required when using jp_policy_out.s2neighbor_type required when using neighbor_policy.c3s9|]/\}}|dk	r|�kr||fVqdS(N(RQ(RmRiRj(Rp(sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pys	<genexpr>s	is
interface {0}t	configure(RoRVR0tupdateR	RR(R
tparamsRRKt	fail_jsonR^R4RfRxRdR{RsRtRlR*RwtinsertRBR-t
check_modeRR2t	exit_json(R�R$R�tresultsR�RRRRRRRRRGtget_existingRaR.R/RzR`RhR RuR%((RpsS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pytmain�s�'
	









%
'
	
t__main__("tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRStansible.module_utils.basicRt&ansible.module_utils.network.nxos.nxosRRRR	R
Rtansible.module_utils.sixRRfR0R_RQReR&R-R4RKR^RcRlRqRrRwR{R�t__name__(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_pim_interface.pyt<module>sf


]


	
	
		?		L		,				V

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