Beispiel #1
0
def cli(command="gpio"):
    clidata = ""
    cli = sarcli.open()
    cli.write(command)
    while True:
        tmpdata = cli.read(-1)
        if not tmpdata:
            break
        clidata += tmpdata
    cli.close()
    return clidata
def cli_command(cmd):
    """
    Send a command to the SarOS CLI and receive the response
    :param cmd: str, Command to run
    :return response: str, Response to cmd
    """
    cli = sarcli.open()
    cli.write(cmd)
    response = cli.read()
    cli.close()
    return response
def cli_command(cmd):
    """
    Send a command to the SarOS CLI and receive the response
    :param cmd: str, Command to run
    :return response: str, Response to cmd
    """
    cli = sarcli.open()
    cli.write(cmd)
    response = cli.read()
    cli.close()
    return response
Beispiel #4
0
def cli(command="gpio"):
    clidata = ''
    cli = sarcli.open()
    if DEBUG:
        print 'CLI> {0}'.format(command)
    cli.write(command)
    while True:
        tmpdata = cli.read(-1)
        if not tmpdata:
            break
        clidata += tmpdata
    cli.close()
    return clidata
Beispiel #5
0
def cli_command(cmd):
    """Send a command to the cli, get output

	cmd: a string that is the cli command to be issued

	returns: a stripped string that is the output of the cli command
	"""

    data = ""

    cli = sarcli.open()
    cli.write(cmd)
    while True:
        tmpdata = cli.read(-1)
        if not tmpdata:
            break
        data += tmpdata
    cli.close()

    return data.strip()
Beispiel #6
0
def cli(command):
    cli = sarcli.open()
    cli.write(command)
    response = cli.read()
    cli.close()
    return response
Beispiel #7
0
def cli(command):
    s = sarcli.open()
    s.write(command)
    resp = s.read()
    s.close()  # Close sarcli session
    return resp
Beispiel #8
0
def cli(cmd):
    s = sarcli.open()
    s.write(cmd)
    resp = s.read()
    s.close()
    return resp.strip('\r\n').strip('\r\nOK')