def console_clear_config(self):
"""Clear device configuration using console connection
"""
cmd = [
"from xmlrpclib import ServerProxy", "rc = -1",
"rc = ServerProxy('http://127.0.0.1:8081/RPC2').nb.clearConfig()",
"print 'clearConfig() returnCode={0}.'.format(rc)"]
command = "python -c \"" + "; ".join(cmd) + "\""
output, err, _ = self.telnet.exec_command(command.encode("ascii"))
if err:
message = "Cannot perform clearConfig.\nCommand: %s.\nStdout: %s\nStdErr: %s" % (command, output, err)
self.class_logger.error(message)
self.db_corruption = True
pytest.fail(message)
else:
if "returnCode=0." in output:
self.class_logger.debug("ClearConfig finished. StdOut:\n%s" % (output, ))
else:
message = "ClearConfig failed. StdOut:\n%s" % (output, )
self.class_logger.error(message)
pytest.fail(message)
评论列表
文章目录