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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
mZdd
lmZd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: pn_snmp_trap_sink
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.8"
short_description: CLI command to create/delete snmp-trap-sink
description:
  - This module can be used to create a SNMP trap sink and delete a SNMP trap sink.
options:
  pn_cliswitch:
    description:
      - Target switch to run the CLI on.
    required: false
    type: str
  state:
    description:
      - State the action to perform. Use C(present) to create snmp-trap-sink and
        C(absent) to delete snmp-trap-sink.
    required: true
    type: str
    choices: ['present', 'absent']
  pn_dest_host:
    description:
      - destination host.
    type: str
  pn_community:
    description:
      - community type.
    type: str
  pn_dest_port:
    description:
      - destination port.
    type: str
    default: '162'
  pn_type:
    description:
      - trap type.
    type: str
    choices: ['TRAP_TYPE_V1_TRAP', 'TRAP_TYPE_V2C_TRAP', 'TRAP_TYPE_V2_INFORM']
    default: 'TRAP_TYPE_V2C_TRAP'
s�
- name: snmp trap sink functionality
  pn_snmp_trap_sink:
    pn_cliswitch: "sw01"
    state: "present"
    pn_community: "foo"
    pn_type: "TRAP_TYPE_V2_INFORM"
    pn_dest_host: "192.168.67.8"

- name: snmp trap sink functionality
  pn_snmp_trap_sink:
    pn_cliswitch: "sw01"
    state: "absent"
    pn_community: "foo"
    pn_type: "TRAP_TYPE_V2_INFORM"
    pn_dest_host: "192.168.67.8"
s�
command:
  description: the CLI command run on the target node.
  returned: always
  type: str
stdout:
  description: set of responses from the snmp-trap-sink command.
  returned: always
  type: list
stderr:
  description: set of error responses from the snmp-trap-sink command.
  returned: on error
  type: list
changed:
  description: indicates whether the CLI caused changes on the target.
  returned: always
  type: bool
(t
AnsibleModule(tpn_clitrun_cli(trun_commandscC`s�|jd}|jd}|}|d7}t||�\}}}|rW|j�}n||kr�|}|d|7}t||�\}}}|r�|j�}n||kr�tStSdSdS(s�
    This method checks for idempotency using the snmp-trap-sink-show command.
    If a trap with given name exists, return True else False.
    :param module: The Ansible module to fetch input parameters
    :param cli: The CLI string
    tpn_communitytpn_dest_hosts< snmp-community-show format community-string no-show-headerssG snmp-trap-sink-show community %s format type,dest-host no-show-headersN(tparamsRtsplittTruetFalsetNone(tmoduletcliRt	dest_hosttshowtrctoutterr((sV/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_snmp_trap_sink.pyt	check_clics


cC`s�tdddd�}tdtdtdtdd	�d
tdtdd	d|j��dtdtdd	�d
tdtdd	�dtdtdd	dd�dtdtdd	ddddgdd��dd
dd
dggd
dd
dggf�}|jd}|jd
}|jd}|jd
}|jd}|jd}||}t||�}	t||	�}
|	d|7}	|dkr/|
tkr�|jdtdd�n|
d"kr�|j
dtdd�n|r�|	d|7}	n|r�|	d|7}	n|r|	d|7}	n|r/|	d|7}	q/n|dkr�|
d"kr`|j
dtdd �n|
tkr�|jdtdd!||f�n|r�|	d|7}	n|r�|	d|7}	n|r�|	d|7}	q�nt||	|�d"S(#s' This section is for arguments parsing tpresentssnmp-trap-sink-createtabsentssnmp-trap-sink-deletet
argument_spectpn_cliswitchtrequiredttypetstrtstatetchoicesR
Rtpn_dest_porttdefaultt162tpn_typetTRAP_TYPE_V1_TRAPtTRAP_TYPE_V2C_TRAPtTRAP_TYPE_V2_INFORMtrequired_ifs %s tskippedtmsgssnmp trap sink already existstfaileds2snmp community does not exists to create trap sinks type s dest-host s community s dest-port s2snmp community does not exists to delete trap sinksBsnmp-trap-sink with community %s does not exist with dest-host %s N(tdictRRRtkeysRR	Rt	exit_jsonRt	fail_jsonR
(t	state_mapRt	cliswitchR"RRt	dest_portR'tcommandRtVALUE_EXISTS((sV/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_snmp_trap_sink.pytmain�sz		






	
	
	
	t__main__N(t
__future__RRRR t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt-ansible.module_utils.network.netvisor.pn_nvosR	R
t.ansible.module_utils.network.netvisor.netvisorRRR8t__name__(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_snmp_trap_sink.pyt<module>s


+		U

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