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

�
�Udac@s�dZidd6dgd6dd6ZdZdZd	Zd
dlZd
dlmZda	d
�Z
d�Zd�Zd�Z
d�Zedkr�e�ndS(s, PN CLI vlag-create/vlag-delete/vlag-modify s1.1tmetadata_versiont
deprecatedtstatust	communitytsupported_bys�

---
module: pn_vlag
author: "Pluribus Networks (@amitsi)"
version_added: "2.2"
short_description: CLI command to create/delete/modify vlag.
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 vlag-create/vlag-delete/vlag-modify command.
  - A virtual link aggregation group (VLAG) allows links that are physically
    connected to two different Pluribus Networks devices to appear as a single
    trunk to a third device. The third device can be a switch, server, or any
    Ethernet device. A VLAG can provide Layer 2 multipathing, which allows you
    to create redundancy by increasing bandwidth, enabling multiple parallel
    paths between nodes and loadbalancing traffic where alternative paths exist.
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 this command on.
    default: 'local'
  state:
    description:
      - State the action to perform. Use 'present' to create vlag,
        'absent' to delete vlag and 'update' to modify vlag.
    required: True
    choices: ['present', 'absent', 'update']
  pn_name:
    description:
      - The C(pn_name) takes a valid name for vlag configuration.
    required: true
  pn_port:
    description:
      - Specify the local VLAG port.
      - Required for vlag-create.
  pn_peer_port:
    description:
      - Specify the peer VLAG port.
      - Required for vlag-create.
  pn_mode:
    description:
      - Specify the mode for the VLAG. Active-standby indicates one side is
        active and the other side is in standby mode. Active-active indicates
        that both sides of the vlag are up by default.
    choices: ['active-active', 'active-standby']
  pn_peer_switch:
    description:
      - Specify the fabric-name of the peer switch.
  pn_failover_action:
    description:
      - Specify the failover action as move or ignore.
    choices: ['move', 'ignore']
  pn_lacp_mode:
    description:
      - Specify the LACP mode.
    choices: ['off', 'passive', 'active']
  pn_lacp_timeout:
    description:
      - Specify the LACP timeout as slow(30 seconds) or fast(4 seconds).
    choices: ['slow', 'fast']
  pn_lacp_fallback:
    description:
      - Specify the LACP fallback mode as bundles or individual.
    choices: ['bundle', 'individual']
  pn_lacp_fallback_timeout:
    description:
      - Specify the LACP fallback timeout in seconds. The range is between 30
        and 60 seconds with a default value of 50 seconds.
s
- name: create a VLAG
  pn_vlag:
    state: 'present'
    pn_name: spine-to-leaf
    pn_port: 'spine01-to-leaf'
    pn_peer_port: 'spine02-to-leaf'
    pn_peer_switch: spine02
    pn_mode: 'active-active'

- name: delete VLAGs
  pn_vlag:
    state: 'absent'
    pn_name: spine-to-leaf
s�
command:
  description: The CLI command run on the target node(s).
  returned: always
  type: str
stdout:
  description: The set of responses from the vlag command.
  returned: always
  type: list
stderr:
  description: The set of error responses from the vlag 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((sM/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vlag.pytpn_cli�s



cCsd|jd}|d}tj|�}|j|�d}|j�}||krZtantadS(s
    This method checks for idempotency using the vlag-show command.
    If a vlag with given vlag exists, return VLAG_EXISTS as True else False.
    :param module: The Ansible module to fetch input parameters
    :param cli: The CLI string
    :return Global Booleans: VLAG_EXISTS
    tpn_names& vlag-show format name no-show-headersiN(R
tshlextsplittrun_commandtTruetVLAG_EXISTStFalse(RRtnametshowtout((sM/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vlag.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(
RRRRRtcmdtresultRterrt	print_cli((sM/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vlag.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.
    tpresentsvlag-createtabsentsvlag-deletetupdatesvlag-modifyN(tNone(RR((sM/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vlag.pyR"�s			c"Cs�tdtdtdtdd�dtdtdddt�dtdtddd	d
�dtdtdddd
ddg�dtdtdd�dtdd�dtdd�dtdddddg�dtdd�dtdddddg�dtddddddg�dtddddd g�d!tdddd"d#g�d$tdd��d%dd
ddddggdddggdddggf�}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd}	|jd!}
|jd$}t|�}t|�}
|d&kr�t||
�ttkr�|j	d'td(d)|�n|
d*||f7}
n|d+kr�t||
�ttkr�|j	d'td(d,|�q�n|
d*||f7}
|r|
d-||f7}
n|r%|
d.|7}
n|r<|
d/|7}
n|rW|
d0|d17}
n|rn|
d2|7}
n|	r�|
d3|	7}
n|
r�|
d4|
7}
n|r�|
d5|7}
nt
||
�d6S(7s& This section is for argument parsing t
argument_specRtrequiredttypetstrRtno_logRtdefaultR	RtchoicesR*R+R,Rtpn_porttpn_peer_porttpn_modesactive-standbys
active-activetpn_peer_switchtpn_failover_actiontmovetignoretpn_lacp_modetofftpassivetactivetpn_lacp_timeouttslowtfasttpn_lacp_fallbacktbundlet
individualtpn_lacp_fallback_timeouttrequired_ifsvlag-deletetskippedRs VLAG with name %s does not exists %s name %s svlag-creates VLAG with name %s already existss port %s peer-port %s s mode s
 peer-switch s
 failover-s-L2 s lacp-mode s lacp-timeout s lacp-fallback s lacp-fallback-timeout N(RtdictRRR
R"RRRR#R)(RRRtportt	peer_porttmodetpeer_switchtfailover_actiont	lacp_modetlacp_timeoutt
lacp_fallbacktlacp_fallback_timeoutRR((sM/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vlag.pytmain�s�	











	
	t__main__(t__doc__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils.basicRR-RRRR)R"RSt__name__(((sM/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_vlag.pyt<module>s 


Q			,		a

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