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

�
�Udac@sidd6dgd6dd6ZdZdZdZd	d
lZd	d
lZd	d
lZd	dlmZm	Z	d	dlm
Z
mZd	d
lm
Z
d	dlmZddgZidd6dd6dd6dd6dd6dd6dd6dd6dd6d d!6d d"6d d#6d d$6d%d6Zd&�Zd'�Zd(�Zd)�Zd*�Zd+�Zd,�Zd-�Zd.�Zed/kr{e�nd
S(0s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys
---
module: nxos_interface_ospf
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages configuration of an OSPF interface instance.
description:
  - Manages configuration of an OSPF interface instance.
author: Gabriele Gerbino (@GGabriele)
notes:
  - Tested against NXOSv 7.3.(0)D1(1) on VIRL
  - Default, where supported, restores params default value.
  - To remove an existing authentication configuration you should use
    C(message_digest_key_id=default) plus all other options matching their
    existing values.
  - Loopback interfaces only support ospf network type 'point-to-point'.
  - C(state=absent) removes the whole OSPF interface configuration.
options:
  interface:
    description:
        - Name of this cisco_interface resource. Valid value is a string.
    required: true
  ospf:
    description:
      - Name of the ospf instance.
    required: true
  area:
    description:
      - Ospf area associated with this cisco_interface_ospf instance.
        Valid values are a string, formatted as an IP address
        (i.e. "0.0.0.0") or as an integer.
    required: true
  bfd:
    description:
      - Enables bfd at interface level. This overrides the bfd variable set at the ospf router level.
      - Valid values are 'enable', 'disable' or 'default'.
      - "Dependency: 'feature bfd'"
    version_added: "2.9"
    type: str
    choices: ['enable', 'disable', 'default']
  cost:
    description:
      - The cost associated with this cisco_interface_ospf instance.
  hello_interval:
    description:
      - Time between sending successive hello packets.
        Valid values are an integer or the keyword 'default'.
  dead_interval:
    description:
      - Time interval an ospf neighbor waits for a hello
        packet before tearing down adjacencies. Valid values are an
        integer or the keyword 'default'.
  passive_interface:
    description:
      - Enable or disable passive-interface state on this interface.
        true - (enable) Prevent OSPF from establishing an adjacency or
                       sending routing updates on this interface.
        false - (disable) Override global 'passive-interface default' for this interface.
    type: bool
  network:
    description:
      - Specifies interface ospf network type. Valid values are 'point-to-point' or 'broadcast'.
    choices: ['point-to-point', 'broadcast']
    version_added: "2.8"
  message_digest:
    description:
      - Enables or disables the usage of message digest authentication.
    type: bool
  message_digest_key_id:
    description:
      - Md5 authentication key-id associated with the ospf instance.
        If this is present, message_digest_encryption_type,
        message_digest_algorithm_type and message_digest_password are
        mandatory. Valid value is an integer and 'default'.
  message_digest_algorithm_type:
    description:
      - Algorithm used for authentication among neighboring routers
        within an area. Valid values are 'md5' and 'default'.
    choices: ['md5', 'default']
  message_digest_encryption_type:
    description:
      - Specifies the scheme used for encrypting message_digest_password.
        Valid values are '3des' or 'cisco_type_7' encryption or 'default'.
    choices: ['cisco_type_7','3des', 'default']
  message_digest_password:
    description:
      - Specifies the message_digest password. Valid value is a string.
  state:
    description:
      - Determines whether the config should be present or not
        on the device.
    default: present
    choices: ['present','absent']
s
- nxos_interface_ospf:
    interface: ethernet1/32
    ospf: 1
    area: 1
    bfd: disable
    cost: default

- nxos_interface_ospf:
    interface: loopback0
    ospf: prod
    area: 0.0.0.0
    bfd: enable
    network: point-to-point
    state: present
s�
commands:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["interface Ethernet1/32", "ip router ospf 1 area 0.0.0.1", "ip ospf bfd disable"]
i����N(t
get_configtload_config(tnxos_argument_spect
check_args(t
AnsibleModule(tCustomNetworkConfigtpassive_interfacetmessage_digesttt	interfacesip ospf costtcostsip router ospftospftareasip ospf bfdtbfdsip ospf hello-intervalthello_intervalsip ospf dead-intervalt
dead_intervalsip ospf passive-interfaces%ip ospf authentication message-digestsip ospf message-digest-keytmessage_digest_key_idtmessage_digest_algorithm_typetmessage_digest_encryption_typetmessage_digest_passwordsip ospf networkc
Cs]t|}tjdj|�|tj�}tjdj|�|tj�}|dkr�d}|rY|jd�j�}|dkr�|d}q�|dkr�|d	}t||�}q�qYn�|d
kr�d}|rY|jd�j�}|dkr|d}q~|dkr|d
}q~|dkrb|d	}|dkrJd}q{|dkr{d}q{q~|dkr~|d}q~qYn�|dkr�tjdj|�|tj�}|r�t}qY|r�t	}qYd}n�|dkr tjd|�}	|	r|	jd�rdnd}qYd}n9|tkr;t|�}nd}|rY|jd�}n|S(Ns
\s+{0}\s*$s(?:{0}\s)(?P<value>.*)$sip router ospfR
tvalueRiRisip ospf message-digest-keyRRiRt3t3dest7tcisco_type_7RiRs\s+no\s+{0}\s*$Rs$\s*ip ospf bfd(?P<disable> disable)?tdisabletenabletdefault(
tPARAM_TO_COMMAND_KEYMAPtretsearchtformattMtgrouptsplittnormalize_areatFalsetTruetNonetBOOL_PARAMStbool(
targtconfigtmoduletcommandthas_commandthas_command_valRt
value_listthas_no_commandtm((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pyt	get_value�s\
!!




	!				cCs�i}tdddt|��}|jdjd�sM|jdjd�ridj|jd�g}ndj|jdj��g}|j|�}d|kr�x3|D]+}|d	kr�t|||�||<q�q�W|jd|d<n|S(
NtindentitcontentsRtloopbacksport-channels
interface {0}R(s	interface(R
Rtparamst
startswithR$t
capitalizetget_sectionR7(R0targstexistingtnetcfgtparentsR/R.((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pytget_existing�s,
cCsIi}x<|j�D].\}}|j|�}|r|||<qqW|S(N(titemstget(tkey_mapttabletnew_dicttkeyRtnew_key((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pyt
apply_key_map�scCs4t�}|j|�}|jd�r�t}x4dddgD]#}||||kr=t}q=q=W|r0|ddkr�d}	n|ddkr�d}	nd	j||d
|d|	|d�}
|j|
�q0nZd|kr�|jdj|��n5d
|kr|jd�n|jdj||��|S(Nsip ospf message-digest-keyRRRRRRRsno {0} {1} {2} {3} {4}Rsip ospf bfdsno {0}spassive-interfaces!default ip ospf passive-interfaces
no {0} {1}(tlistRER<R)R*R$tappend(R@tproposedtexisting_commandsRIR0tcommandstexisting_valuetchecktparamtencryption_typeR1((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pytget_default_commands�s6	

		
cCs-t�}|dkrQdj||d|d�}||krQ|j|�qQn|dkr�dj||d�}||kr)|j|�q)n�|jd�r)|d	d
kr)d|kr)|dd
kr�d}n|ddkr�d}ndj||d	|d||d�}|j|�q)n|S(Nsip router ospfs{0} {1} area {2}RRsip ospf networks{0} {1}Rsip ospf message-digest-keyRR toptionsRRRRRs{0} {1} {2} {3} {4}RR(RLR$RMR<(texisting_cmdRNRIR0RPR1RT((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pytget_custom_commands2	
		
cCs�t�}tt|�}tt|�}xG|j�D]9\}}|j|�r�|dkrx|d|dkrxq4qxn||||kr�q4q�n|dkr�|jjd�j�jd�r�|jdd�n|dkr!|d	kr!|jjd�j�jd�r!|jdd
�n|dkr�|}	d|krL|	d
7}	n.d|krz|jd�dk	rzd|	}	n|j
|	�q4n|tkr�|j
|�q4|tkr�|j
dj
|��q4|dkr|j|�rm|jt|||||��qmq4|dks)|jd�rH|jt||||��q4dj
||j��}
|j
|
�q4W|r�dj
|jdj��g}|j|d|�ndS(Nsip router ospfRsip ospf passive-interfaceRtLOtmsgs5loopback interface does not support passive_interfacesip ospf networkt	broadcasts?loopback interface does not support ospf network type broadcastsip ospf bfdRs disableR Rsno sno {0}sip ospf message-digest-keys{0} {1}s
interface {0}RB(RLRKR!RDRER;tupperR<t	fail_jsonR+RMR*R)R$textendRURXtlowerR=tadd(R0R@RNt	candidateRPtproposed_commandsRORIRtcmdR1RB((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pyt
state_present;sP			-9
!

c	Cs�g}dj|jdj��g}tt|�}x�|j�D]�\}}d|kr{d|krA|jd�qAqAnd|kr�|dk	r�|jd�qAn|rA|jd�r3d	|kr�|d
dkr�d}	n|d
d
kr�d}	ndj||d|d|	|d�}
|j|
�q�q�|dkra|r�|jdj|��q�q�|dkr�dj||d|d�}
|
|kr�|j|
�q�q�|j	|�}|jdj||��qAqAW|j
|d|�dS(Ns
interface {0}Rsip ospf bfdR sno ip ospf bfdsip ospf passive-interfaces!default ip ospf passive-interfacesip ospf message-digest-keyRVRRRRRsno {0} {1} {2} {3} {4}RRRs%ip ospf authentication message-digestsip ospf networksno {0}sip router ospfsno {0} {1} area {2}RRs
no {0} {1}RB(s%ip ospf authentication message-digestsip ospf network(R$R;R=RKR!RDRMR+R<RER`(R0R@RNRaRPRBRORIRRTR1RQ((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pytstate_absentmsF
		
 cCs}y+t|�}tjtjd|��}WnKtk
rx|jd�}t|�dkry|jddd|�qynX|S(Ns!Lt.iRZsIncorrect Area ID formatR(	tinttsockett	inet_ntoatstructtpackt
ValueErrorR'tlenR](RR0t
splitted_area((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pyR(�s
c%s$tdtdtdd�dtdtdd�dtdtdd�dtdd	d
dgdtdd�dtdtdd�d
tdtdd�dtdtdd�dtdtdd�dtdtdddddg�dtdtdd�dtdtdd�dtdtdddddg�dtdtddddddg�dtdtdddt�dtdddgdddt��}|jt�td |d!ddddggd"t�}tjd#|jdtj	�r�|jdj
�|jd<n|jdj�|jd<t�}t
||�itd$6gd%6|d&6}xPdddgD]?}|j|dkrZ|jddkrZ|jd'd(�qZqZW|jd}tj��t|��}t�fd)�|jj�D��}i}x|j�D]\}	}
|	dkr�t|
�j
�d*kr6t}
nct|
�j
�d+krWt}
nBt|
�j
�dkrxd}
n!|	dkr�t|
�j
�}
n|j|	�s�|j|	�r�|
r�|
||	<qd|	kr|j|	�dkr|
tkr|
||	<qq�q�Wt|d|�|d<d
|krL|d
d,krLd|d
<ntd-d.�}|dkr}t||||�nT|dkr�|jd�|dkr�|jd�|dkr�t||||�n|r|j�}|js�t||�nt|d$<||d%<n|j|�dS(/NRtrequiredttypetstrRRRtchoicesRRR RRRRR-RR[spoint-to-pointRRRtmd5RRRRtno_logtstatetpresenttabsentt
argument_spectrequired_togethertsupports_check_modes(port-channel|loopback)tchangedRPtwarningsRZsTUse message_digest_key_id=default to remove an existing authentication configurationc3s9|]/\}}|dk	r|�kr||fVqdS(N(R+(t.0tktv(R?(sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pys	<genexpr>�s	ttruetfalset10R8i(tdictR*R)tupdateRR	R"tmatchR;tIR_R=RLRt	exit_jsonR!tkeysRCRDRqRER+R(R
RdRet
items_textt
check_modeR(RxR0R|tresultRSRuR@t
proposed_argsRNRIRRa((R?sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pytmain�s�$!!$$
		

&
%			%
-
>	

t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR"RjRht&ansible.module_utils.network.nxos.nxosRRRRtansible.module_utils.basicR	t*ansible.module_utils.network.common.configR
R,R!R7RCRKRURXRdReR(R�t__name__(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_interface_ospf.pyt<module>sP


`	
	5					 	2	,		\

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