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

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lZd	dlmZmZd	dlmZm	Z	d	d
l
mZd	dlm
Z
dddddddddddddddddd d!gZdd"d#dd$d%d&d'dddd!d g
Zid(d)6d*d+6d,d-6ed6d.d/6d,d06d(d16ed!6ed6ed6ed$6ed%6ed&6ed'6d2d36d2d46d2d56d2d"6d2d#6d2d66d2d76Zi'd8d96d:d6d;d6d<d6d=d6d>d6d?d6d@d6dAd6dBd56dCd76dDdE6dFd6dGd"6dHd#6dId6dJd$6dKd%6dLd&6dMd'6dNd6dOd6dPd6dQd6dRd/6dSd06dd6dTd66dUd6dVd36dWd6dXd16dYd46d d 6dZd!6d[d-6d\d+6d\d)6d]d]6Zd^�Zd_�Zd`�Zda�Zdb�Zdc�Zdd�Zedekr�e�nd
S(fs1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys�
---
module: nxos_bgp
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages BGP configuration.
description:
    - Manages BGP configurations on NX-OS switches.
author:
    - Jason Edelman (@jedelman8)
    - Gabriele Gerbino (@GGabriele)
notes:
    - Tested against NXOSv 7.3.(0)D1(1) on VIRL
    - C(state=absent) removes the whole BGP ASN configuration when
      C(vrf=default) or the whole VRF instance within the BGP process when
      using a different VRF.
    - Default when supported restores params default value.
    - Configuring global params is only permitted if C(vrf=default).
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.
    bestpath_always_compare_med:
        description:
            - Enable/Disable MED comparison on paths from different
              autonomous systems.
        type: bool
    bestpath_aspath_multipath_relax:
        description:
            - Enable/Disable load sharing across the providers with
              different (but equal-length) AS paths.
        type: bool
    bestpath_compare_routerid:
        description:
            - Enable/Disable comparison of router IDs for identical eBGP paths.
        type: bool
    bestpath_compare_neighborid:
        description:
            - Enable/Disable neighborid. Use this when more paths available than max path config.
        type: bool
    bestpath_cost_community_ignore:
        description:
            - Enable/Disable Ignores the cost community for BGP best-path
              calculations.
        type: bool
    bestpath_med_confed:
        description:
            - Enable/Disable enforcement of bestpath to do a MED comparison
              only between paths originated within a confederation.
        type: bool
    bestpath_med_missing_as_worst:
        description:
            - Enable/Disable assigns the value of infinity to received
              routes that do not carry the MED attribute, making these routes
              the least desirable.
        type: bool
    bestpath_med_non_deterministic:
        description:
            - Enable/Disable deterministic selection of the best MED pat
              from among the paths from the same autonomous system.
        type: bool
    cluster_id:
        description:
            - Route Reflector Cluster-ID.
    confederation_id:
        description:
            - Routing domain confederation AS.
    confederation_peers:
        description:
            - AS confederation parameters.
    disable_policy_batching:
        description:
            - Enable/Disable the batching evaluation of prefix advertisement
              to all peers.
        type: bool
    disable_policy_batching_ipv4_prefix_list:
        description:
            - Enable/Disable the batching evaluation of prefix advertisements
              to all peers with prefix list.
    disable_policy_batching_ipv6_prefix_list:
        description:
            - Enable/Disable the batching evaluation of prefix advertisements
              to all peers with prefix list.
    enforce_first_as:
        description:
            - Enable/Disable enforces the neighbor autonomous system to be
              the first AS number listed in the AS path attribute for eBGP.
              On NX-OS, this property is only supported in the
              global BGP context.
        type: bool
    event_history_cli:
        description:
            - Enable/Disable cli event history buffer.
        choices: ['size_small', 'size_medium', 'size_large', 'size_disable', 'default']
    event_history_detail:
        description:
            - Enable/Disable detail event history buffer.
        choices: ['size_small', 'size_medium', 'size_large', 'size_disable', 'default']
    event_history_events:
        description:
            - Enable/Disable event history buffer.
        choices: ['size_small', 'size_medium', 'size_large', 'size_disable', 'default']
    event_history_periodic:
        description:
            - Enable/Disable periodic event history buffer.
        choices: ['size_small', 'size_medium', 'size_large', 'size_disable', 'default']
    fast_external_fallover:
        description:
            - Enable/Disable immediately reset the session if the link to a
              directly connected BGP peer goes down.  Only supported in the
              global BGP context.
        type: bool
    flush_routes:
        description:
            - Enable/Disable flush routes in RIB upon controlled restart.
              On NX-OS, this property is only supported in the global
              BGP context.
        type: bool
    graceful_restart:
        description:
            - Enable/Disable graceful restart.
        type: bool
    graceful_restart_helper:
        description:
            - Enable/Disable graceful restart helper mode.
        type: bool
    graceful_restart_timers_restart:
        description:
            - Set maximum time for a restart sent to the BGP peer.
    graceful_restart_timers_stalepath_time:
        description:
            - Set maximum time that BGP keeps the stale routes from the
              restarting BGP peer.
    isolate:
        description:
            - Enable/Disable isolate this router from BGP perspective.
        type: bool
    local_as:
        description:
            - Local AS number to be used within a VRF instance.
    log_neighbor_changes:
        description:
            - Enable/Disable message logging for neighbor up/down event.
        type: bool
    maxas_limit:
        description:
            - Specify Maximum number of AS numbers allowed in the AS-path
              attribute. Valid values are between 1 and 512.
    neighbor_down_fib_accelerate:
        description:
            - Enable/Disable handle BGP neighbor down event, due to
              various reasons.
        type: bool
    reconnect_interval:
        description:
            - The BGP reconnection interval for dropped sessions.
              Valid values are between 1 and 60.
    router_id:
        description:
            - Router Identifier (ID) of the BGP router VRF instance.
    shutdown:
        description:
            - Administratively shutdown the BGP protocol.
        type: bool
    suppress_fib_pending:
        description:
            - Enable/Disable advertise only routes programmed in hardware
              to peers.
        type: bool
    timer_bestpath_limit:
        description:
            - Specify timeout for the first best path after a restart,
              in seconds.
    timer_bgp_hold:
        description:
            - Set BGP hold timer.
    timer_bgp_keepalive:
        description:
            - Set BGP keepalive timer.
    state:
        description:
            - Determines whether the config should be present or not
              on the device.
        default: present
        choices: ['present','absent']
s}
- name: Configure a simple ASN
  nxos_bgp:
      asn: 65535
      vrf: test
      router_id: 192.0.2.1
      state: present
s�
commands:
    description: commands sent to the device
    returned: always
    type: list
    sample: ["router bgp 65535", "vrf test", "router-id 192.0.2.1"]
i����N(t
get_configtload_config(tnxos_argument_spect
check_args(t
AnsibleModule(tCustomNetworkConfigtbestpath_always_compare_medtbestpath_aspath_multipath_relaxtbestpath_compare_neighboridtbestpath_compare_routeridtbestpath_cost_community_ignoretbestpath_med_confedtbestpath_med_missing_as_worsttbestpath_med_non_deterministictdisable_policy_batchingtenforce_first_astfast_external_fallovertflush_routestgraceful_restarttgraceful_restart_helpertisolatetlog_neighbor_changestneighbor_down_fib_acceleratetshutdowntsuppress_fib_pendingt(disable_policy_batching_ipv4_prefix_listt(disable_policy_batching_ipv6_prefix_listtevent_history_clitevent_history_detailtevent_history_eventstevent_history_periodict60ttimer_bgp_keepalivet180ttimer_bgp_holdt300ttimer_bestpath_limitt120tgraceful_restart_timers_restartt&graceful_restart_timers_stalepath_timetreconnect_intervalttmaxas_limitt	router_idt
cluster_idtlocal_astconfederation_ids
router bgptasnsbestpath always-compare-meds bestpath as-path multipath-relaxsbestpath compare-neighboridsbestpath compare-routeridsbestpath cost-community ignoresbestpath med confedsbestpath med missing-as-worstsbestpath med non-deterministics
cluster-idsconfederation identifiersconfederation peerstconfederation_peerssdisable-policy-batchings(disable-policy-batching ipv4 prefix-lists(disable-policy-batching ipv6 prefix-listsenforce-first-assevent-history clisevent-history detailsevent-history eventssevent-history periodicsfast-external-falloversflush-routessgraceful-restartsgraceful-restart-helpersgraceful-restart restart-timesgraceful-restart stalepath-timeslocal-asslog-neighbor-changessmaxas-limitsneighbor-down fib-acceleratesreconnect-intervals	router-idssuppress-fib-pendingstimers bestpath-limits
timers bgptvrfc
Cs�tj|�}|j�ddkr�tjdj|�|tj�}|dkr[t}nd}|r�d|jd�}q�n^|dkr�tj	d
j|�tj�}t
}|j|�r�t}q�n|tkrtjdj|�|tj�}t}|r�t
}q�n�tj	dj|�tj�}d
}|j|�}|r�|jd�}|dkrs|j�}q�|dkr�|j�d}q�|dkr�|j�}	t|	�dkr�|	d}q�q�|r�|}q�n|S(Nis
event-historys^\s+{0} size\s(?P<value>.*)$sevent-history detailt
size_smallssize_%stvalueRRsno\s+{0}\s*s^\s+{0}\s*$s(?:{0}\s)(?P<value>.*)R.R5R%R'ii(senforce_first_assfast_external_fallover(
tPARAM_TO_COMMAND_KEYMAPtgettsplittretsearchtformattMtFalsetgrouptcompiletTruetBOOL_PARAMStlen(
targtconfigtcommandthas_sizeR8t
no_command_rethas_commandtcommand_val_retfound_valuetsplit_values((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pyt	get_valueYsD!	!c
Cs�i}tdddt|ddg��}tjdtj�}|jt|��}|rJ|jd�}dj|�}|j	d	d
kr�|dj|j	d	�g}	n	|g}	|j
|	�}
|
rJxO|D]G}|dkr�|j	d	d
ks|tkr�t||
�||<q�q�W||d<|j	d	d
krGd
|d	<qGqJn|r�|j	d	d
kr�|j	d
dkr�dj|j	d	�}|j
|�n|S(Ntindentitcontentstflagssbgp alls..*router\sbgp\s(?P<existing_asn>\d+(\.\d+)?).*texisting_asnsrouter bgp {0}R6tdefaultsvrf {0}R4tstatetpresentsVRF {0} doesn't exist.(R
RR<RBtStmatchtstrRAR>tparamstget_sectiont
GLOBAL_PARAMSROtappend(
tmoduletargstwarningstexistingtnetcfgtasn_ret	asn_matchRSt
bgp_parenttparentsRGRFtmsg((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pytget_existing�s.$	

-cCsFi}x9|D]1}|j|�}|r
|j|�||<q
q
W|S(N(R:(tkey_mapttabletnew_dicttkeytnew_key((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pyt
apply_key_map�s
c
Cs�t�}tt|�}tt|�}x�|j�D]�\}}|tkr\|j|�q4|tkr�|jdj|��q4|dkrtj	|�}	|j	|�}
|	r�|jdj||	��q�|
r�|dkr�dj
|
�}
n|jdj||
��q�q4|sJ|j	|�}
|
r�|jdj||
��q�q4|dkrr|jdj||��q4|jd�r�dj|d	|d
�}||kr�|j|�q�q4|jd�r�|jdd�}ndj||�}|j|�q4Wg}|rht
|�}d
j|jd�g}|jddkr�|jdj|jd��q�nr|r�|jddkr�|jdj|jd��d
j|jd�g}q�|jd
j|jd��n|j|d|�dS(Nsno {0}RTs{0} {1}sconfederation peerst s
no {0} {1}s
timers bgpstimers bgp {0} {1}R%R'tsizet_srouter bgp {0}R4R6svrf {0}Rf(tlistRnR9titemsRCR]R@R>tPARAM_TO_DEFAULT_KEYMAPR:tjoint
startswithtreplacetfix_commandsRZtadd(
R^Ratproposedt	candidatetcommandstproposed_commandstexisting_commandsRlR8t
default_valuetexisting_valueRHRf((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pyt
state_present�sZ	
# cCs�g}g}|jddkr?|jdj|jd��nU|jd�|jdkr�|jdj|jd��dj|jd�g}n|j|d|�dS(NR6RTsno router bgp {0}R4s
no vrf {0}srouter bgp {0}Rf(RZR]R>R:Ry(R^RaR{R|Rf((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pytstate_absent�s cCsOd}d}d}xM|D]E}d|kr4|}qd|krI|}qd|kr|}qqW|r|rd|kr�|j|j|��|j|j|��|j|�|j|�q|j|j|��|j|j|��|j|�|j|�n|rK|rK|rd|kr�|j|j|��|j|j|��|j|j|��|j|�|j|�|j|�qH|j|j|��|j|j|��|j|j|��|j|�|j|�|j|�qK|j|j|��|j|j|��|j|�|j|�n|S(NR.slocal-assconfederation identifiersconfederation peerstno(tpoptindexR](R|tlocal_as_commandtconfederation_id_commandtconfederation_peers_commandRH((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pyRx�sP
		







cWs!tdtdtdd�dtdtdddd�dtdtdd�d	tdtdd�d
tdtdd�dtdtdd�dtdtdd�d
tdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtdd�dtdtddddddddg�d tdtddddddddg�d!tdtddddddddg�d"tdtddddddddg�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�d0tdtdd�d1tdtdd�d2tdtdd�d3tdtdd�d4tdtdd�d5tdd6d7gdd6dt��(}|jt�td8|d9d3d4ggd:t�}t�}t||�td;td<|�}|jd5}|jddkrzxDt	D]9}|j|r:|j
d=d>d|jdd?|�q:q:Wntj��t
|�|�}|jd�r|d6kr|jd�|jdkr|j
d=d@dA|jddB|jd��qnt�fdC�|jj�D��}i}x5|j�D]'\}	}
|	dJkr9t|
�j�dkr~tj|	d�}
n|	dkr;|
dDdkr�|j|	�r8d||	<q8q]tg|
D]}t|�^q��}tg|j|	�D]}t|�^q��}
||
kr]dEjdF�|D��||	<q]q`|j|	�|
kr`|
||	<q`q9q9WtdGdH�}|d6kr�t||||�n/|jd�|jdkr�t|||�n|r|j�}|js�t||�nt|d;<||dI<n
g|dI<|j|�dS(KNR4trequiredttypeRYR6RTRtboolRR
RRRRRR1R3R5RrRRRRR tchoicesttruetfalseR7tsize_mediumt
size_largetsize_disableR!R"R#RRRRR+R,RR2RR/RR-R0RRR)R'R%RURVtabsentt
argument_spectrequired_togethertsupports_check_modetchangedR`Rgs7Global params can be modified only under "default" VRF.tglobal_paramsAnother BGP ASN already exists.tproposed_asnRSc3s9|]/\}}|dk	r|�kr||fVqdS(N(tNone(t.0tktv(R_(sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pys	<genexpr>qs	iRocss|]}t|�VqdS(N(RY(R�ts((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pys	<genexpr>�sRPiR|(R4R6(tdictRCR@tupdateRR	RrRRZR\t	fail_jsonR9tkeysRhR:RsRYtlowerRttsettintRuR
R�R�t
items_textt
check_modeRt	exit_json(R�R^R`tresultRUtparamRat
proposed_argsRzRlR8tiR�texR{((R_sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pytmain*s�****$
		





%%.#	


t__main__(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR<t&ansible.module_utils.network.nxos.nxosRRRRtansible.module_utils.basicR	t*ansible.module_utils.network.common.configR
RDR\RCR@RtR9RORhRnR�R�RxR�t__name__(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_bgp.pyt<module>s�


�
		

	1	"	
	6		2	m

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