�
�Udac @ s� i d d 6d g d 6d d 6Z d Z d Z d Z d d
l Z d d l m Z d d l m Z d d
l m
Z
m Z m Z m
Z
d Z d Z d Z d 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_bys,
---
module: ce_dldp
version_added: "2.4"
short_description: Manages global DLDP configuration on HUAWEI CloudEngine switches.
description:
- Manages global DLDP configuration on HUAWEI CloudEngine switches.
author:
- Zhijin Zhou (@QijunPan)
notes:
- The relevant configurations will be deleted if DLDP is disabled using enable=disable.
- When using auth_mode=none, it will restore the default DLDP authentication mode. By default,
DLDP packets are not authenticated.
- By default, the working mode of DLDP is enhance, so you are advised to use work_mode=enhance to restore default
DLDP working mode.
- The default interval for sending Advertisement packets is 5 seconds, so you are advised to use time_interval=5 to
restore default DLDP interval.
- This module requires the netconf system service be enabled on the remote device being managed.
- Recommended connection is C(netconf).
- This module also works with C(local) connections for legacy playbooks.
options:
enable:
description:
- Set global DLDP enable state.
choices: ['enable', 'disable']
work_mode:
description:
- Set global DLDP work-mode.
choices: ['enhance', 'normal']
time_internal:
description:
- Specifies the interval for sending Advertisement packets.
The value is an integer ranging from 1 to 100, in seconds.
The default interval for sending Advertisement packets is 5 seconds.
auth_mode:
description:
- Specifies authentication algorithm of DLDP.
choices: ['md5', 'simple', 'sha', 'hmac-sha256', 'none']
auth_pwd:
description:
- Specifies authentication password.
The value is a string of 1 to 16 case-sensitive plaintexts or 24/32/48/108/128 case-sensitive encrypted
characters. The string excludes a question mark (?).
reset:
description:
- Specify whether reset DLDP state of disabled interfaces.
choices: ['enable', 'disable']
sr
- name: DLDP 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: "Configure global DLDP enable state"
ce_dldp:
enable: enable
provider: "{{ cli }}"
- name: "Configure DLDP work-mode and ensure global DLDP state is already enabled"
ce_dldp:
enable: enable
work_mode: normal
provider: "{{ cli }}"
- name: "Configure advertisement message time interval in seconds and ensure global DLDP state is already enabled"
ce_dldp:
enable: enable
time_interval: 6
provider: "{{ cli }}"
- name: "Configure a DLDP authentication mode and ensure global DLDP state is already enabled"
ce_dldp:
enable: enable
auth_mode: md5
auth_pwd: abc
provider: "{{ cli }}"
- name: "Reset DLDP state of disabled interfaces and ensure global DLDP state is already enabled"
ce_dldp:
enable: enable
reset: enable
provider: "{{ cli }}"
s�
proposed:
description: k/v pairs of parameters passed into module
returned: always
type: dict
sample: {
"enable": "enable",
"reset": "enable",
"time_internal": "12",
"work_mode": "normal"
}
existing:
description: k/v pairs of existing global DLDP configuration
returned: always
type: dict
sample: {
"enable": "disable",
"reset": "disable",
"time_internal": "5",
"work_mode": "enhance"
}
end_state:
description: k/v pairs of global DLDP configuration after module execution
returned: always
type: dict
sample: {
"enable": "enable",
"reset": "enable",
"time_internal": "12",
"work_mode": "normal"
}
updates:
description: command sent to the device
returned: always
type: list
sample: [
"dldp enable",
"dldp work-mode normal",
"dldp interval 12",
"dldp reset"
]
changed:
description: check to see if a change was made on the device
returned: always
type: bool
sample: true
i����N( t ElementTree( t
AnsibleModule( t ce_argument_spect
set_nc_configt
get_nc_configt execute_nc_actions�
<action>
<dldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
<resetDldp></resetDldp>
</dldp>
</action>
s4
<filter type="subtree">
<dldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
<dldpSys>
<dldpEnable></dldpEnable>
<dldpInterval></dldpInterval>
<dldpWorkMode></dldpWorkMode>
<dldpAuthMode></dldpAuthMode>
</dldpSys>
</dldp>
</filter>
s�
<config>
<dldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
<dldpSys operation="merge">
<dldpEnable>%s</dldpEnable>
<dldpInterval>%s</dldpInterval>
<dldpWorkMode>%s</dldpWorkMode>
s$
</dldpSys>
</dldp>
</config>
t Dldpc B s� e 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 d
� Z RS( s Manage global dldp configurationc C s | | _ d | _ | j � | j j d p/ d | _ | j j d pH d | _ | j j d pa d | _ | j j d pz d | _ | j j d | _ | j j d | _
t � | _ t
| _ t
| _ t � | _ t � | _ t � | _ t � | _ t � | _ d S( Nt enablet work_modet
time_intervalt resett auth_modet auth_pwd( t spect Nonet modulet init_modulet paramsR R
t internalR R R t dictt dldp_conft Falset same_conft changedt listt updates_cmdt resultst proposedt existingt end_state( t selft
argument_spec( ( sO /usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_dldp.pyt __init__� s"