コード例 #1
0
ファイル: tasks.py プロジェクト: ethereum/system-testing
def run_bootnodes(nodes, images):
    options = dict()
    commands = dict()
    for impl in nodes:
        for nodename in nodes[impl]:
            env_ = machine_env(nodename)
            ip = env_['host'][6:-5]

            # Set options (daemonize, ports and entrypoint)
            if impl == 'cpp':
                options[nodename] = ('-d -p 30303:30303 -p 30303:30303/udp '
                                     '--entrypoint eth')
                commands[nodename] = ('--verbosity 9 '
                                      '--client-name %s '
                                      '--mining off '
                                      '--mode full '
                                      '--peers 25 '
                                      '--upnp off '
                                      '--public-ip %s"' % (nodename, ip))
            elif impl == 'go':
                options[nodename] = ('-d -p 30303:30303 -p 30303:30303/udp '
                                     '--entrypoint geth')
                commands[nodename] = ("--nodekeyhex=%s "
                                      "--port=30303 "
                                      "--maxpeers=25 "
                                      "--bootnodes 'enode://%[email protected]:10000'" % (nodeid_tool.topriv(nodename),
                                                                                   nodeid_tool.topub(nodename)))
            elif impl == 'python':
                options[nodename] = ('-d -p 30303:30303 -p 30303:30303/udp '
                                     '--entrypoint pyethapp')
                commands[nodename] = ''  # TODO
            else:
                raise ValueError("No implementation: %s" % impl)

    run_containers(nodes, images, options, commands)
コード例 #2
0
ファイル: clients.py プロジェクト: sveneh/system-testing
def create_clients_config(inventory):
    clients_config = dict()
    
    for c, ip in inventory.clients.iteritems():
        clients_config[c] = dict() 
        for impl in ['go', 'cpp', 'python']:
            clients_config[c][impl] = dict()
            ext_id = str(c) + impl
            clients_config[c][impl]['pubkey'] = nodeid_tool.topub(ext_id)
            clients_config[c][impl]['privkey'] = nodeid_tool.topriv(ext_id)
            clients_config[c][impl]['coinbase'] = nodeid_tool.coinbase(ext_id)
    return clients_config
コード例 #3
0
def create_clients_config(inventory):
    clients_config = dict()

    for nodename, ip in inventory.clients.items():
        clients_config[nodename] = dict()
        impl = nodename.split("-")[1]
        # for impl in ['go', 'cpp', 'python']:
        clients_config[nodename]['ip'] = ip
        clients_config[nodename]['impl'] = impl
        clients_config[nodename]['nodename'] = nodename
        clients_config[nodename]['pubkey'] = nodeid_tool.topub(nodename)
        clients_config[nodename]['privkey'] = nodeid_tool.topriv(nodename)
        clients_config[nodename]['coinbase'] = nodeid_tool.coinbase(nodename)
    return clients_config
コード例 #4
0
ファイル: clients.py プロジェクト: gerrit-rws/system-testing
def create_clients_config(inventory):
    clients_config = dict()

    for nodename, ip in inventory.clients.items():
        clients_config[nodename] = dict()
        impl = nodename.split("-")[1]
        # for impl in ['go', 'cpp', 'python']:
        clients_config[nodename]["ip"] = ip
        clients_config[nodename]["impl"] = impl
        clients_config[nodename]["nodename"] = nodename
        clients_config[nodename]["pubkey"] = nodeid_tool.topub(nodename)
        clients_config[nodename]["privkey"] = nodeid_tool.topriv(nodename)
        clients_config[nodename]["coinbase"] = nodeid_tool.coinbase(nodename)
    return clients_config
コード例 #5
0
def run_bootnodes(nodes, images):
    options = dict()
    commands = dict()
    for impl in nodes:
        for nodename in nodes[impl]:
            env_ = machine_env(nodename)
            ip = env_['host'][6:-5]

            # Set options (daemonize, ports and entrypoint)
            if impl == 'cpp':
                options[nodename] = ('-d -p 30303:30303 -p 30303:30303/udp '
                                     '--entrypoint eth')
                commands[nodename] = ('--verbosity 9 '
                                      '--client-name %s '
                                      '--mining off '
                                      '--mode full '
                                      '--peers 25 '
                                      '--upnp off '
                                      '--public-ip %s"' % (nodename, ip))
            elif impl == 'go':
                options[nodename] = ('-d -p 30303:30303 -p 30303:30303/udp '
                                     '--entrypoint geth')
                commands[nodename] = (
                    "--nodekeyhex=%s "
                    "--port=30303 "
                    "--maxpeers=25 "
                    "--bootnodes 'enode://%[email protected]:10000'" %
                    (nodeid_tool.topriv(nodename),
                     nodeid_tool.topub(nodename)))
            elif impl == 'python':
                options[nodename] = ('-d -p 30303:30303 -p 30303:30303/udp '
                                     '--entrypoint pyethapp')
                commands[nodename] = ''  # TODO
            else:
                raise ValueError("No implementation: %s" % impl)

    run_containers(nodes, images, options, commands)
コード例 #6
0
def start_clients(clients=[],
                  req_num_peers=7,
                  impls=['go'],
                  boot=0,
                  enable_mining=True):
    """
    start all clients with a custom config (nodeid)
    """
    inventory = Inventory()
    clients = clients or list(inventory.clients)
    inventory.inventory['client_start_group'] = dict(children=clients,
                                                     hosts=[])
    # print clients
    # quit()
    bt = get_boot_ip_pk(inventory, boot)
    assert inventory.es
    assert inventory.boot0
    for client in clients:
        assert client
        pubkey = {}
        privkey = {}
        coinbase = {}
        for impl in ['go', 'cpp', 'python']:
            ext_id = str(client) + impl
            # print ext_id
            pubkey[impl] = nodeid_tool.topub(ext_id)
            privkey[impl] = nodeid_tool.topriv(ext_id)
            coinbase[impl] = nodeid_tool.coinbase(ext_id)

        d = dict(hosts=inventory.inventory[client], vars=dict())

        dra = {}
        dra['go'] = docker_run_args['go'].format(bootstrap_public_key=bt['pk'],
                                                 bootstrap_ip=bt['ip'],
                                                 req_num_peers=req_num_peers,
                                                 privkey=privkey['go'],
                                                 mining_state=enable_mining)

        dra['cpp'] = docker_run_args['cpp'].format(
            bootstrap_ip=bt['ip'],
            client_ip=inventory.instances[client],
            req_num_peers=req_num_peers,
            mining_state='--force-mining --mining on' if enable_mining else '')

        dra['python'] = docker_run_args['python'].format(
            bootstrap_ip=bt['ip'],
            req_num_peers=req_num_peers,
            coinbase=coinbase['python'],
            mining_state=mining_cpu_percentage if enable_mining else '0')
        d['vars']['target_client_impl'] = impls
        d['vars']['docker_run_args'] = {}
        d['vars']['docker_tee_args'] = {}

        for impl in ['go', 'cpp', 'python']:
            d['vars']['docker_run_args'][impl] = dra[impl]
            d['vars']['docker_tee_args'][impl] = teees_args.format(
                elarch_ip=inventory.es, pubkey_hex=pubkey[impl])

        inventory.inventory[client] = d
        # print json.dumps(inventory.inventory, indent=2)
    exec_playbook(inventory.inventory,
                  playbook='client-start.yml',
                  impls=impls)