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

�
�Udac@s�dZidd6dgd6dd6ZdZdZd	Zd
dlZd
dlmZda	da
d
ZdZd�Z
d�Zd�Zd�Zd�Zedkr�e�ndS(s. PN CLI vrouter-loopback-interface-add/remove s1.1tmetadata_versiont
deprecatedtstatust	communitytsupported_bys�
---
module: pn_vrouterlbif
author: "Pluribus Networks (@amitsi)"
version_added: "2.2"
short_description: CLI command to add/remove vrouter-loopback-interface.
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-loopback-interface-add, vrouter-loopback-interface-remove
    commands.
  - Each fabric, cluster, standalone switch, or virtual network (VNET) can
    provide its tenants with a virtual router (vRouter) service that forwards
    traffic between networks and implements Layer 3 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 vrouter loopback
        interface and 'absent' to remove vrouter loopback interface.
    required: True
    choices: ['present', 'absent']
  pn_vrouter_name:
    description:
      - Specify the name of the vRouter.
    required: True
  pn_index:
    description:
      - Specify the interface index from 1 to 255.
  pn_interface_ip:
    description:
      - Specify the IP address.
    required: True
s8
- name: add vrouter-loopback-interface
  pn_vrouterlbif:
    state: 'present'
    pn_vrouter_name: 'ansible-vrouter'
    pn_interface_ip: '104.104.104.1'

- name: remove vrouter-loopback-interface
  pn_vrouterlbif:
    state: 'absent'
    pn_vrouter_name: 'ansible-vrouter'
    pn_interface_ip: '104.104.104.1'
s�
command:
  description: The CLI command run on the target node(s).
  returned: always
  type: str
stdout:
  description: The set of responses from the vrouterlb command.
  returned: always
  type: list
stderr:
  description: The set of error responses from the vrouterlb command.
  returned: on error
  type: list
changed:
  description: Indicates whether the CLI caused changes on the target.
  returned: always
  type: bool
i����N(t
AnsibleModuleii�cCsw|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((sT/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterlbif.pytpn_clixs



cCs�|jd}|jd}|d}tj|�}|j|�d}|j�}||krgtanta|d|}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-loopback-interface-show command.
    If the given vRouter exists, return VROUTER_EXISTS as True else False.
    If a loopback interface with the given ip exists on the given vRouter,
    return LB_INTERFACE_EXISTS as True else False.

    :param module: The Ansible module to fetch input parameters
    :param cli: The CLI string
    :return Global Booleans: VROUTER_EXISTS, LB_INTERFACE_EXISTS
    tpn_vrouter_nametpn_interface_ips* vrouter-show format name no-show-headers isJ vrouter-loopback-interface-show vrouter-name %s format ip no-show-headersN(R
tshlextsplittrun_commandtTruetVROUTER_EXISTStFalsetLB_INTERFACE_EXISTS(RRtvrouter_nametinterface_ipt
check_vroutertouttshow((sT/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterlbif.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((sT/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterlbif.pytrun_cli�s,

	

	

	
cCs4d}|dkrd}n|dkr0d}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-loopback-interface-addtabsents!vrouter-loopback-interface-removeN(tNone(R R!((sT/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterlbif.pyR&�s		c	Cstdtdtdtdd�dtdtdddt�dtdtddd	d
�dtdtdddd
dg�dtdtdd�dtdd�dtdd��ddd
ddggddddggf�}|jd}|jd}|jd}|jd}t|�}t|�}|rqt|koDtknsb|j	dddt�nt
|�}n|dkr[t||�ttkr�|j	dtdd|�nt
tkr�|j	dtdd||f�n|sA|}|d||f7}|d7}tj|�}|j|�d}|j�d}n|d|||f7}n|dkr�t||�ttkr�|j	dtdd|�nt
tkr�|j	dtdd ||f�n|d!|||f7}|r�|d"|7}q�nt||�d#S($s' This portion is for arguments parsing t
argument_specRtrequiredttypetstrRtno_logRtdefaultR	R tchoicesR.R/RRtpn_indextinttrequired_ifR#sIndex must be between 1 and 255R$s!vrouter-loopback-interface-removetskippedsvRouter %s does not exists2Loopback interface with IP %s does not exist on %ss7 vrouter-loopback-interface-show vrouter-name %s ip %s sformat index no-show-headersis %s vrouter-name %s index %ssvrouter-loopback-interface-adds2Loopback interface with IP %s already exists on %ss %s vrouter-name %s ip %ss
 index %s N(RtdictRRR
R&Rt	MIN_INDEXt	MAX_INDEXR'R4RRRRRRR-(	RR RRtindexR!Rt	get_indexR((sT/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterlbif.pytmain�s|



	

		

		t__main__(t__doc__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils.basicRR0RRR=R>RRR-R&RAt__name__(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vrouterlbif.pyt<module>s&


2		+	,		Y

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