�
�Udac @ s� i d d 6d g d 6d d 6Z d Z d Z d Z d d
l m Z d d l m Z m Z m Z d d l
m Z d
e f d � � YZ
d � Z e d k r� e � n d S( s 1.1t metadata_versiont previewt statust communityt supported_bysq
---
module: ce_snmp_traps
version_added: "2.4"
short_description: Manages SNMP traps configuration on HUAWEI CloudEngine switches.
description:
- Manages SNMP traps 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:
feature_name:
description:
- Alarm feature name.
choices: ['aaa', 'arp', 'bfd', 'bgp', 'cfg', 'configuration', 'dad', 'devm',
'dhcpsnp', 'dldp', 'driver', 'efm', 'erps', 'error-down', 'fcoe',
'fei', 'fei_comm', 'fm', 'ifnet', 'info', 'ipsg', 'ipv6', 'isis',
'l3vpn', 'lacp', 'lcs', 'ldm', 'ldp', 'ldt', 'lldp', 'mpls_lspm',
'msdp', 'mstp', 'nd', 'netconf', 'nqa', 'nvo3', 'openflow', 'ospf',
'ospfv3', 'pim', 'pim-std', 'qos', 'radius', 'rm', 'rmon', 'securitytrap',
'smlktrap', 'snmp', 'ssh', 'stackmng', 'sysclock', 'sysom', 'system',
'tcp', 'telnet', 'trill', 'trunk', 'tty', 'vbst', 'vfs', 'virtual-perception',
'vrrp', 'vstm', 'all']
trap_name:
description:
- Alarm trap name.
interface_type:
description:
- Interface type.
choices: ['Ethernet', 'Eth-Trunk', 'Tunnel', 'NULL', 'LoopBack', 'Vlanif', '100GE',
'40GE', 'MTunnel', '10GE', 'GE', 'MEth', 'Vbdif', 'Nve']
interface_number:
description:
- Interface number.
port_number:
description:
- Source port number.
s�
- name: CloudEngine snmp traps 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 trap all enable"
ce_snmp_traps:
state: present
feature_name: all
provider: "{{ cli }}"
- name: "Config SNMP trap interface"
ce_snmp_traps:
state: present
interface_type: 40GE
interface_number: 2/0/1
provider: "{{ cli }}"
- name: "Config SNMP trap port"
ce_snmp_traps:
state: present
port_number: 2222
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: {"feature_name": "all",
"state": "present"}
existing:
description: k/v pairs of existing aaa server
returned: always
type: dict
sample: {"snmp-agent trap": [],
"undo snmp-agent trap": []}
end_state:
description: k/v pairs of aaa params after module execution
returned: always
type: dict
sample: {"snmp-agent trap": ["enable"],
"undo snmp-agent trap": []}
updates:
description: command sent to the device
returned: always
type: list
sample: ["snmp-agent trap enable"]
i����( t
AnsibleModule( t load_configt ce_argument_spect run_commands( t exec_commandt SnmpTrapsc B s� e Z d Z d � Z d d � Z d � Z d � Z d � Z d � Z d � Z
d � Z d � Z d
� Z
d � Z d � Z d
� Z d � Z d � Z RS( s! Manages SNMP trap configuration c K s} | d } | | _ t d | j d d g d t � | _ t � | _ g | j d <g | j d <| j j d | _ | j j d | _ | j j d
| _ | j j d | _
| j j d | _ | j j d | _ t
| _ t � | _ t � | _ t � | _ t � | _ g | j d <g | j d <t � | _ g | j d <g | j d <t � } d } | j | � t | j | � | _ d
S( s Class init t
argument_spect required_togethert interface_typet interface_numbert supports_check_modes snmp-agent traps undo snmp-agent trapt statet feature_namet trap_namet port_numbers display interface briefN( s interface_types interface_number( t specR t Truet modulet dictt cur_cfgt paramsR R R R
R R t Falset changedt listt updates_cmdt resultst proposedt existingt end_statet appendR t interface( t selft kwargsR t commandst cmd1( ( sU /usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_snmp_traps.pyt __init__� s:
c C s� | d k r g n | } d } | d j | � 7} | j � } t | j | � \ } } } | d k rz | j j d | � n t | � j � } | S( s>