def start_trex_remote_server(trex_data, kill_running = False):
    if kill_running:
        (return_code, stdout, stderr) = misc_methods.run_remote_command(trex_data['trex_name'],
                                    trex_data['trex_password'],
                                    'ps -u root --format comm,pid,cmd | grep t-rex-64')
        if stdout:
            for process in stdout.split('\n'):
                try:
                    proc_name, pid, full_cmd = re.split('\s+', process, maxsplit=2)
                    if proc_name.find('t-rex-64') >= 0:
                        print 'Killing remote process: %s' % full_cmd
                        misc_methods.run_remote_command(trex_data['trex_name'],
                                        trex_data['trex_password'],
                                        'kill %s' % pid)
                except:
                    continue

    _start_stop_trex_remote_server(trex_data, DAEMON_START_COMMAND)
def start_trex_remote_server(trex_data, kill_running = False):
    if kill_running:
        (return_code, stdout, stderr) = misc_methods.run_remote_command(trex_data['trex_name'],
                                    trex_data['trex_password'],
                                    'ps -u root --format comm,pid,cmd | grep t-rex-64')
        if stdout:
            for process in stdout.split('\n'):
                try:
                    proc_name, pid, full_cmd = re.split('\s+', process, maxsplit=2)
                    if proc_name.find('t-rex-64') >= 0:
                        print 'Killing remote process: %s' % full_cmd
                        misc_methods.run_remote_command(trex_data['trex_name'],
                                        trex_data['trex_password'],
                                        'kill %s' % pid)
                except:
                    continue

    _start_stop_trex_remote_server(trex_data, DAEMON_START_COMMAND)
Example #3
0
def trex_remote_command(trex_data, command, background = False, from_scripts = True):
    if from_scripts:
        return misc_methods.run_remote_command(trex_data['trex_name'], ('cd %s; ' % CTRexScenario.scripts_path)+ command, background)
    return misc_methods.run_remote_command(trex_data['trex_name'], command, background)
Example #4
0
def _start_stop_trex_remote_server(trex_data, command):
    # start t-rex server as daemon process
    # subprocess.call(["/usr/bin/python", "trex_daemon_server", "restart"], cwd = trex_latest_build)
    misc_methods.run_remote_command(trex_data['trex_name'],
                                    trex_data['trex_password'], command)
def _start_stop_trex_remote_server(trex_data, command):
    # start t-rex server as daemon process
    # subprocess.call(["/usr/bin/python", "trex_daemon_server", "restart"], cwd = trex_latest_build)
    misc_methods.run_remote_command(trex_data['trex_name'],
                                    trex_data['trex_password'],
                                    command)