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

�
�Udac@s�dZidd6dgd6dd6ZdZdZd	Zd
dlZd
dlmZda	d
�Z
d�Zd�Zd�Z
d�Zedkr�e�ndS(s/ PN CLI trunk-create/trunk-delete/trunk-modify s1.1tmetadata_versiont
deprecatedtstatust	communitytsupported_bys@
---
module: pn_trunk
author: "Pluribus Networks (@amitsi)"
version_added: "2.2"
short_description: CLI command to create/delete/modify a trunk.
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 trunk-create or trunk-delete command.
  - Trunks can be used to aggregate network links at Layer 2 on the local
    switch. Use this command to create a new trunk.
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 create trunk,
        'absent' to delete trunk and 'update' to modify trunk.
    required: True
    choices: ['present', 'absent', 'update']
  pn_name:
    description:
      - Specify the name for the trunk configuration.
    required: true
  pn_ports:
    description:
      - Specify the port number(s) for the link(s) to aggregate into the trunk.
      - Required for trunk-create.
  pn_speed:
    description:
      - Specify the port speed or disable the port.
    choices: ['disable', '10m', '100m', '1g', '2.5g', '10g', '40g']
  pn_egress_rate_limit:
    description:
      - Specify an egress port data rate limit for the configuration.
  pn_jumbo:
    description:
      - Specify if the port can receive jumbo frames.
    type: bool
  pn_lacp_mode:
    description:
      - Specify the LACP mode for the configuration.
    choices: ['off', 'passive', 'active']
  pn_lacp_priority:
    description:
      - Specify the LACP priority. This is a number between 1 and 65535 with a
        default value of 32768.
  pn_lacp_timeout:
    description:
      - Specify the LACP time out as slow (30 seconds) or fast (4seconds).
        The default value is slow.
    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.
  pn_edge_switch:
    description:
      - Specify if the switch is an edge switch.
    type: bool
  pn_pause:
    description:
      - Specify if pause frames are sent.
    type: bool
  pn_description:
    description:
      - Specify a description for the trunk configuration.
  pn_loopback:
    description:
      - Specify loopback if you want to use loopback.
    type: bool
  pn_mirror_receive:
    description:
      - Specify if the configuration receives mirrored traffic.
    type: bool
  pn_unknown_ucast_level:
    description:
      - Specify an unknown unicast level in percent. The default value is 100%.
  pn_unknown_mcast_level:
    description:
      - Specify an unknown multicast level in percent. The default value is 100%.
  pn_broadcast_level:
    description:
      - Specify a broadcast level in percent. The default value is 100%.
  pn_port_macaddr:
    description:
      - Specify the MAC address of the port.
  pn_loopvlans:
    description:
      - Specify a list of looping vlans.
  pn_routing:
    description:
      - Specify if the port participates in routing on the network.
    type: bool
  pn_host:
    description:
      - Host facing port control setting.
    type: bool
s�
- name: create trunk
  pn_trunk:
    state: 'present'
    pn_name: 'spine-to-leaf'
    pn_ports: '11,12,13,14'

- name: delete trunk
  pn_trunk:
    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 trunk command.
  returned: always
  type: list
stderr:
  description: The set of error responses from the trunk 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((sN/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_trunk.pytpn_cli�s



cCsd|jd}|d}tj|�}|j|�d}|j�}||krZtantadS(s"
    This method checks for idempotency using the trunk-show command.
    If a trunk with given name exists, return TRUNK_EXISTS as True else False.
    :param module: The Ansible module to fetch input parameters
    :param cli: The CLI string
    :return Global Booleans: TRUNK_EXISTS
    tpn_names. trunk-show format switch,name no-show-headersiN(R
tshlextsplittrun_commandtTruetTRUNK_EXISTStFalse(RRtnametshowtout((sN/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_trunk.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((sN/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_trunk.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.
    tpresentstrunk-createtabsentstrunk-deletetupdatestrunk-modifyN(tNone(RR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_trunk.pyR"s			c9Cs�tdtdtdtdd�dtdtdddt�dtdtddd	d
�dtdtdddd
ddg�dtdtdd�dtdd�dtddddddddddg�dtdd�dtdd�dtdddddd g�d!tdd"�d#tdddd$d%g�d&tdddd'd(g�d)tdd�d*tdd�d+tdd�d,tdd�d-tdd�d.tdd�d/tdd�d0tdd�d1tdd�d2tdd�d3tdd�d4tdd�d5tdd��d6dd
ddggdddggdddggf�}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd!}|jd#}	|jd&}
|jd)}|jd*}|jd+}
|jd,}|jd-}|jd.}|jd/}|jd0}|jd1}|jd2}|jd3}|jd4}|jd5}t|�}t|�}|d7kr�t||�ttkr�|j	d8td9d:|�n|d;||f7}n�|d<kr*t||�ttkr*|j	d8td9d=|�q*n|d;||f7}|rU|d>|7}n|rl|d?|7}n|r�|d@|7}n|tkr�|dA7}n|tkr�|dB7}n|r�|dC|7}n|r�|dD|7}n|	r�|dE|	7}n|
r|dF|
7}n|r(|dG|7}n|tkrA|dH7}n|tkrZ|dI7}n|
tkrs|dJ7}n|
tkr�|dK7}n|r�|dL|7}n|tkr�|dM7}n|tkr�|dN7}n|tkr�|dO7}n|tkr|dP7}n|r|dQ|7}n|r5|dR|7}n|rL|dS|7}n|rc|dT|7}n|rz|dU|7}n|tkr�|dV7}n|tkr�|dW7}n|tkr�|dX7}n|tkr�|dY7}nt
||�dZS([s' This portion is for arguments parsing t
argument_specRtrequiredttypetstrRtno_logRtdefaultR	RtchoicesR*R+R,Rtpn_portstpn_speedtdisablet10mt100mt1gs2.5gt10gt40gtpn_egress_rate_limittpn_jumbotbooltpn_lacp_modetofftpassivetactivetpn_lacp_prioritytinttpn_lacp_timeouttslowtfasttpn_lacp_fallbacktbundlet
individualtpn_lacp_fallback_timeouttpn_edge_switchtpn_pausetpn_descriptiontpn_loopbacktpn_mirror_receivetpn_unknown_ucast_leveltpn_unknown_mcast_leveltpn_broadcast_leveltpn_port_macaddrtpn_loopvlanst
pn_routingtpn_hosttrequired_ifstrunk-deletetskippedRs!Trunk with name %s does not exists %s name %s strunk-creates!Trunk with name %s already existss ports s speed s egress-rate-limit s jumbo s
 no-jumbo s lacp-mode s lacp-priority s lacp-timeout s lacp-fallback s lacp-fallback-timeout s
 edge-switch s no-edge-switch s pause s
 no-pause s
 description s
 loopback s
 no-loopback s mirror-receive-only s no-mirror-receive-only s unknown-ucast-level s unknown-mcast-level s broadcast-level s port-mac-address s loopvlans s	 routing s no-routing s
 host-enable s host-disable N(RtdictRRR
R"RRRR#R)(RRRtportstspeedtegress_rate_limittjumbot	lacp_modet
lacp_prioritytlacp_timeoutt
lacp_fallbacktlacp_fallback_timeouttedge_switchtpausetdescriptiontloopbacktmirror_receivetunknown_ucast_leveltunknown_mcast_leveltbroadcast_leveltport_macaddrt	loopvlanstroutingthostRR((sN/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/_pn_trunk.pytmain"s






















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


w
			,		�

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