Ejemplo n.º 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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 6
0
def cli(command):
    cli = sarcli.open()
    cli.write(command)
    response = cli.read()
    cli.close()
    return response
Ejemplo n.º 7
0
def cli(command):
    s = sarcli.open()
    s.write(command)
    resp = s.read()
    s.close()  # Close sarcli session
    return resp
Ejemplo n.º 8
0
def cli(cmd):
    s = sarcli.open()
    s.write(cmd)
    resp = s.read()
    s.close()
    return resp.strip('\r\n').strip('\r\nOK')