HuaweiSwitch / CloudEngine-Ansible

Ansible modules to automate HUAWEI CloudEngine switches
GNU General Public License v3.0
143 stars 51 forks source link

2.9.3 ansbile 使用ce模块重复操作(比如反复创建vlan10)log 中change仍然为TRUE,update为空。不知道是什么原因 #77

Open neoliupassccie opened 4 years ago

neoliupassccie commented 4 years ago

2.9.3 ansbile 使用ce模块重复操作(比如反复创建vlan10)log 中change仍然为TRUE,update为空。不知道是什么原因 我在测试test_ce_vxlan_gateway.yml

TASK [set dfs source ip vpn, again] ***** task path: /home/tdops/CloudEngine-Ansible/test/test-ce_vxlan_gateway.yml:86 <10.57.66.199> using connection plugin network_cli (was local) <10.57.66.199> ESTABLISH LOCAL CONNECTION FOR USER: tdops <10.57.66.199> EXEC /bin/sh -c 'echo ~tdops && sleep 0' <10.57.66.199> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/tdops/.ansible/tmp/ansible-tmp-1582785699.88-239091264236788" && echo ansible-tmp-1582785699.88-239091264236788="echo /home/tdops/.ansible/tmp/ansible-tmp-1582785699.88-239091264236788" ) && sleep 0' Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/cloudengine/ce_vxlan_gateway.py-bk <10.57.66.199> PUT /home/tdops/.ansible/tmp/ansible-local-25922676vod/tmpYYNkKz TO /home/tdops/.ansible/tmp/ansible-tmp-1582785699.88-239091264236788/AnsiballZ_ce_vxlan_gateway.py-bk <10.57.66.199> EXEC /bin/sh -c 'chmod u+x /home/tdops/.ansible/tmp/ansible-tmp-1582785699.88-239091264236788/ /home/tdops/.ansible/tmp/ansible-tmp-1582785699.88-239091264236788/AnsiballZ_ce_vxlan_gateway.py-bk && sleep 0' <10.57.66.199> EXEC /bin/sh -c '/usr/bin/python /home/tdops/.ansible/tmp/ansible-tmp-1582785699.88-239091264236788/AnsiballZ_ce_vxlan_gateway.py-bk && sleep 0' <10.57.66.199> EXEC /bin/sh -c 'rm -f -r /home/tdops/.ansible/tmp/ansible-tmp-1582785699.88-239091264236788/ > /dev/null 2>&1 && sleep 0' changed: [10.57.66.199] => { "changed": true, "end_state": {}, "existing": {}, "invocation": { "module_args": { "arp_direct_route": null, "arp_distribute_gateway": null, "dfs_all_active": null, "dfs_id": "1", "dfs_peer_ip": null, "dfs_peer_vpn": null, "dfs_source_ip": "1.2.3.4", "dfs_source_vpn": "vxlan_gw_vpn1", "dfs_udp_port": null, "host": "10.57.66.199", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 22, "provider": { "host": "10.57.66.199", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 22, "ssh_keyfile": null, "timeout": null, "transport": "cli", "use_ssl": null, "username": "neo", "validate_certs": null }, "ssh_keyfile": null, "state": "present", "timeout": null, "transport": "cli", "use_ssl": null, "username": "neo", "validate_certs": null, "vbdif_bind_vpn": null, "vbdif_mac": null, "vbdif_name": null, "vpn_instance": null, "vpn_vni": null } }, "proposed": { "dfs_all_active": null, "dfs_id": "1", "dfs_peer_ip": null, "dfs_peer_vpn": null, "dfs_source_ip": "1.2.3.4", "dfs_source_vpn": "vxlan_gw_vpn1", "dfs_udp_port": null, "state": "present" }, "updates": [ "dfs-group 1", "source ip 1.2.3.4 vpn-instance vxlan_gw_vpn1" ] }

我的环境如下: Package Version


aniso8601 8.0.0
ansible 2.9.3
Babel 0.9.6
backports.ssl-match-hostname 3.5.0.1
bcrypt 3.1.7
cffi 1.14.0
chardet 2.2.1
Click 7.0
colorama 0.4.3
configobj 4.7.2
cryptography 2.8
decorator 3.4.0
enum34 1.1.6
Flask 1.1.1
Flask-RESTful 0.3.8
futures 3.1.1
httplib2 0.9.2
idna 2.4
iniparse 0.4
iotop 0.6
ipaddress 1.0.23
IPy 0.75
isc 2.0
itsdangerous 1.1.0
Jinja2 2.11.1
jmespath 0.9.0
kitchen 1.1.1
libvirt-python 4.5.0
lxml 4.5.0
MarkupSafe 1.1.1
msgpack-python 0.5.6
ncclient 0.5.3
network-cli 0.1
paramiko 2.7.1
passlib 1.7.1
perf 0.1
pip 20.0.2
ply 3.4
policycoreutils-default-encoding 0.1
psutil 2.2.1
pyasn1 0.1.9
pycparser 2.19
pycrypto 2.6.1
pycurl 7.19.0
pygobject 3.22.0
pygpgme 0.3
pyliblzma 0.5.3
PyNaCl 1.3.0
python-linux-procfs 0.4.9
pytz 2019.3
pyudev 0.15
pyxattr 0.5.1
PyYAML 3.11
pyzmq 15.3.0
requests 2.6.0
salt 2016.11.6 schedutils 0.4
scp 0.13.2
selectors2 2.0.1
seobject 0.1
sepolicy 1.1
setuptools 44.0.0
sh 1.12.14
six 1.9.0
slip 0.4.0
slip.dbus 0.4.0
tornado 4.2.1
urlgrabber 3.10
urllib3 1.10.2
Werkzeug 1.0.0
yum-metadata-parser 1.1.4

系统环境为centos7 安装方式为yum install ansible

yanzhangi commented 4 years ago

@neoliupassccie 我是ansible ce模块维护人员,后续会关注这里,你的这个问题能具体哪个模块吗?

neoliupassccie commented 4 years ago

感觉像是BD解析错误,

   bd_rd: 1010:1解析成了60601

报错信息:   - name: "arp broadcast-suppress enable"     ce_vxlan_arp: bridge_domain_id={{ bd_id }} arp_suppress=enable state="present" provider={{ cli }}     register: data                 "timeout": null,                 "transport": "cli",                 "use_ssl": null,                 "username": "tdops",                 "validate_certs": null             },             "route_distinguisher": "60601",             "ssh_keyfile": null,             "state": "present",             "timeout": null,             "transport": "cli",             "use_ssl": null,             "username": "tdops",             "validate_certs": null,             "vpn_target_both": [                 "60601"             ],             "vpn_target_export": null,             "vpn_target_import": null         }     },     "msg": "Error: Route distinguisher has invalid value 60601." }

PLAY RECAP ** 10.57.31.254               : ok=5    changed=5    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

TD-xiang:deployment neo.liu$ 

==============================================

yml 代码

  - name: "bridge-domain creat"     ce_vxlan_global: bridge_domain_id={{ bd_id }} state="present" provider={{ cli }}     register: data

  - name: "bridge-domain vxlan vni"     ce_vxlan_tunnel: bridge_domain_id={{ bd_id }} vni_id={{ vni_id }}  provider={{ cli }}     register: data

  - name: "arp broadcast-suppress enable"     ce_vxlan_arp: bridge_domain_id={{ bd_id }} arp_suppress=enable state="present" provider={{ cli }}     register: data

  - name: "arp l2-proxy gateway-mac"     ce_config: lines='bridge-domain {{ bd_id }}, arp l2-proxy gateway-mac' match=none provider={{ cli }}     register: data

  - name: "bridge-domain evpn enable"

    ce_evpn_bd_vni: bridge_domain_id={{ bd_id }} provider={{ cli }}

    register: data

  - name: "bridge-domain evpn enable"     ce_config: lines='bridge-domain {{ bd_id }}, evpn' match=none provider={{ cli }}     register: data

  - name: "config vpn RD & RT export-extcommunity & import-extcommunity"     ce_evpn_bd_vni: bridge_domain_id={{ bd_id }} route_distinguisher="{{ bd_rd }}" vpn_target_both={{ bd_rt_a }} provider={{ cli }}     register: data

  - name: "config vpn target export-extcommunity"     ce_evpn_bd_vni: bridge_domain_id={{ bd_id }}  vpn_target_export={{ bd_rt_b }} provider={{ cli }}     register: data

设备版本 [~HUAWEI]dis ver Huawei Versatile Routing Platform Software VRP (R) software, Version 8.190 (CE6881 V200R005C20SPC800) Copyright (C) 2012-2019 Huawei Technologies Co., Ltd. HUAWEI CE6881-48S6CQ uptime is 0 day, 1 hour, 36 minutes Patch Version: V200R005SPH015

CE6881-48S6CQ(Master) 1 : uptime is  0 day, 1 hour, 36 minutes         StartupTime 2020/06/03   00:44:42+08:00 Memory    Size    : 4096 M bytes Flash     Size    : 4096 M bytes CE6881-48S6CQ version information                              

  1. PCB    Version : CEM48S6CQP05    VER C
  2. MAB    Version : 4
  3. Board  Type    : CE6881-48S6CQ
  4. CPLD1  Version : 258
  5. CPLD2  Version : 258
  6. BIOS   Version : 1233 [~HUAWEI]

ansible版本 ansible --version ansible 2.8.7   config file = /etc/ansible/ansible.cfg   configured module search path = ['/Users/neo.liu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']   ansible python module location = /usr/local/Cellar/ansible@2.8/2.8.7/libexec/lib/python3.7/site-packages/ansible   executable location = /usr/local/opt/ansible@2.8/bin/ansible   python version = 3.7.6 (default, Dec 30 2019, 19:38:28) [Clang 11.0.0 (clang-1100.0.33.16)] TD-xiang:deployment neo.liu$ 

------------------ 原始邮件 ------------------ 发件人: "yanzhangi"<notifications@github.com>; 发送时间: 2020年5月6日(星期三) 下午5:48 收件人: "HuaweiSwitch/CloudEngine-Ansible"<CloudEngine-Ansible@noreply.github.com>; 抄送: "流石金雨"<445654045@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [HuaweiSwitch/CloudEngine-Ansible] 2.9.3 ansbile 使用ce模块重复操作(比如反复创建vlan10)log 中change仍然为TRUE,update为空。不知道是什么原因 (#77)

@neoliupassccie 我是ansible ce模块维护人员,后续会关注这里,你的这个问题能具体哪个模块吗?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

neoliupassccie commented 4 years ago

我最近会针对新版本的交换机进行ansible测试,我知道有很多bug,不知道你们这边会不会跟进。

我之前的交换机版本是

dis ver Huawei Versatile Routing Platform Software VRP (R) software, Version 8.150 (CE6855HI V200R002C50SPC800) Copyright (C) 2012-2017 Huawei Technologies Co., Ltd. HUAWEI CE6855-48S6Q-HI uptime is 4 days, 22 hours, 9 minutes Patch Version: V200R002SPH010

CE6855-48S6Q-HI(Master) 1 : uptime is  4 days, 22 hours, 8 minutes         StartupTime 2020/05/28   20:14:52+08:00 Memory    Size    : 2048 M bytes Flash     Size    : 1024 M bytes CE6855-48S6Q-HI version information                              

  1. PCB    Version : CEM48S6QP05    VER B
  2. MAB    Version : 1
  3. Board  Type    : CE6855-48S6Q-HI
  4. CPLD1  Version : 102
  5. BIOS   Version : 386

使用的ansible版本是2.2.0.0, 使用的功能主要是vxlan相关的配置——主要有BD创建、vpninstance创建、bdif创建和vap创建。 老版本使用是没有问题的,但是交换机V2R2以上的都会问题,我查了源码是netconf接口有问题,或者是参数解析有问题。希望你们这边将ansible版本和交换机的大版本对应,不然企业更愿意用cli为工具进行配置下发。 因为比较稳定。 非常希望能和组织取得联系,问题交流。

------------------ 原始邮件 ------------------ 发件人: "yanzhangi"<notifications@github.com>; 发送时间: 2020年5月6日(星期三) 下午5:48 收件人: "HuaweiSwitch/CloudEngine-Ansible"<CloudEngine-Ansible@noreply.github.com>; 抄送: "流石金雨"<445654045@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [HuaweiSwitch/CloudEngine-Ansible] 2.9.3 ansbile 使用ce模块重复操作(比如反复创建vlan10)log 中change仍然为TRUE,update为空。不知道是什么原因 (#77)

@neoliupassccie 我是ansible ce模块维护人员,后续会关注这里,你的这个问题能具体哪个模块吗?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

neoliupassccie commented 4 years ago

问题描述: ce_cloudengine模块报错

问题现象: TASK [peer enable] ** [WARNING]: The value True (type bool) in a string field was converted to u'True' (type string). If this does not look like what you expect, quote the entire value to ensure it does not change.

fatal: [10.57.31.254]: FAILED! => {"changed": false, "msg": "Error: The parameter of bgp_instance evpn is invalid."}

问题配置: cat evpn_bgp.yml                

  tasks:   - name: "bgp 100 instance evpn"     ce_evpn_bgp_rr:       as_number: "100"       bgp_instance: evpn       provider: "{{ cli }}"     register: data

  - name: "Configure BGP-EVPN address family view and ensure that BGP view has existed."     ce_evpn_bgp_rr:       as_number: "100"       bgp_instance: evpn       bgp_evpn_enable: enable       provider: "{{ cli }}"

Enable peer address

  - name: "peer enable"     ce_evpn_bgp:         bgp_instance: "evpn"         peer_address: "192.8.3.3"         as_number: "100"         peer_enable: true         provider: "{{ cli }}"

  - name: "Configure reflect client and ensure peer has existed."     ce_evpn_bgp_rr:       as_number: 100       bgp_instance: evpn       peer_type: ipv4_address       peer: 192.8.3.3       reflect_client: enable       provider: "{{ cli }}"

  - name: "Configure the VPN-Target filtering."     ce_evpn_bgp_rr:       as_number: 100       bgp_instance: evpn       policy_vpn_target: anable       provider: "{{ cli }}"

  - name: "Configure an RR in BGP-EVPN address family view."     ce_evpn_bgp_rr:       as_number: 100       bgp_instance: evpn       bgp_evpn_enable: enable       peer_type: ipv4_address       peer: 192.8.3.3       reflect_client: enable       policy_vpn_target: disable       provider: "{{ cli }}"

版本信息:

ansible --version ansible 2.8.7   config file = /etc/ansible/ansible.cfg   configured module search path = ['/Users/neo.liu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']   ansible python module location = /usr/local/Cellar/ansible@2.8/2.8.7/libexec/lib/python3.7/site-packages/ansible   executable location = /usr/local/opt/ansible@2.8/bin/ansible   python version = 3.7.6 (default, Dec 30 2019, 19:38:28) [Clang 11.0.0 (clang-1100.0.33.16)] TD-xiang:deployment neo.liu$ 

<HUAWEI>dis ver Huawei Versatile Routing Platform Software VRP (R) software, Version 8.190 (CE6881 V200R005C20SPC800) Copyright (C) 2012-2019 Huawei Technologies Co., Ltd. HUAWEI CE6881-48S6CQ uptime is 0 day, 1 hour, 59 minutes Patch Version: V200R005SPH015

CE6881-48S6CQ(Master) 1 : uptime is  0 day, 1 hour, 59 minutes         StartupTime 2020/06/03   00:44:42+08:00 Memory    Size    : 4096 M bytes Flash     Size    : 4096 M bytes CE6881-48S6CQ version information                              

  1. PCB    Version : CEM48S6CQP05    VER C
  2. MAB    Version : 4
  3. Board  Type    : CE6881-48S6CQ
  4. CPLD1  Version : 258
  5. CPLD2  Version : 258
  6. BIOS   Version : 1233 <HUAWEI>
yanzhangi commented 4 years ago

@neoliupassccie 我们在ansible2.8时对ce模块进行了大量修改,在后续的ansible2.9中大多数模块问题已经优化OK