Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/netvisor/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterbgp.pyo

�
�Udac@s�dZidd6dgd6dd6ZdZdZd	Zd
dlZd
dlmZda	da
d
�Zd�Zd�Z
d�Zd�Zedkr�e�ndS(s> PN-CLI vrouter-bgp-add/vrouter-bgp-remove/vrouter-bgp-modify s1.1tmetadata_versiont
deprecatedtstatust	communitytsupported_bys�

---
module: pn_vrouterbgp
author: "Pluribus Networks (@amitsi)"
version_added: "2.2"
short_description: CLI command to add/remove/modify vrouter-bgp.
deprecated:
  removed_in: '2.12'
  why: Doesn't support latest Pluribus Networks netvisor
  alternative: Latest modules will be pushed in Ansible future versions.
description:
  - Execute vrouter-bgp-add, vrouter-bgp-remove, vrouter-bgp-modify command.
  - Each fabric, cluster, standalone switch, or virtual network (VNET) can
    provide its tenants with a vRouter service that forwards traffic between
    networks and implements Layer 4 protocols.
options:
  pn_cliusername:
    description:
      - Provide login username if user is not root.
    required: False
  pn_clipassword:
    description:
      - Provide login password if user is not root.
    required: False
  pn_cliswitch:
    description:
      - Target switch(es) to run the cli on.
    required: False
    default: 'local'
  state:
    description:
      - State the action to perform. Use 'present' to add bgp,
        'absent' to remove bgp and 'update' to modify bgp.
    required: True
    choices: ['present', 'absent', 'update']
  pn_vrouter_name:
    description:
      - Specify a name for the vRouter service.
    required: True
  pn_neighbor:
    description:
      - Specify a neighbor IP address to use for BGP.
      - Required for vrouter-bgp-add.
  pn_remote_as:
    description:
      - Specify the remote Autonomous System(AS) number. This value is between
        1 and 4294967295.
      - Required for vrouter-bgp-add.
  pn_next_hop_self:
    description:
      - Specify if the next-hop is the same router or not.
    type: bool
  pn_password:
    description:
      - Specify a password, if desired.
  pn_ebgp:
    description:
      - Specify a value for external BGP to accept or attempt BGP connections
        to external peers, not directly connected, on the network. This is a
        value between 1 and 255.
  pn_prefix_listin:
    description:
      - Specify the prefix list to filter traffic inbound.
  pn_prefix_listout:
    description:
      - Specify the prefix list to filter traffic outbound.
  pn_route_reflector:
    description:
      - Specify if a route reflector client is used.
    type: bool
  pn_override_capability:
    description:
      - Specify if you want to override capability.
    type: bool
  pn_soft_reconfig:
    description:
      - Specify if you want a soft reconfiguration of inbound traffic.
    type: bool
  pn_max_prefix:
    description:
      - Specify the maximum number of prefixes.
  pn_max_prefix_warn:
    description:
      - Specify if you want a warning message when the maximum number of
        prefixes is exceeded.
    type: bool
  pn_bfd:
    description:
      - Specify if you want BFD protocol support for fault detection.
    type: bool
  pn_multiprotocol:
    description:
      - Specify a multi-protocol for BGP.
    choices: ['ipv4-unicast', 'ipv6-unicast']
  pn_weight:
    description:
      - Specify a default weight value between 0 and 65535 for the neighbor
        routes.
  pn_default_originate:
    description:
      - Specify if you want announce default routes to the neighbor or not.
    type: bool
  pn_keepalive:
    description:
      - Specify BGP neighbor keepalive interval in seconds.
  pn_holdtime:
    description:
      - Specify BGP neighbor holdtime in seconds.
  pn_route_mapin:
    description:
      - Specify inbound route map for neighbor.
  pn_route_mapout:
    description:
      - Specify outbound route map for neighbor.
s�
- name: add vrouter-bgp
  pn_vrouterbgp:
    state: 'present'
    pn_vrouter_name: 'ansible-vrouter'
    pn_neighbor: 104.104.104.1
    pn_remote_as: 1800

- name: remove vrouter-bgp
  pn_vrouterbgp:
    state: 'absent'
    pn_name: 'ansible-vrouter'
s�
command:
  description: The CLI command run on the target node(s).
  returned: always
  type: str
stdout:
  description: The set of responses from the vrouterbpg command.
  returned: always
  type: list
stderr:
  description: The set of error responses from the vrouterbgp command.
  returned: on error
  type: list
changed:
  description: Indicates whether the CLI caused changes on the target.
  returned: always
  type: bool
i����N(t
AnsibleModulecCsw|jd}|jd}|jd}|rF|rFd||f}nd}|dkre|d7}n|d|7}|S(	s
    This method is to generate the cli portion to launch the Netvisor cli.
    It parses the username, password, switch parameters from module.
    :param module: The Ansible module to fetch username, password and switch
    :return: returns the cli string for further processing
    tpn_cliusernametpn_clipasswordtpn_cliswitchs"/usr/bin/cli --quiet --user %s:%s s/usr/bin/cli --quiet tlocals switch-local s switch (tparams(tmoduletusernametpasswordt	cliswitchtcli((sS/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterbgp.pytpn_cli�s



cCs�|jd}|jd}|d}tj|�}|j|�d}|j�}||krgtanta|d|}|d7}tj|�}|j|�d}|j�}||kr�tantadS(s�
    This method checks if vRouter exists on the target node.
    This method also checks for idempotency using the vrouter-bgp-show command.
    If the given vRouter exists, return VROUTER_EXISTS as True else False.
    If a BGP neighbor with the given ip exists on the given vRouter,
    return NEIGHBOR_EXISTS as True else False.

    :param module: The Ansible module to fetch input parameters
    :param cli: The CLI string
    :return Global Booleans: VROUTER_EXISTS, NEIGHBOR_EXISTS
    tpn_vrouter_nametpn_neighbors* vrouter-show format name no-show-headers is" vrouter-bgp-show vrouter-name %s sformat neighbor no-show-headersN(R
tshlextsplittrun_commandtTruetVROUTER_EXISTStFalsetNEIGHBOR_EXISTS(RRtvrouter_nametneighbort
check_vroutertouttshow((sS/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterbgp.pyt	check_cli�s"


	
	c
	Cs�|jd}|jd}t|�}tj|�}|j|�\}}}|j|�d}	|dkr�|jd|	d|j�dd|d	t�n|r�|jd|	d
|j�dd|d	t�n |jd|	dd|d	t�dS(
s
    This method executes the cli command on the target node(s) and returns the
    output. The module then exits based on the output.
    :param cli: the complete cli string to be executed on the target node(s).
    :param module: The Ansible module to fetch command
    Rtstateiitcommandtstderrtmsgs%s operation failedtchangedtstdouts%s operation completedN(	R
tget_command_from_stateRRRt	exit_jsontstripRR(
RRRR R!tcmdtresultRterrt	print_cli((sS/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterbgp.pytrun_cli�s,

	

	

	
cCsId}|dkrd}n|dkr0d}n|dkrEd}n|S(s�
    This method gets appropriate command name for the state specified. It
    returns the command name for the specified state.
    :param state: The state for which the respective command name is required.
    tpresentsvrouter-bgp-addtabsentsvrouter-bgp-removetupdatesvrouter-bgp-modifyN(tNone(R R!((sS/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterbgp.pyR&$s			c7Cs�tdtdtdtdd�dtdtdddt�dtdtddd	d
�dtdtdddd
ddg�dtdtdd�dtdd�dtdd�dtdd�dtdddt�dtdd�dtdd�dtdd�dtdd�dtdd�dtdd�dtdd�dtdd�dtdd�d tdddd!d"g�d#tdd�d$tdd�d%tdd�d&tdd�d'tdd�d(tdd��d)dd
dddggddddggddddggf�}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd}	|jd}
|jd}|jd}|jd}
|jd}|jd}|jd }|jd#}|jd$}|jd%}|jd&}|jd'}|jd(}t|�}t|�}|d*kr�t||�ttkr�|j	d+td,d-|�nt
tkr�|j	d+td,d.||f�n|d/|||f7}n|d0krHt||�ttkr|j	d+td,d-|�nt
tkrH|j	d+td,d1||f�qHn|d/|||f7}|r||d2t|�7}n|tkr�|d37}n|tkr�|d47}n|r�|d5|7}n|r�|d6t|�7}n|r�|d7|7}n|	r|d8|	7}n|
tkr)|d97}n|
tkrB|d:7}n|tkr[|d;7}n|tkrt|d<7}n|tkr�|d=7}n|tkr�|d>7}n|
r�|d?t|
�7}n|tkr�|d@7}n|tkr�|dA7}n|tkr|dB7}n|tkr'|dC7}n|r>|dD|7}n|r[|dEt|�7}n|tkrt|dF7}n|tkr�|dG7}n|r�|dH|7}n|r�|dI|7}n|r�|dJ|7}n|r�|dK|7}nt||�dLS(Ms' This portion is for arguments parsing t
argument_specRtrequiredttypetstrRtno_logRtdefaultR	R tchoicesR.R/R0RRtpn_remote_astpn_next_hop_selftbooltpn_passwordtpn_ebgptinttpn_prefix_listintpn_prefix_listouttpn_route_reflectortpn_override_capabilitytpn_soft_reconfigt
pn_max_prefixtpn_max_prefix_warntpn_bfdtpn_multiprotocolsipv4-unicastsipv6-unicastt	pn_weighttpn_default_originatetpn_keepalivetpn_holdtimetpn_route_mapintpn_route_mapouttrequired_ifsvrouter-bgp-removetskippedR#svRouter %s does not exists,BGP neighbor with IP %s does not exist on %ss  %s vrouter-name %s neighbor %s svrouter-bgp-adds,BGP neighbor with IP %s already exists on %ss remote-as s next-hop-self s no-next-hop-self s
 password s ebgp-multihop s prefix-list-in s prefix-list-out s route-reflector-client s no-route-reflector-client s override-capability s no-override-capability s soft-reconfig-inbound s no-soft-reconfig-inbound s max-prefix s max-prefix-warn-only s no-max-prefix-warn-only s bfd s no-bfd s multi-protocol s weight s default-originate s no-default-originate s neighbor-keepalive-interval s neighbor-holdtime s route-map-in s route-map-out N(
RtdictRRR
RR&RRR'RR5R-(RR RRt	remote_ast
next_hop_selfR
tebgpt
prefix_listintprefix_listouttroute_reflectortoverride_capabilityt
soft_reconfigt
max_prefixtmax_prefix_warntbfdt
multiprotocoltweighttdefault_originatet	keepalivetholdtimetroute_mapintroute_mapoutRR!((sS/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterbgp.pytmain4s






















		
		













t__main__(t__doc__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils.basicRR1RRRRR-R&Rct__name__(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterbgp.pyt<module>s"


u		)	,		�

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