Anons79 Mini Shell

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

�
�Udac@s�idd6dgd6dd6ZdZdZdZd	d
lmZd	dlmZmZm	Z	de
fd
��YZd�Ze
dkr�e�ndS(s1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys~
---
module: ce_snmp_contact
version_added: "2.4"
short_description: Manages SNMP contact configuration on HUAWEI CloudEngine switches.
description:
    - Manages SNMP contact configurations on HUAWEI CloudEngine switches.
author:
    - wangdezhuang (@QijunPan)
notes:
    - Recommended connection is C(network_cli).
    - This module also works with C(local) connections for legacy playbooks.
options:
    contact:
        description:
            - Contact information.
        required: true
    state:
        description:
            - Manage the state of the resource.
        default: present
        choices: ['present','absent']
sG

- name: CloudEngine snmp contact test
  hosts: cloudengine
  connection: local
  gather_facts: no
  vars:
    cli:
      host: "{{ inventory_hostname }}"
      port: "{{ ansible_ssh_port }}"
      username: "{{ username }}"
      password: "{{ password }}"
      transport: cli

  tasks:

  - name: "Config SNMP contact"
    ce_snmp_contact:
      state: present
      contact: call Operator at 010-99999999
      provider: "{{ cli }}"

  - name: "Undo SNMP contact"
    ce_snmp_contact:
      state: absent
      contact: call Operator at 010-99999999
      provider: "{{ cli }}"
s�
changed:
    description: check to see if a change was made on the device
    returned: always
    type: bool
    sample: true
proposed:
    description: k/v pairs of parameters passed into module
    returned: always
    type: dict
    sample: {"contact": "call Operator at 010-99999999",
             "state": "present"}
existing:
    description: k/v pairs of existing aaa server
    returned: always
    type: dict
    sample: {}
end_state:
    description: k/v pairs of aaa params after module execution
    returned: always
    type: dict
    sample: {"contact": "call Operator at 010-99999999"}
updates:
    description: command sent to the device
    returned: always
    type: list
    sample: ["snmp-agent sys-info contact call Operator at 010-99999999"]
i����(t
AnsibleModule(texec_commandtload_configtce_argument_spectSnmpContactcBsteZdZd�Zd�Zdd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZRS(
s$ Manages SNMP contact configuration cKs�|d}||_td|jdt�|_t�|_|jjd|_|jjd|_t	|_
t�|_t�|_
t�|_t�|_t�|_dS(s Class init t
argument_spectsupports_check_modetstatetcontactN(tspecRtTruetmoduletdicttcur_cfgtparamsRR
tFalsetchangedtlisttupdates_cmdtresultstproposedtexistingt	end_state(tselftkwargsR
((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyt__init__ps
		cCsj|jrSt|j�dks3t|j�dkrf|jjdd|j�qfn|jjdd�dS(s Check invalid args i�itmsgs1Error: The len of contact %s is out of [1 - 255].sError: The len of contact is 0.N(R
tlenRt	fail_json(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyt
check_args�s	*cCs�|dkrgn|}d}|dj|�7}|j�}t|j|�\}}}|dkrz|jjd|�nt|�j�}|S(s>Retrieves the current config from the device or cache
        sdisplay current-configuration t iRN(tNonetjointstripRRR!tstr(Rtflagstcmdtrctoutterrtcfg((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyt
get_config�scCs0|j|jd<|jr,|j|jd<ndS(s Get proposed state RR
N(RRR
(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pytget_proposed�s	cCs_|j�}|r[|jd�}t|�dkr[|d|jd<|d|jd<q[ndS(s Get existing state scontact iR
N(tcli_get_configtsplitR RR(Rttmp_cfgt	temp_data((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pytget_existing�scCsN|j�}|rJ|jd�}t|�dkrJ|d|jd<qJndS(s Get end state scontact iR
N(R0R1R R(RR2R3((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyt
get_end_state�s
cCs#|jjst|j|�ndS(s Load configure by cli N(Rt
check_modeR(Rtcommands((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pytcli_load_config�scCs/d}t�}|j|�|j|�}|S(s Get configure by cli s | include snmp | include contact(RtappendR.(RtregularR(R2((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyR0�s
	
cCsMd|j}|jj|�t�}|j|�|j|�t|_dS(s Set configure by cli ssnmp-agent sys-info contact %sN(R
RR9RR8RR(RR)tcmds((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyt
set_config�s
	

cCsFd}|jj|�t�}|j|�|j|�t|_dS(s Undo configure by cli s undo snmp-agent sys-info contactN(RR9RR8RR(RR)R;((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pytundo_config�s	

cCs|j�|j�|j�|jdkrhd|jj�kr[|j|jdkr[q�|j�n8d|jj�kr�|j|jdkr�|j�n|j	�|j
|jd<|j|jd<|j
|jd<|j|jd<|j|jd<|jj|j�dS(	s Main work function tpresentR
RRRRtupdatesN(R"R/R4RRtkeysR
R<R=R5RRRRRRRt	exit_json(R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pytwork�s 


+
+

N(t__name__t
__module__t__doc__RR"R$R.R/R4R5R8R0R<R=RB(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyR	ms				
				
		c	Csctdtdddgdd�dtddd	t��}|jt�td
|�}|j�dS(s
 Module main RtchoicesR>tabsenttdefaultR
ttypeR'trequiredR
N(RRtupdateRR	RB(R
R((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pytmains
t__main__N(tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt+ansible.module_utils.network.cloudengine.ceRRRtobjectR	RLRC(((sW/usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_contact.pyt<module>s


�	


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