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

�
�Udac@sidd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZd	dlmZm	Z	d	d
l
mZd	dlm
Z
ddddddddgZi"dd6dd6dd6dd6dd6d d!6d"d#6d$d6d$d%6d&d6d'd6d(d)6d*d6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d6d8d6d9d:6d;d<6d=d>6d?d@6dAd6ddB6dCdD6dEdF6dGdG6dHd6dIdJ6dKdK6dLdL6ZdM�ZdN�ZdO�ZdP�ZdQ�ZdR�ZdS�ZdT�ZdU�ZedVkre�nd
S(Ws1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: nxos_bgp_neighbor_af
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages BGP address-family's neighbors configuration.
description:
  - Manages BGP address-family's 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 address-family's
    neighbor configuration.
  - Default, when supported, removes properties
  - In order to default maximum-prefix configuration, only
    C(max_prefix_limit=default) is needed.
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
  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_receive:
    description:
      - Valid values are enable for basic command enablement; disable
        for disabling the command at the neighbor af level
        (it adds the disable keyword to the basic command); and inherit
        to remove the command at this level (the command value is
        inherited from a higher BGP layer).
    choices: ['enable','disable', 'inherit']
  additional_paths_send:
    description:
      - Valid values are enable for basic command enablement; disable
        for disabling the command at the neighbor af level
        (it adds the disable keyword to the basic command); and inherit
        to remove the command at this level (the command value is
        inherited from a higher BGP layer).
    choices: ['enable','disable', 'inherit']
  advertise_map_exist:
    description:
      - Conditional route advertisement. This property requires two
        route maps, an advertise-map and an exist-map. Valid values are
        an array specifying both the advertise-map name and the exist-map
        name, or simply 'default' e.g. ['my_advertise_map',
        'my_exist_map']. This command is mutually exclusive with the
        advertise_map_non_exist property.
  advertise_map_non_exist:
    description:
      - Conditional route advertisement. This property requires two
        route maps, an advertise-map and an exist-map. Valid values are
        an array specifying both the advertise-map name and the
        non-exist-map name, or simply 'default' e.g.
        ['my_advertise_map', 'my_non_exist_map']. This command is mutually
        exclusive with the advertise_map_exist property.
  allowas_in:
    description:
      - Activate allowas-in property
    type: bool
  allowas_in_max:
    description:
      - Max-occurrences value for allowas_in. Valid values are
        an integer value or 'default'. This is mutually exclusive with
        allowas_in.
  as_override:
    description:
      - Activate the as-override feature.
    type: bool
  default_originate:
    description:
      - Activate the default-originate feature.
    type: bool
  default_originate_route_map:
    description:
      - Route-map for the default_originate property.
        Valid values are a string defining a route-map name,
        or 'default'. This is mutually exclusive with
        default_originate.
  disable_peer_as_check:
    description:
      - Disable checking of peer AS-number while advertising
    type: bool
    version_added: 2.5
  filter_list_in:
    description:
      - Valid values are a string defining a filter-list name,
        or 'default'.
  filter_list_out:
    description:
      - Valid values are a string defining a filter-list name,
        or 'default'.
  max_prefix_limit:
    description:
      - maximum-prefix limit value. Valid values are an integer value
        or 'default'.
  max_prefix_interval:
    description:
      - Optional restart interval. Valid values are an integer.
        Requires max_prefix_limit. May not be combined with max_prefix_warning.
  max_prefix_threshold:
    description:
      - Optional threshold percentage at which to generate a warning.
        Valid values are an integer value.
        Requires max_prefix_limit.
  max_prefix_warning:
    description:
      - Optional warning-only keyword. Requires max_prefix_limit. May not be
        combined with max_prefix_interval.
    type: bool
  next_hop_self:
    description:
      - Activate the next-hop-self feature.
    type: bool
  next_hop_third_party:
    description:
      - Activate the next-hop-third-party feature.
    type: bool
  prefix_list_in:
    description:
      - Valid values are a string defining a prefix-list name,
        or 'default'.
  prefix_list_out:
    description:
      - Valid values are a string defining a prefix-list name,
        or 'default'.
  route_map_in:
    description:
      - Valid values are a string defining a route-map name,
        or 'default'.
  route_map_out:
    description:
      - Valid values are a string defining a route-map name,
        or 'default'.
  route_reflector_client:
    description:
      - Router reflector client.
    type: bool
  send_community:
    description:
      - send-community attribute.
    choices: ['none', 'both', 'extended', 'standard', 'default']
  soft_reconfiguration_in:
    description:
      - Valid values are 'enable' for basic command enablement; 'always'
        to add the always keyword to the basic command; and 'inherit' to
        remove the command at this level (the command value is inherited
        from a higher BGP layer).
    choices: ['enable','always','inherit']
  soo:
    description:
      - Site-of-origin. Valid values are a string defining a VPN
        extcommunity or 'default'.
  suppress_inactive:
    description:
      - suppress-inactive feature.
    type: bool
  unsuppress_map:
    description:
      - unsuppress-map. Valid values are a string defining a route-map
        name or 'default'.
  weight:
    description:
      - Weight value. Valid values are an integer value or 'default'.
  state:
    description:
      - Determines whether the config should be present or not
        on the device.
    default: present
    choices: ['present','absent']
s�
- name: configure RR client
  nxos_bgp_neighbor_af:
    asn: 65535
    neighbor: '192.0.2.3'
    afi: ipv4
    safi: unicast
    route_reflector_client: true
    state: present
s�
commands:
  description: commands sent to the device
  returned: always
  type: list
  sample: ["router bgp 65535", "neighbor 192.0.2.3",
           "address-family ipv4 unicast", "route-reflector-client"]
i����N(t
get_configtload_config(tnxos_argument_spect
check_args(t
AnsibleModule(tCustomNetworkConfigt
allowas_intas_overridetdefault_originatetdisable_peer_as_checkt
next_hop_selftnext_hop_third_partytroute_reflector_clienttsuppress_inactivesaddress-familytafis
router bgptasntneighbors#capability additional-paths receivetadditional_paths_receives capability additional-paths sendtadditional_paths_sendsadvertise-map exist-maptadvertise_map_existsadvertise-map non-exist-maptadvertise_map_non_exists
allowas-intallowas_in_maxsas-overridesdefault-originatesdefault-originate route-maptdefault_originate_route_mapsdisable-peer-as-checksfilter-list intfilter_list_insfilter-list outtfilter_list_outsmaximum-prefixtmax_prefix_limitsmaximum-prefix intervaltmax_prefix_intervalsmaximum-prefix thresholdtmax_prefix_thresholdsmaximum-prefix warningtmax_prefix_warnings
next-hop-selfsnext-hop-third-partysprefix-list intprefix_list_insprefix-list outtprefix_list_outsroute-map introute_map_ins
route-map outt
route_map_outsroute-reflector-clienttsafissend-communitytsend_communityssoft-reconfiguration inboundtsoft_reconfiguration_intsoossuppress-inactivesunsuppress-maptunsuppress_maptweighttvrfcCs�ddddddddg}t|}tjd	j|�|tj�}tjd
j|�|tj�}d}||kr�t|||�}n3|dkr�tjd
j|�|tj�}t}|s�t}q�n�|tkr�t}|r�t}q�n�|j	d�rTg}tjdj|j
��|tj�}	|	r�t|	j��}q�np|j
�ddkr�tjdj|j
��|tj�}
|
r�|
j
d�}q�n|r�|j
d�}n|S(NRRRRR R!R'R(s
^\s+{0}\s*s(?:{0}\s)(?P<value>.*)$tRs^\s+no\s+{0}\s*$s
advertise-maps){0}\s(?P<value1>.*)\s{1}\s(?P<value2>.*)$isfilter-listsprefix-lists	route-maps{0}\s(?P<value>.*)\s{1}$tvalue(sfilter-listsprefix-lists	route-map(tPARAM_TO_COMMAND_KEYMAPtretsearchtformattMtget_custom_valuetFalsetTruetBOOL_PARAMSt
startswithtsplittlisttgroupstgroup(targtconfigtmoduletcustomtcommandthas_commandthas_command_valR.thas_no_commandthas_adv_mapthas_cmd_direction_val((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pyt	get_value!sF	
!!!''cCs�tj|�}|j�}d}tjdj|�tj�}|j|�}tjdj|�tj�}|j|�}	|jd�r�d}x�|D]0}
||
kr�d|
kr�d}q�d}q�q�Wn�|jd�r�x�|D]�}
d	|
kr�|
j	�}|d
kr|d}q�|dkr@d
|
kr@|d}q�|dkr�t
|�dkr�yt|d�|d}Wq�tk
r�d}q�Xq�|dkr�d|
k}q�q�q�Wn�|dkrd}x�|D]0}
||
kr�d|
kr�d}qd}q�q�Wnz|dkr�d}xe|D]Z}
||
kr%d|
kra|dkrXd}q|d}qd|
krvd}qd}q%q%Wn|S(NR-s	\s+{0}\s*s(?:{0}\s)(?P<value>.*)$tadditional_pathstinherittdisabletenablet
max_prefixsmaximum-prefixRiRtrestarti����R iR!swarning-onlyR(talwaysR'tnonetextendedtstandardtboth(
R/tgett
splitlinesR0tcompileR2R3R1R8R9tlentintt
ValueError(R=R>R?RAtsplitted_configR.t
command_reRBtcommand_val_reRCtlinet
splitted_line((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pyR4Psb
	





	
			cCs�i}tdddt|��}tjdtj�}|jt|��}|r�|jd�}dj|�g}|j	ddkr�|j
d	j|j	d��n|j
d
j|j	d��|j
dj|j	d
|j	d��|j|�}	|	r�x3|D]+}
|
dkrt|
|	|�||
<qqW||d<|j	d|d<|j	d|d<|j	d
|d
<|j	d|d<q�n
|j
d�|S(Ntindentitcontentss..*router\sbgp\s(?P<existing_asn>\d+(\.\d+)?).*texisting_asnsrouter bgp {0}R,tdefaultsvrf {0}sneighbor {0}Rsaddress-family {0} {1}RR&Rs:The BGP process didn't exist but the task just created it.(sasnsvrfsneighborsafissafi(
R
RR0RUtStmatchtstrR<R2tparamstappendtget_sectionRG(R?targstwarningstexistingtnetcfgt	asn_regext	match_asnR`tparentsR>R=((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pytget_existing�s. '


cCsFi}x9|D]1}|j|�}|r
|j|�||<q
q
W|S(N(RS(tkey_mapttabletnew_dicttkeytnew_key((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pyt
apply_key_map�s
cCs�d}|j|�r�|j|�}|dkrQ|dkr�dj|�}q�q�|dkrzdj|d|d�}q�|dkr�d	j|d|d�}q�|d
kr�dj|�}q�|dkr�d
j|�}q�|dkr�dj|�}q�|dkrdj|�}q�|dkr9dj|�}q�|dkrWdj|�}q�|jd�rod}q�|dkr�dj|�g}|jd�q�dj||�}n6|jdd�jdd�tkr�dj|�}n|S(NR-RIsno {0}sadvertise-map exist-maps"no advertise-map {0} exist-map {1}iisadvertise-map non-exist-maps&no advertise-map {0} non-exist-map {1}sfilter-list insno filter-list {0} insfilter-list outsno filter-list {0} outsprefix-list insno prefix-list {0} insprefix-list outsno prefix-list {0} outsroute-map insno route-map {0} ins
route-map outsno route-map {0} outsmaximum-prefixsno maximum-prefixsallowas-in maxsno allowas-in {0}s
allowas-ins
no {0} {1}t t_t-(RSR2R8RftreplaceR7(RsR.texisting_commandsRAtexisting_value((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pytget_default_command�sB	$cCs�|jd�}|jd�}|r;|r;|jd�n|rW|rW|jd�n|jd�dkr�|jd�dkr�|jd�n|S(NRRR'RORa(RStpop(R?RjtproposedRR((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pytfix_proposed�s
*cCsmt�}t|||�}tt|�}tt|�}x_|j�D]Q\}}|d-kr�t|||�}	t|	t�r�|	r�|	|kr�|j|	�q�q�t|	t�r�x-|	D]"}
|
|kr�|j|
�q�q�Wq�qF|j	d�r�|j
ddkr�dj|j
d�}	|j
drH|	dj|j
d�7}	n|j
drr|	d	j|j
d�7}	n|j
d
r�|	d7}	n|j|	�q�qF|tkr�|j|�qF|t
kr�|jdj|��qF|d
kr|jdj|j
d|j
d��qF|j	d�rT|}	|dkrD|	d7}	n|j|	�qF|j	d�r�|j�d}|jdj||��qF|j�dd.kr�|jdj||j���qF|dkrd}	|dkr�|}	n!|dkrd j||�}	n|j|	�qF|d!krx|}	|d/krU|jd$|d%�n|	dj|�7}	|j|	�qFd j||�}	|j|	�qFW|rid&j|j
d'�g}|j
d(dkr�|jd)j|j
d(��n|jd*j|j
d+��dj|j
d|j
d�}
|j|
�|
|krS|j|
�n|j|d,|�ndS(0NRIRasmaximum-prefixRsmaximum-prefix {0}R s {0}Rs restart {0}R!s
 warning-onlysno {0}saddress-familysaddress-family {0} {1}RR&scapability additional-pathsRJs disables
advertise-mapisadvertise-map {1} {0} {2}isfilter-listsprefix-lists	route-maps{1} {0} {2}ssoft-reconfiguration inboundR-RKRNs{0} {1}ssend-communityRQRPsno s bothsrouter bgp {0}RR,svrf {0}sneighbor {0}RRn(sinheritsdefault(sfilter-listsprefix-lists	route-map(sstandardsextended(R:RRuR/titemsR|t
isinstanceRdRfR8ReR2R6R5R9tremovetadd(R?RjR~t	candidatetcommandstproposed_commandsRzRsR.RAtcmdt	directionRnt
af_command((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pyt
state_present�s�	




*
"	 
cCs�g}dj|jd�g}|jddkrR|jdj|jd��n|jdj|jd��|jdj|jd	|jd
��|j|d|�dS(Nsrouter bgp {0}RR,Rasvrf {0}sneighbor {0}Rsno address-family {0} {1}RR&Rn(R2ReRfR�(R?RjR�R�Rn((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pytstate_absent;s cMs�tdtdtdd�dtdtdddd�dtdtdd�dtdtdd�d	tdtdd�d
tdtddddd
dg�dtdtddddd
dg�dtdtdd�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)d*d+dg�d,tdtddddd-dg�d.tdtdd�d/tdtdd�d0tdtdd�d1tdtdd�d2tdd3d4gdd3dt��#}|jt�td5|d6ddgddgddgddggd7t�}t�}t||�td8td9|�}|jd2}xIdddgD]8}|j|r�|jdr�|j	d:d;|�q�q�W|jddkr9|jd.r9|j	d:d<�nt
j��t|�|�}|j
d�r�|d3kr�|j
d�|jdkr�|j	d:d=d>|jdd?|j
d��q�nx:ddgD],}|j|dgkr�d|j|<q�q�Wt�fd@�|jj�D��}i}	x|j�D]�\}}
|dFkr5t|
t�st|
�j�dAkr}t}
qt|
�j�dBkr�t}
qt|
�j�dkr�|tkr�t}
qd}
q|d'krt|
�j�d(krd}
qn|j
|�|
kr)|
|	|<q)q5q5WtdCdD�}|d3kr^t|||	|�n%|d4kr�|r�t|||�n|r�|j�}|js�t||�nt|d8<||dE<n
g|dE<|j|�dS(GNRtrequiredttypeRdR,RaRRR&RtchoicesRKRJRIRRR:RRtboolRRR
RRRRRRR R!RRR"R#R$R%RR'RORRRPRQR(RNR)RR*R+tstatetpresenttabsentt
argument_spectmutually_exclusivetsupports_check_modetchangedRitmsgs*max_prefix_limit is required when using %ss&SOO is only allowed in non-default VRFsAnother BGP ASN already exists.tproposed_asnR`c3s9|]/\}}|dk	r|�kr||fVqdS(N(tNone(t.0tktv(Rh(sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pys	<genexpr>�sttruetfalseR^iR�(RR,R(tdictR6R5tupdateRR	R:RRet	fail_jsonR/tkeysRoRSR�R�RdtlowerR7R
R�R�t
items_textt
check_modeRt	exit_json(R�R?RitresultR�RsRjtparamt
proposed_argsR~R.R�((RhsU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pytmainGs�$$$$$
					

	 
%				$	


t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR0t&ansible.module_utils.network.nxos.nxosRRRRtansible.module_utils.basicR	t*ansible.module_utils.network.common.configR
R7R/RGR4RoRuR|RR�R�R�t__name__(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp_neighbor_af.pyt<module>s�


�
		
	/	<	"	
	'		N		q

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