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

@ -205,11 +205,14 @@ class Default(FactsBase):
data = self.responses[0]
if data:
version = data.split("\n")
tmp_version = version[11:]
for item in tmp_version:
tmp_item = item.split()
tmp_key = tmp_item[1] + " " + tmp_item[2]
self.facts[tmp_key] = tmp_item[4]
for item in version:
if re.findall(r"^\d+\S\s+", item.strip()):
tmp_item = item.split()
tmp_key = tmp_item[1] + " " + tmp_item[2]
if len(tmp_item) > 5:
self.facts[tmp_key] = " ".join(tmp_item[4:])
else:
self.facts[tmp_key] = tmp_item[4]
data = self.responses[1]
if data:
@ -293,12 +296,17 @@ class Interfaces(FactsBase):
super(Interfaces, self).populate()
data = self.responses[0]
begin = False
if data:
interface_info = data.split("\n")
tmp_interface = interface_info[12:]
for item in tmp_interface:
tmp_item = item.split()
interface_dict[tmp_item[0]] = tmp_item[1]
for item in interface_info:
if begin:
tmp_item = item.split()
interface_dict[tmp_item[0]] = tmp_item[1]
if re.findall(r"^Interface", item.strip()):
begin = True
self.facts['interfaces'] = interface_dict
data = self.responses[1]