fix bugs for ce (#54750)

* Update ce.py

            while to_text(out, errors='surrogate_then_replace').strip().endswith(']'):
                display.vvvv('wrong context, sending exit to device', self._play_context.remote_addr)
                conn.exec_command('return')
                out = conn.get_prompt()

connetion has no send_command function and ce device has no 'exit' command to return user-view(a correct context),but 'return' .command.

* Add files via upload

Some bugs fix.

* Add files via upload

fix some bugs

* fix a bug for ce_command

Running a command with prompt via ce_command, It doesn't work.The reason is that the key word for network_cli recognition is answer not response.

* fix bugs

fix bugs for ce modules

* Update ce.py

* Delete ce_ftp.py

need modify

* Delete ce_lacp.py

* Add files via upload

* Delete ce_aaa_server.py

* Delete ce_aaa_server_host.py

* Compatible with Python 3

Compatible with Python 3 and fix bugs for ce

* Update ce_aaa_server.py

* Add files via upload

modify doc

* Add files via upload

Compatible with Python 3 and fix bugs

* Add files via upload

Compatible with Python 3 and fix bugs

* Add files via upload

Cancellation of change

* Update ce_netconf.py

It is a bug that response has no xml attribute:line 183

* Add files via upload

* Add files via upload

Compatible with Python 3 and fix bugs

* updatp ce_config.py

a bug for this module.
This commit is contained in:
xuxiaowei 2019-04-17 15:21:58 +08:00 committed by Ganesh Nalawade
parent f8bebc61c8
commit 1017f15c38
9 changed files with 315 additions and 269 deletions

View file

@ -384,13 +384,17 @@ class Vlan(object):
if "<data/>" in xml_str:
return attr
else:
re_find = re.findall(r'.*<vlanId>(.*)</vlanId>.*\s*'
r'<vlanName>(.*)</vlanName>.*\s*'
r'<vlanDesc>(.*)</vlanDesc>.*', xml_str)
if re_find:
attr = dict(vlan_id=re_find[0][0], name=re_find[0][1],
description=re_find[0][2])
re_find_id = re.findall(r'.*<vlanId>(.*)</vlanId>.*\s*', xml_str)
re_find_name = re.findall(r'.*<vlanName>(.*)</vlanName>.*\s*', xml_str)
re_find_desc = re.findall(r'.*<vlanDesc>(.*)</vlanDesc>.*\s*', xml_str)
if re_find_id:
if re_find_name:
attr = dict(vlan_id=re_find_id[0], name=re_find_name[0],
description=re_find_desc[0])
else:
attr = dict(vlan_id=re_find_id[0], name=None,
description=re_find_desc[0])
return attr
def get_vlans_name(self):
@ -477,7 +481,7 @@ class Vlan(object):
if tagged_vlans <= 0 or tagged_vlans > 4094:
self.module.fail_json(
msg='Error: Vlan id is not in the range from 1 to 4094.')
j = tagged_vlans / 4
j = tagged_vlans // 4
bit_int[j] |= 0x8 >> (tagged_vlans % 4)
vlan_bit[j] = hex(bit_int[j])[2]