Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/remote_management/cpm/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_serial_port_config.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZmZmZddlmZmZddlmZmZmZd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�

---
module: cpm_serial_port_config
version_added: "2.9"
author: "Western Telematic Inc. (@wtinetworkgear)"
short_description: Set Serial port parameters in WTI OOB and PDU devices
description:
    - "Set Serial port parameters in WTI OOB and PDU devices"
options:
  cpm_url:
    description:
      - This is the URL of the WTI device to send the module.
    required: true
  cpm_username:
    description:
      - This is the Username of the WTI device to send the module.
    required: true
  cpm_password:
    description:
      - This is the Password of the WTI device to send the module.
    required: true
  use_https:
    description:
      - Designates to use an https connection or http connection.
    required: false
    type: bool
    default: true
  validate_certs:
    description:
      - If false, SSL certificates will not be validated. This should only be used
      - on personally controlled sites using self-signed certificates.
    required: false
    type: bool
    default: true
  use_proxy:
    description: Flag to control if the lookup will observe HTTP proxy environment variables when present.
    required: false
    type: bool
    default: false
  port:
    description:
      - This is the port number that is getting the action performed on.
    required: true
    type: int
  portname:
    description:
      - This is the Name of the Port that is displayed.
    required: false
  baud:
    description:
      - This is the baud rate to assign to the port.
      - 0=300, 1=1200, 2=2400, 3=4800, 4=9600, 5=19200, 6=38400, 7=57600, 8=115200, 9=230400, 10=460800
    required: false
    choices: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
  handshake:
    description:
      - This is the handshake to assign to the port, 0=None, 1=XON/XOFF, 2=RTS/CTS, 3=Both.
    required: false
    choices: [ 0, 1, 2, 3 ]
  stopbits:
    description:
      - This is the stop bits to assign to the port, 0=1 Stop Bit, 1=2 Stop Bit.
    required: false
    choices: [ 0, 1 ]
  parity:
    description:
      - This is the parity to assign to the port, 0=7-None, 1=7-Even, 2=7-Odd, 3=8-None, 4=8-Even, 5=8-Odd.
    required: false
    choices: [ 0, 1, 2, 3, 4, 5 ]
  mode:
    description:
      - This is the port mode to assign to the port, 0=Any-to-Any. 1=Passive, 2=Buffer, 3=Modem, 4=ModemPPP.
    required: false
    choices: [ 0, 1, 2, 3, 4 ]
  cmd:
    description:
      - This is the Admin Mode to assign to the port, 0=Deny, 1=Permit.
    required: false
    choices: [ 0, 1 ]
  seq:
    description:
      - This is the type of Sequence Disconnect to assign to the port, 0=Three Characters (before and after), 1=One Character Only, 2=Off
    required: false
    choices: [ 1, 2, 3 ]
  tout:
    description:
      - This is the Port Activity Timeout to assign to the port, 0=Off, 1=5 Min, 2=15 Min, 3=30 Min, 4=90 Min, 5=1 Min.
    required: false
    choices: [ 0, 1, 2, 3, 4, 5 ]
  echo:
    description:
      -This is the command echo parameter to assign to the port, 0=Off, 1=On
    required: false
  break_allow:
    description:
      - This is if the break character is allowed to be passed through the port, 0=Off, 1=On
    required: false
  logoff:
    description:
      - This is the logout character to assign to the port
      - If preceded by a ^ character, the sequence will be a control character. Used if seq is set to 0 or 1
    required: false
notes:
  - Use C(groups/cpm) in C(module_defaults) to set common options used between CPM modules.
s!
# Set Serial Port Parameters
- name: Set the Port Parameters for port 2 of a WTI device
  cpm_serial_port_config:
    cpm_url: "nonexist.wti.com"
    cpm_username: "super"
    cpm_password: "super"
    use_https: true
    validate_certs: false
    port: "2"
    portname: "RouterLabel"
    baud: "7"
    handshake: "1"
    stopbits: "0"
    parity: "0"
    mode: "0"
    cmd: "0"
    seq: "1"
    tout: "1"
    echo: "0"
    break_allow: "0"
    logoff: "^H"

# Set Serial Port Port Name and Baud Rate Parameters
- name: Set New port name and baud rate (115k) for port 4 of a WTI device
  cpm_serial_port_config:
    cpm_url: "nonexist.wti.com"
    cpm_username: "super"
    cpm_password: "super"
    use_https: true
    validate_certs: false
    port: "4"
    portname: "NewPortName1"
    baud: "8"
sk
data:
    description: The output JSON returned from the commands sent
    returned: always
    type: str
N(t
AnsibleModule(tto_texttto_bytest	to_native(t	HTTPErrortURLError(topen_urltConnectionErrortSSLValidationErrorcC`s!d}dt|jd�}|jddk	r�|dddt|jd�kr�|dB}d|t|jd�f}q�n|jddk	r�|dddt|jd�kr�|d	B}d
|t|jd�f}q�n|jddk	rL|dddt|jd�krL|dB}d
|t|jd�f}qLn|jddk	r�|dddt|jd�kr�|dB}d|t|jd�f}q�n|jddk	r|dddt|jd�kr|dB}d|t|jd�f}qn|jddk	r{|dddt|jd�kr{|dB}d|t|jd�f}q{n|jddk	r�|dddt|jd�kr�|dB}d|t|jd�f}q�n|jddk	rE|dddt|jd�krE|dB}d|t|jd�f}qEn|jddk	r�|dddt|jd�kr�|dB}d|t|jd�f}q�n|jd dk	rt|ddd �t|jd �kr|d!B}d"|t|jd �f}qn|jd#dk	r�t|ddd$�t|jd#�kr�|d%B}d&|t|jd#�f}q�n|jd'dk	r�t|jd'�dkr�|ddd't|jd'�kr�|d(B}d)|t|jd'�f}q�nd*|}|dkrd}n|S(+Nis{"serialports":{"port": "%s"tporttportnametserialportsis%s,"portname": "%s"tbaudis
%s,"baud": %st	handshakeis%s,"handshake": %ststopbitsis%s,"stopbits": %stparityis%s,"parity": %stmodei s
%s,"mode": %stcmdi@s%s,"cmd": %stseqi�s%s,"seq": %sttoutis
%s,"tout": %stechois
%s,"echo": %dtbreak_allowtbreakis%s,"break": %dtlogoffis%s,"logoff": "%s"s%s}}(RtparamstNonetinttlen(t	cpmmoduletexisting_serialttotal_changet	json_load((s`/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_serial_port_config.pyt
assemble_json�sl%
#%
#%
#%
#%
#%
#%
#%
#%
#+
#+
#,%
#
	c+C`s�tdtdddt�dtdddt�dtdddtdt�dtdd	dt�d
tdddtdd�dtdd	dtddd
dddddddddddg�dtdd	dtddd
ddddg�dtdd	dtddd
ddg�dtdd	dtddd
ddddddg�dtdd	dtddd
dddddg�dtdd	dtddd
ddg�dtdd	dtddd
dddg�dtdd	dtddd
ddddddg�d tdd!dtdd�d"tdd!dt�d#tdddtdd�d$tdd!dt�d%tdd!dt�d&tdd!dt��}td'td(d)�}td*|d+t�}ttjtd,j	t
|jd�t
|jd��d-d.���}|jd$tkrd/}nd0}d1|t
|jd�t
|jd�f}d2}yNt|d(dd3|d%|jd%d&|jd&d4id5d66d7|d86�}Wnt
k
r�}td9d:j	|t
|��d't�}	|j|	�n�tk
r(}td9d;j	|t
|��d't�}	|j|	�n�tk
rn}td9d<j	|t
|��d't�}	|j|	�nGtk
r�}td9d=j	|t
|��d't�}	|j|	�nXtj|j��|d(<t||d(�}
|jr|
dk	r�t|d'<q�n�|
dk	r�d>|t
|jd�f}d?}yNt|d(|
d3|d%|jd%d&|jd&d4id5d66d7|d86�}Wnt
k
r�}td9d@j	|t
|��d't�}	|j|	�n�tk
r}td9dAj	|t
|��d't�}	|j|	�n�tk
rX}td9dBj	|t
|��d't�}	|j|	�nGtk
r�}td9dCj	|t
|��d't�}	|j|	�nXt|d'<tj|j��|d(<n|j|�dS(DNtcpm_urlttypetstrtrequiredtcpm_usernametcpm_passwordtno_logRR"RtdefaultRtchoicesiiiiiiiiii	i
RRRRRRRRtboolRRt	use_httpstvalidate_certst	use_proxytchangedtdatatt
argument_spectsupports_check_modes{0}:{1}terrorstsurrogate_or_strictshttps://shttp://s'%s%s/api/v2/config/serialports?ports=%stGETtmethodtheaderssapplication/jsonsContent-TypesBasic %st
Authorizationtmsgs&GET: Received HTTP error for {0} : {1}s$GET: Failed lookup url for {0} : {1}s;GET: Error validating the servers certificate for {0} : {1}s"GET: Error connecting to {0} : {1}s%s%s/api/v2/config/serialportstPOSTs'POST: Received HTTP error for {0} : {1}s%POST: Failed lookup url for {0} : {1}s<POST: Error validating the servers certificate for {0} : {1}s#POST: Error connecting to {0} : {1}(tdicttTruetFalseR!RR	tbase64t	b64encodeR
tformatRR RRt	fail_jsonR
RRtjsontloadstreadR(t
check_modet	exit_json(tmodule_argstresulttmoduletauthtprotocoltfullurlR>tresponseteRItpayload((s`/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_serial_port_config.pyt
run_module�s�B-'30'*3	8	-/''''	/''''
cC`st�dS(N(RX(((s`/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_serial_port_config.pytmainTst__main__(t
__future__RRRR*t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRFRJtansible.module_utils.basicRtansible.module_utils._textR	R
Rt+ansible.module_utils.six.moves.urllib.errorRR
tansible.module_utils.urlsRRRR(RXRYt__name__(((s`/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cpm/cpm_serial_port_config.pyt<module>s&

k$	=	]	

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