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

�
�Udac@sZidd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZd	dlmZm	Z	d	d
l
mZd	dlm
Z
dddddddgZidd6dd6ed6dd6dd6dd6d d!6Zid"d#6d$d%6d$d&6d'd6d(d6d)d*6d+d6d,d6d-d6d.d!6d/d6d/d06d/d16d/d26d3d46d/d56d6d6d7d86d9d6d9d6d9d6d:d;6d<d6d=d6dd>6d?d?6d@dA6dBd6dCdD6dEdF6dGdG6Zd0d5d2d1gZdH�ZdI�ZdJ�ZdK�ZdL�ZdM�ZdN�ZdO�ZdP�ZdQ�ZdR�ZdS�ZdT�Ze dUkrVe�nd
S(Vs1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: nxos_bgp_af
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages BGP Address-family configuration.
description:
  - Manages BGP Address-family 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 ASN 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.
    required: true
  afi:
    description:
      - Address Family Identifier.
    required: true
    choices: ['ipv4','ipv6', 'vpnv4', 'vpnv6', 'l2vpn']
  safi:
    description:
      - Sub Address Family Identifier.
    required: true
    choices: ['unicast','multicast', 'evpn']
  additional_paths_install:
    description:
      - Install a backup path into the forwarding table and provide
        prefix independent convergence (PIC) in case of a PE-CE link
        failure.
    type: bool
  additional_paths_receive:
    description:
      - Enables the receive capability of additional paths for all of
        the neighbors under this address family for which the capability
        has not been disabled.
    type: bool
  additional_paths_selection:
    description:
      - Configures the capability of selecting additional paths for
        a prefix. Valid values are a string defining the name of
        the route-map.
  additional_paths_send:
    description:
      - Enables the send capability of additional paths for all of
        the neighbors under this address family for which the capability
        has not been disabled.
    type: bool
  advertise_l2vpn_evpn:
    description:
      - Advertise evpn routes.
    type: bool
  client_to_client:
    description:
      - Configure client-to-client route reflection.
    type: bool
  dampen_igp_metric:
    description:
      - Specify dampen value for IGP metric-related changes, in seconds.
        Valid values are integer and keyword 'default'.
  dampening_state:
    description:
      - Enable/disable route-flap dampening.
    type: bool
  dampening_half_time:
    description:
      - Specify decay half-life in minutes for route-flap dampening.
        Valid values are integer and keyword 'default'.
  dampening_max_suppress_time:
    description:
      - Specify max suppress time for route-flap dampening stable route.
        Valid values are integer and keyword 'default'.
  dampening_reuse_time:
    description:
      - Specify route reuse time for route-flap dampening.
        Valid values are integer and keyword 'default'.
  dampening_routemap:
    description:
      - Specify route-map for route-flap dampening. Valid values are a
        string defining the name of the route-map.
  dampening_suppress_time:
    description:
      - Specify route suppress time for route-flap dampening.
        Valid values are integer and keyword 'default'.
  default_information_originate:
    description:
      - Default information originate.
    type: bool
  default_metric:
    description:
      - Sets default metrics for routes redistributed into BGP.
        Valid values are Integer or keyword 'default'
  distance_ebgp:
    description:
      - Sets the administrative distance for eBGP routes.
        Valid values are Integer or keyword 'default'.
  distance_ibgp:
    description:
      - Sets the administrative distance for iBGP routes.
        Valid values are Integer or keyword 'default'.
  distance_local:
    description:
      - Sets the administrative distance for local BGP routes.
        Valid values are Integer or keyword 'default'.
  inject_map:
    description:
      - An array of route-map names which will specify prefixes to
        inject. Each array entry must first specify the inject-map name,
        secondly an exist-map name, and optionally the copy-attributes
        keyword which indicates that attributes should be copied from
        the aggregate. For example [['lax_inject_map', 'lax_exist_map'],
        ['nyc_inject_map', 'nyc_exist_map', 'copy-attributes'],
        ['fsd_inject_map', 'fsd_exist_map']].
  maximum_paths:
    description:
      - Configures the maximum number of equal-cost paths for
        load sharing. Valid value is an integer in the range 1-64.
  maximum_paths_ibgp:
    description:
      - Configures the maximum number of ibgp equal-cost paths for
        load sharing. Valid value is an integer in the range 1-64.
  networks:
    description:
      - Networks to configure. Valid value is a list of network
        prefixes to advertise. The list must be in the form of an array.
        Each entry in the array must include a prefix address and an
        optional route-map. For example [['10.0.0.0/16', 'routemap_LA'],
        ['192.168.1.1', 'Chicago'], ['192.168.2.0/24'],
        ['192.168.3.0/24', 'routemap_NYC']].
  next_hop_route_map:
    description:
      - Configure a route-map for valid nexthops. Valid values are a
        string defining the name of the route-map.
  redistribute:
    description:
      - A list of redistribute directives. Multiple redistribute entries
        are allowed. The list must be in the form of a nested array.
        the first entry of each array defines the source-protocol to
        redistribute from; the second entry defines a route-map name.
        A route-map is highly advised but may be optional on some
        platforms, in which case it may be omitted from the array list.
        For example [['direct', 'rm_direct'], ['lisp', 'rm_lisp']].
  suppress_inactive:
    description:
      - Advertises only active routes to peers.
    type: bool
  table_map:
    description:
      - Apply table-map to filter routes downloaded into URIB.
        Valid values are a string.
  table_map_filter:
    description:
      - Filters routes rejected by the route-map and does not download
        them to the RIB.
    type: bool
  state:
    description:
      - Determines whether the config should be present or not
        on the device.
    default: present
    choices: ['present','absent']
s�
# configure a simple address-family
- nxos_bgp_af:
    asn: 65535
    vrf: TESTING
    afi: ipv4
    safi: unicast
    advertise_l2vpn_evpn: true
    state: present
s�
commands:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["router bgp 65535", "vrf TESTING",
            "address-family ipv4 unicast", "advertise l2vpn evpn"]
i����N(t
get_configtload_config(tnxos_argument_spect
check_args(t
AnsibleModule(tCustomNetworkConfigtadditional_paths_installtadditional_paths_receivetadditional_paths_sendtadvertise_l2vpn_evpntdampening_statetdefault_information_originatetsuppress_inactivet1t
maximum_pathstmaximum_paths_ibgptclient_to_clientt20t
distance_ebgpt200t
distance_ibgpt220tdistance_localt600tdampen_igp_metrics
router bgptasnsaddress-familytafitsafisadditional-paths install backupsadditional-paths receives$additional-paths selection route-maptadditional_paths_selectionsadditional-paths sendsadvertise l2vpn evpnsclient-to-client reflectionsdampen-igp-metrict	dampeningtdampening_half_timetdampening_max_suppress_timetdampening_reuse_timesdampening route-maptdampening_routemaptdampening_suppress_timesdefault-information originatesdefault-metrictdefault_metrictdistances
inject-mapt
inject_maps
maximum-pathssmaximum-paths ibgptnetworkstredistributesnexthop route-maptnext_hop_route_mapssuppress-inactives	table-mapt	table_mapstable-map-filterttable_map_filtertvrfcCs�t|}tjdj|�tj�}|j|�}|d&kr�g}x[|j|�D]W}|j�}d|kr�|jd�nd|kr�|jd�n|j	|�qYWn�|dkrJd}	tj
|	|tj�}
d	}|
r�|
j�}|d
kr|d}qG|dkr+|d
}qG|dkrG|d}qGq�n]|j�ddkr`d	}|dks~|dkr�||kr]|j
d�}q]q�d}tj
||tj�}
|
r6|
j�}|dkr�|d}q]|dkr|d}q]|dkr|d}q]|dkr]|d}q]q�|dkr�d|krTtnt}q�nG|dkr�tjd tj�}t}|j|�r�t}q�n|d!kr�tjd"tj�}|j|�}d	}|r�|j
d�}q�n�|d#kr>tjd$j|�tj�}t}|j|�r�t}q�ni|tkr�tjd%j|�tj�}t}|j|�r�t}q�nd	}|r�|j
d�}n|S('Ns(?:{0}\s)(?P<value>.*)$R+R,R*s	exist-maps	route-mapR)s>.*distance\s(?P<d_ebgp>\w+)\s(?P<d_ibgp>\w+)\s(?P<d_local>\w+)tRtd_ebgpRtd_ibgpRtd_localiR"RR&tvaluesT.*dampening\s(?P<half>\w+)\s(?P<reuse>\w+)\s(?P<suppress>\w+)\s(?P<max_suppress>\w+)R#thalfR%treuseR'tsuppressR$tmax_suppressRR/s\s+table-map.*filter$R.s)(?:table-map\s)(?P<value>\S+)(\sfilter)?$Rs^\s+no\s{0}\s*$s^\s+{0}\s*$(snetworkssredistributes
inject_map(tPARAM_TO_COMMAND_KEYMAPtretcompiletformattMtsearchtfindalltsplittremovetappendtmatchtDOTALLt	groupdicttgrouptTruetFalsetBOOL_PARAMS(targtconfigtmoduletcommandtcommand_val_rethas_command_valR5telettltdistance_retmatch_distancetdistance_grouptdampening_retmatch_dampeningtdampening_groupt	tmf_regexttm_regexthas_tablemapt
no_command_ret
command_re((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pyt	get_values�





cCs�i}tdddt|��}tjdtj�}|jt|��}|r�|jd�}dj|�g}|j	ddkr�|j
d	j|j	d��n|j
d
j|j	d|j	d��|j|�}	|	r�x�|D]x}
|
dkr�t|
|	|�}|r|||
<q`|
dkrS|
t
j�krSt
j|
�||
<q`|||
<q�q�W||d
<|j	d|d<|j	d|d<|j	d|d<q�n|j
dj|j	d
��|S(Ntindentitcontentss..*router\sbgp\s(?P<existing_asn>\d+(\.\d+)?).*texisting_asnsrouter bgp {0}R0tdefaultsvrf {0}saddress-family {0} {1}RR RRs>The BGP process {0} didn't exist but the task just created it.(sasnsafissafisvrf(R
RR;R<RERDtstrRGR=tparamsRCtget_sectionR^tPARAM_TO_DEFAULT_KEYMAPtkeystget(RMtargstwarningstexistingtnetcfgt	asn_regext	match_asnRatparentsRLRKtgv((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytget_existingrs4 '


cCsIi}x<|j�D].\}}|j|�}|r|||<qqW|S(N(titemsRh(tkey_mapttabletnew_dicttkeyR5tnew_key((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pyt
apply_key_map�scCsVt�}d}i}x4|j�D]&\}}|tkr�|dkr�dj|jd�|jd�|jd�|jd��}n:|j|�r�dj|d|d|d|d�}nd|kr#d}q#nL|jd	�rd
j|jd�|jd�|jd
��}n
|||<|r"||krH|j|�qHq"q"W||fS(NR1Rbsdampening {0} {1} {2} {3}R#R%R'R$sno dampening {0} {1} {2} {3}R)sdistance {0} {1} {2}RRR(tlistRrtDAMPENING_PARAMSR=Rht
startswithRC(RMtproposedRktcommandsRNtfixed_proposedRvR5((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytfix_proposed�s:	
cCsug}|dkr�x\|D]k}t|�dkrU|jdj|d|d��qt|�dkr|jdj|d��qqWn�|dkrx�|D]r}t|�dkr�|jdj|d|d��q�t|�d	kr�|jd
j|d|d��q�q�WnZ|dkrXxK|D]'}|jdj|d|d��q*Wn|jd
j||��|S(NRisno network {0} route-map {1}iisno network {0}s
inject-mapsno inject-map {0} exist-map {1}is/no inject-map {0} exist-map {1} copy-attributesR,s!no redistribute {0} route-map {1}s
no {0} {1}(tlenRCR=(texisting_valueRvR5R}Rtmaps((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytdefault_existing�s*

$
(cCs]g}|jdg�}x�|D]�}t|t�s@|g}n||krt|�dkrwdj||d�}n2t|�dkr�dj||d|d�}n|r�|j|�q�qqWx�|D]�}||kr�t|�dkr
dj||d�}n2t|�dkr<dj||d|d�}n|rU|j|�qUq�q�W|S(	NR+is{0} {1}iis{0} {1} route-map {2}s
no {0} {1}sno {0} {1} route-map {2}(Rht
isinstanceRyR�R=RC(RkRvR5R}texisting_networkstinetRNtenet((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytget_network_command�s*
 
 cCs_g}|jdg�}x�|D]�}t|t�s@|g}n||krt|�dkr{dj|d|d�}n/t|�dkr�dj|d|d�}n|r�|j|�q�qqWx�|D]�}||kr�t|�dkrdj|d|d�}n/t|�dkr>d	j|d|d�}n|rW|j|�qWq�q�W|S(
NR*isinject-map {0} exist-map {1}iiis,inject-map {0} exist-map {1} copy-attributessno inject-map {0} exist-map {1}s/no inject-map {0} exist-map {1} copy-attributes(RhR�RyR�R=RC(RkRvR5R}t
existing_mapsR�RNtemaps((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytget_inject_map_command�s6

cCs�g}|jdg�}x_|D]W}t|t�s@|g}n||krdj|d|d�}|j|�qqWxD|D]<}||kr�dj|d|d�}|j|�q�q�W|S(NR,sredistribute {0} route-map {1}iis!no redistribute {0} route-map {1}(RhR�RyR=RC(RkRvR5R}texisting_rulestruleRNterule((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytget_redistribute_commands

cCs�g}|dkr�|dkrzdj||jd�}|jddk	rj|jddkrj|d7}n|j|�q�|jd�r�dj||jd��}|j|�q�n|S(Ns	table-mapRbs{0} {1}R.R/s filters
no {0} {1}(R=RdtNoneRCRh(RMRkRvR5R}RN((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytget_table_map_command*s
cCsVg}|jd�}|rR|jd�}|rRdj|�}|j|�qRn|S(NR/R.s
table-map {0}(RhR=RC(RkR}texisting_table_map_filtertexisting_table_mapRN((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytget_default_table_map_filter:scCsJt|||�\}}tt|�}tt|�}x\|j�D]N\}}	|dkr�dj|jd|jd�}
|
|kr�|j|
�q�qC|jd�r�t||||	�}|r�|j	|�q�qC|	t
kr�|j|�qC|	tkr|jdj|��qC|	dkr�|tkrP|jdj|t|��q�|j
|�r�|d	kr�t|�}|r�|j	|�q�q�|j
|�}
t|
||	�}|r�|j	|�q�q�qC|d
krt|||	�}|r�|j	|�q�qC|dkr;t|||	�}|r�|j	|�q�qC|dkrrt|||	�}|r�|j	|�q�qCdj||	�}|j|�qCW|rFd
j|jd�g}|jddkr�|jdj|jd��ndj|jd|jd�}
|j|
�|
|kr0|j|
�n|j|d|�ndS(Nsaddress-familysaddress-family {0} {1}RR s	table-mapsno {0}Rbs{0} {1}stable-map-filterRs
inject-mapR,srouter bgp {0}RR0svrf {0}Ro(RRxR:RrR=RdRCR{R�textendRHRIRfRhR�R�R�R�R�RBtadd(RMRkR|t	candidateR~R}tproposed_commandstexisting_commandsRvR5taddr_family_commandttable_map_commandstdefault_tmf_commandR�tdefault_commandtnetwork_commandstinject_map_commandstredistribute_commandsRNRo((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pyt
state_presentEsj  
cCs�g}dj|jd�g}|jddkrR|jdj|jd��n|jdj|jd|jd��|j|d	|�dS(
Nsrouter bgp {0}RR0Rbsvrf {0}sno address-family {0} {1}RR Ro(R=RdRCR�(RMR�R}Ro((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytstate_absent�s c
Gstdtdtdd�dtdtdddd�dtdtdddd	d
dg�dtdtdddd
ddddg�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�d tdtdd�d!tdtdd�d"tdtdd�d#tdtdd�d$tdtdd�d%tdtdd&�d'tdtdd�d(tdtdd�d)tdtdd&�d*tdtdd�d+tdtdd&�d,tdtdd�d-tdtdd�d.tdtdd�d/tdd0d1gdd0dt�� }|jt�dCdDdEdFdGdHdIdJdKg	}td2|d3|d4td#d"d$ggd5t�}t�}t||�td6td7|�}|j	d/}|j	dr�|j	ddkr�|j
d8d9d|j	d�q�n|j	d.r�|j	d-r�|j
d8d:�ntj��t
|�|�}|jd�rm|d0krm|jd�|j	dkrm|j
d8d;d<|j	dd=|jd��qmnt�fd>�|j	j�D��}xJd)d%d+gD]9}|j|�r�||d?dkr�d||<q�q�q�Wi}	xx|j�D]j\}
}|
dLkr�t|�j�dkr7tj|
d�}n|j|
�|kr\||	|
<q\q�q�Wtd@dA�}|d0kr�t|||	|�n"|d1kr�|r�t||�n|r�|j�}|js�t||�nt|d6<||dB<n
g|dB<|j|�dS(MNRtrequiredttypeRcR0RbR tchoicestunicastt	multicasttevpnRtipv4tipv6tvpnv4tvpnv6tl2vpnRtboolRR!R
RRRRR#R$R%R&R'RR(RRRR*RyRRR+R-R,RR.R/tstatetpresenttabsentt
argument_spectmutually_exclusivetrequired_togethertsupports_check_modetchangedRjtmsgsZIt is not possible to advertise L2VPN EVPN in the default VRF. Please specify another one.s=table_map param is needed when using table_map_filter filter.sAnother BGP ASN already exists.tproposed_asnRac3s9|]/\}}|dk	r|�kr||fVqdS(N(R�(t.0tktv(Ri(sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pys	<genexpr>�s	iR_iR}(RR&(RR#(RR'(RR%(RR$(R&R#(R&R'(R&R%(R&R$(RR0(tdictRHRItupdateRR	RzRyRRdt	fail_jsonR:RgRqRhRrRctlowerRfR
R�R�t
items_textt
check_modeRt	exit_json(
R�R�RMRjtresultR�Rkt
proposed_argsRKR|RvR5R�((RisL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pytmain�s�$*$
			



%	


t__main__(!tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR;t&ansible.module_utils.network.nxos.nxosRRRRtansible.module_utils.basicR	t*ansible.module_utils.network.common.configR
RJRHRfR:RzR^RqRxRR�R�R�R�R�R�R�R�R�t__name__(((sL/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_af.pyt<module>s�


�
		

		X	&	
	$							F		r

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