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

@ -80,7 +80,7 @@ ce_argument_spec.update(ce_top_spec)
def to_string(data):
return re.sub(r'<data.+?(/>|>)', r'<data\1', data)
return re.sub(r'<data\s+.+?(/>|>)', r'<data\1', data)
def check_args(module, warnings):
@ -164,12 +164,11 @@ class Cli:
responses = list()
for item in to_list(commands):
cmd = item['command']
rc, out, err = self.exec_command(cmd)
rc, out, err = self.exec_command(item)
if check_rc and rc != 0:
self._module.fail_json(msg=cli_err_msg(cmd.strip(), err))
self._module.fail_json(msg=cli_err_msg(item['command'].strip(), err))
try:
out = self._module.from_json(out)
@ -234,7 +233,7 @@ def to_command(module, commands):
command=dict(key=True),
output=dict(default=default_output),
prompt=dict(),
response=dict()
answer=dict()
), module)
commands = transform(to_list(commands))