Example #1
0
def data_collection():
    execfile('openrc.py')
    print os.environ['OS_USERNAME']
    config = configparser.ConfigParser()
    config.read('config.ini')
    print(config.sections())

    vm_credentials = dict(config['SSH_CREDENTIALS'])
    ssh_username = str(vm_credentials['ssh.username'])
    ssh_password = str(vm_credentials['ssh.password'])
    ssh_key_filename = str(vm_credentials['ssh.key_filename'])

    VM_control = vm_control.VM_Control()
    ssh_url = VM_control.get_floating_ip('master')

    env.hosts = [ssh_url]
    env.user = ssh_username
    env.password = ssh_password
    env.key_filename = ssh_key_filename

    #    execute(upload_file,'/root/measurements_downloader.py','measurements_downloader.py',sudo=True)
    execute(run_python_program,
            program='/root/measurements_downloader.py',
            sudo=True)

    vm_list = read_hosts_file('host_ips.csv')

    print vm_list

    execute(collect_data_files, vm_list)
Example #2
0
def run():
    execfile('openrc.py')
    print os.environ['OS_USERNAME']
    config = configparser.ConfigParser()
    config.read('config.ini')
    print(config.sections())

    vm_credentials = dict(config['SSH_CREDENTIALS'])
    ssh_username = str(vm_credentials['ssh.username'])
    ssh_password = str(vm_credentials['ssh.password'])
    ssh_key_filename = str(vm_credentials['ssh.key_filename'])

    VM_control = vm_control.VM_Control()
    ssh_url = VM_control.get_floating_ip('master')

    env.hosts = [ssh_url]
    env.user = ssh_username
    env.password = ssh_password
    env.key_filename = ssh_key_filename
    env.connection_attempts = 5

    #    execute(upload_file,'/root/test_runner.py','test_runner.py',sudo=True)
    execute(run_python_program, program='/root/test_runner.py', sudo=True)
Example #3
0
    env.key_filename = ssh_key_filename
    env.connection_attempts = 5

    #    execute(upload_file,'/root/test_runner.py','test_runner.py',sudo=True)
    execute(run_python_program, program='/root/test_runner.py', sudo=True)


if __name__ == "__main__":
    execfile('openrc.py')
    print os.environ['OS_USERNAME']
    config = configparser.ConfigParser()
    config.read('config.ini')
    print(config.sections())

    vm_credentials = dict(config['SSH_CREDENTIALS'])
    ssh_username = str(vm_credentials['ssh.username'])
    ssh_password = str(vm_credentials['ssh.password'])
    ssh_key_filename = str(vm_credentials['ssh.key_filename'])

    vm_control = vm_control.VM_Control()
    ssh_url = vm_control.get_floating_ip('master')

    env.hosts = [ssh_url]
    env.user = ssh_username
    env.password = ssh_password
    env.key_filename = ssh_key_filename
    env.connection_attempts = 5

    #    execute(upload_file,'/root/test_runner.py','test_runner.py',sudo=True)
    execute(run_python_program, program='/root/test_runner.py', sudo=True)
Example #4
0
def setup():
    execfile('openrc.py')
    print os.environ['OS_USERNAME']
    config = configparser.ConfigParser()
    config.read('config.ini')
    print(config.sections())

    vm_credentials = dict(config['SSH_CREDENTIALS'])
    ssh_username = str(vm_credentials['ssh.username'])
    ssh_password = str(vm_credentials['ssh.password'])
    ssh_key_filename = str(vm_credentials['ssh.key_filename'])
    ssh_public_key_filename = str(vm_credentials['ssh.public_key_filename'])
    ssh_private_key_filename = str(vm_credentials['ssh.key_filename'])

    vm_list = []

    with open('vm_list.csv', 'rb') as csvfile:
        listreader = csv.reader(csvfile, delimiter=';', quotechar='|')
        [vm_list.append(row[0]) for row in listreader]

    print vm_list

    global VM_control
    VM_control = vm_control.VM_Control()
    VM_control.create_vms(vm_list)
    #    vm_control.stop_vms(vm_list)
    #    vm_control.start_vms(vm_list)
    ip_list = VM_control.get_free_floating_ips()
    VM_control.assign_floating_ip_to_vm('master', ip_list)
    vm_data = VM_control.get_vms_data(vm_list)
    ssh_url = VM_control.get_floating_ip('master')

    env.hosts = [ssh_url]
    env.user = ssh_username
    env.password = ssh_password
    env.key_filename = ssh_key_filename
    env.connection_attempts = 5

    install_execute_env(False)

    host_ip_list = get_vm_ips(vm_data[1:])
    write_hosts_file(host_ip_list)
    test = read_hosts_file('host_ips.csv')
    execute(upload_file, '/etc/host_ips.csv', 'host_ips.csv', sudo=True)
    execute(upload_file,
            '/root/.ssh/id_rsa',
            ssh_private_key_filename,
            sudo=True)
    execute(upload_file,
            '/root/.ssh/id_rsa.pub',
            ssh_public_key_filename,
            sudo=True)
    execute(chmod_file, '0600', '/root/.ssh/id_rsa')
    execute(upload_file, '/root/config.ini', 'remote_config.ini', sudo=True)
    execute(upload_file, '/root/node_config.py', 'node_config.py', sudo=True)
    execute(upload_file, '/root/test_program.py', 'test_program.py', sudo=True)
    execute(upload_file, '/root/failures.csv', 'failures.csv', sudo=True)
    execute(upload_file,
            '/root/response_time.csv',
            'response_time.csv',
            sudo=True)
    execute(run_python_program, program='/root/node_config.py')
    execute(upload_file, '/root/test_runner.py', 'test_runner.py', sudo=True)
    execute(upload_file,
            '/root/measurements_downloader.py',
            'measurements_downloader.py',
            sudo=True)
    execute(upload_file,
            '/root/config_clearer.py',
            'config_clearer.py',
            sudo=True)