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

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZd	dlmZm	Z	d	d
l
mZd	dlm
Z
dddddddgZidd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d6d$d%6d&d&6d'd(6d'd)6d*d+6d,d-6dd6d.d6d/d06d/d16d2d6d3d46d5d56Zid6d6ed6ed6d7d06d8d16Zd9�Zd:�Zd;�Zd<�Zd=�Zd>�Zed?kr�e�nd
S(@s1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys
---
module: nxos_bgp_neighbor
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages BGP neighbors configurations.
description:
  - Manages BGP neighbors configurations on NX-OS switches.
author: Gabriele Gerbino (@GGabriele)
notes:
  - Tested against NXOSv 7.3.(0)D1(1) on VIRL
  - C(state=absent) removes the whole BGP neighbor configuration.
  - Default, where supported, restores params default value.
options:
  asn:
    description:
      - BGP autonomous system number. Valid values are string,
        Integer in ASPLAIN or ASDOT notation.
    required: true
  vrf:
    description:
      - Name of the VRF. The name 'default' is a valid VRF representing
        the global bgp.
    default: default
  neighbor:
    description:
      - Neighbor Identifier. Valid values are string. Neighbors may use
        IPv4 or IPv6 notation, with or without prefix length.
    required: true
  description:
    description:
      - Description of the neighbor.
  bfd:
    description:
      - Enables/Disables BFD for a given neighbor.
      - "Dependency: 'feature bfd'"
    version_added: "2.9"
    type: str
    choices: ['enable', 'disable']
  connected_check:
    description:
      - Configure whether or not to check for directly connected peer.
    type: bool
  capability_negotiation:
    description:
      - Configure whether or not to negotiate capability with
        this neighbor.
    type: bool
  dynamic_capability:
    description:
      - Configure whether or not to enable dynamic capability.
    type: bool
  ebgp_multihop:
    description:
      - Specify multihop TTL for a remote peer. Valid values are
        integers between 2 and 255, or keyword 'default' to disable
        this property.
  local_as:
    description:
      - Specify the local-as number for the eBGP neighbor.
        Valid values are String or Integer in ASPLAIN or ASDOT notation,
        or 'default', which means not to configure it.
  log_neighbor_changes:
    description:
      - Specify whether or not to enable log messages for neighbor
        up/down event.
    choices: ['enable', 'disable', 'inherit']
  low_memory_exempt:
    description:
      - Specify whether or not to shut down this neighbor under
        memory pressure.
    type: bool
  maximum_peers:
    description:
      - Specify Maximum number of peers for this neighbor prefix
        Valid values are between 1 and 1000, or 'default', which does
        not impose the limit. Note that this parameter is accepted
        only on neighbors with address/prefix.
  pwd:
    description:
      - Specify the password for neighbor. Valid value is string.
  pwd_type:
    description:
      - Specify the encryption type the password will use. Valid values
        are '3des' or 'cisco_type_7' encryption or keyword 'default'.
    choices: ['3des', 'cisco_type_7', 'default']
  remote_as:
    description:
      - Specify Autonomous System Number of the neighbor.
        Valid values are String or Integer in ASPLAIN or ASDOT notation,
        or 'default', which means not to configure it.
  remove_private_as:
    description:
      - Specify the config to remove private AS number from outbound
        updates. Valid values are 'enable' to enable this config,
        'disable' to disable this config, 'all' to remove all
        private AS number, or 'replace-as', to replace the private
        AS number.
    choices: ['enable', 'disable', 'all', 'replace-as']
  shutdown:
    description:
      - Configure to administratively shutdown this neighbor.
    type: bool
  suppress_4_byte_as:
    description:
      - Configure to suppress 4-byte AS Capability.
    type: bool
  timers_keepalive:
    description:
      - Specify keepalive timer value. Valid values are integers
        between 0 and 3600 in terms of seconds, or 'default',
        which is 60.
  timers_holdtime:
    description:
      - Specify holdtime timer value. Valid values are integers between
        0 and 3600 in terms of seconds, or 'default', which is 180.
  transport_passive_only:
    description:
      - Specify whether or not to only allow passive connection setup.
        Valid values are 'true', 'false', and 'default', which defaults
        to 'false'. This property can only be configured when the
        neighbor is in 'ip' address format without prefix length.
    type: bool
  update_source:
    description:
      - Specify source interface of BGP session and updates.
  state:
    description:
      - Determines whether the config should be present or not
        on the device.
    default: present
    choices: ['present','absent']
s�
# create a new neighbor
- nxos_bgp_neighbor:
    asn: 65535
    neighbor: 192.0.2.3
    local_as: 20
    remote_as: 30
    bfd: enable
    description: "just a description"
    update_source: Ethernet1/3
    state: present
s�
commands:
  description: commands sent to the device
  returned: always
  type: list
  sample: ["router bgp 65535", "neighbor 192.0.2.3",
           "remote-as 30", "update-source Ethernet1/3",
           "description just a description", "local-as 20"]
i����N(t
get_configtload_config(tnxos_argument_spect
check_args(t
AnsibleModule(tCustomNetworkConfigtcapability_negotiationtshutdowntconnected_checktdynamic_capabilitytlow_memory_exempttsuppress_4_byte_asttransport_passive_onlys
router bgptasntbfdsdont-capability-negotiatesdisable-connected-checktdescriptionsdynamic-capabilitys
ebgp-multihopt
ebgp_multihopslocal-astlocal_asslog-neighbor-changestlog_neighbor_changesslow-memory exempts
maximum-peerst
maximum_peerstneighbortpasswordtpwdtpwd_types	remote-ast	remote_assremove-private-astremove_private_asscapability suppress 4-byte-asttimersttimers_keepalivettimers_holdtimes!transport connection-mode passives
update-sourcet
update_sourcetvrftdisablei<i�cCs�t|}tjdj|�|tj�}tjdj|�|tj�}|dkr�tjdj|�|tj�}t}|r�t}q�n7|tkr�t}|r�t}q�n|dkr�d}|r�d}q�|r�d}q�n�|d	kr$d}|r	d}q�|r�|jd
�}q�n�|dkrE|r<dnd}n�d}|r�|jd
�}|dkr�|j	�}d}|dkr�|d}q�|dkr�t
|�dkr�|d}q�q�n|S(Ns^\s+{0}$s(?:\s+{0}\s*)(?P<value>.*)$Rs\s+no\s{0}\s*$RttenableR$RtvalueRRRR RiR!Rii(RR(stimers_keepalivespwd_type(stimers_holdtimespwd(tPARAM_TO_COMMAND_KEYMAPtretsearchtformattMtTruetFalsetBOOL_PARAMStgrouptsplittlen(targtconfigtcommandthas_commandthas_command_valthas_no_commandR'tsplit_value((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pyt	get_value�sJ
!!!		
cCsMi}tdddt|��}tjdtj�}|jt|��}|r<|jd�}dj|�g}|j	ddkr�|j
d	j|j	d��n|j
d
j|j	d��|j|�}	|	rIx0|D](}
|
dkr�t|
|	�||
<q�q�W||d<|j	d|d<|j	d|d<qIn
|j
d
�|S(Ntindentitcontentss..*router\sbgp\s(?P<existing_asn>\d+(\.\d+)?).*texisting_asnsrouter bgp {0}R#tdefaultsvrf {0}sneighbor {0}RRs:The BGP process didn't exist but the task just created it.(sasnsvrfsneighbor(
R
RR)tcompiletStmatchtstrR0R+tparamstappendtget_sectionR:(tmoduletargstwarningstexistingtnetcfgt	asn_regext	match_asnR=tparentsR4R3((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pytget_existings( 


cCsFi}x9|D]1}|j|�}|r
|j|�||<q
q
W|S(N(tget(tkey_mapttabletnew_dicttkeytnew_key((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pyt
apply_key_map4s
cCst�}tt|�}tt|�}x(|j�D]\}}|tkr\|j|�q4|tkr�|jdj|��q4|dkr�|j|�rN|dkr�|jd�q�|j|�}	|jdj||	��qNq4|dkry|dkr|jdj|��qN|d	kr?|jd
j||��qN|dkrN|j|�rv|jdj|��qvqNq4|dkr�|j	d}
|
d
kr�d}
nd}
dj||
|�}||krN|j|�qNq4|dkr}|dkrdj|�}|j|�qN|d	kr[|j|�d	krzdj|�}|j|�qzqNd
j||�}|j|�q4|dkr�|dt
jd�ks�|dt
jd�krNdj|d|d�}||kr�|j|�q�qNq4|dkr/|d	krdnd}|j||�q4d
j||�}|j|�q4W|rdj|j	d�g}
|j	ddkr�|
jdj|j	d��n|
jdj|j	d��dj|j	d �}||kr|j|�|j|�n|j|d!|
�ndS("Nsno {0}R>Rsno passwords
no {0} {1}slog-neighbor-changesR&s{0}R$s{0} {1}tinheritRt3desiis{0} {1} {2}sremove-private-asRR R!stimers {0} {1}Rsno R%srouter bgp {0}RR#svrf {0}sneighbor {0}Rslocal-as {0}RRM(
tlistRUR(titemsR-RDR.R+RORCtPARAM_TO_DEFAULT_KEYMAPtremovetadd(RFRItproposedt	candidatetcommandstproposed_commandstexisting_commandsRSR'texisting_valueRR5tno_cmdRMtlocal_as_command((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pyt
state_present>s~	
	
 
cCs�g}dj|jd�g}|jddkrR|jdj|jd��n|jdj|jd��|j|d|�dS(	Nsrouter bgp {0}RR#R>svrf {0}sno neighbor {0}RRM(R+RCRDR\(RFRIR]R^R_RM((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pytstate_absent�s c7s�tdtdtdd�dtdtdddd�dtdtdd�dtdtdd�d	tdtddd
ddg�d
tdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtddd
dddg�dtdtdd�dtdtdd�dtdtdd�dtdtddd
dddg�dtdtdd�dtdtddd
ddddg�dtdtdd�d tdtdd�d!tdtdd�d"tdtdd�d#tdtdd�d$tdtdd�d%td
d&d'gdd&dt��}|jt�td(|d)d"d!gddggd*t�}t�}t||�td+td,|�}|jd%}|jddkr�d-|jd<nt	j
��t|�|�}|jd�rf|d&krf|d|jdkrf|j
d.d/d0|jdd1|jd��qfnt�fd2�|jj�D��}i}x�|j�D]�\}}	|d6kr�t|	�j�dkr�tj|d�}	n|d	kr|jd	d�|	kr9|	||<q9q<|j|�|	kr<|	||<q<q�q�Wtd3d4�}
|d&krqt||||
�n(|d'kr�|r�t||||
�n|
r�|
j�}
|js�t||
�nt|d+<|
|d5<n
g|d5<|j|�dS(7NRtrequiredttypeRBR#R>RRRtchoicesR&R$RtboolR
RRRRRVRRRRRWtcisco_type_7RRtalls
replace-asRRR R!RR"tstatetpresenttabsentt
argument_spectrequired_togethertsupports_check_modetchangedRHt0tmsgsAnother BGP ASN already exists.tproposed_asnR=c3s9|]/\}}|dk	r|�kr||fVqdS(N(tNone(t.0tktv(RG(sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pys	<genexpr>�s	R;iR_(RR#RR(tdictR-R.tupdateRR	RXRRCR(tkeysRNROt	fail_jsonRYRBtlowerRZR
ReRft
items_textt
check_modeRt	exit_json(RpRFRHtresultRmRIt
proposed_argsR]RSR'R^((RGsR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pytmain�s�!$$'$
		


%	


t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR)t&ansible.module_utils.network.nxos.nxosRRRRtansible.module_utils.basicR	t*ansible.module_utils.network.common.configR
R/R(R.R-RZR:RNRUReRfR�t__name__(((sR/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor.pyt<module>sn


�
	

	/		
	L	
	T

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