Exemplo n.º 1
0
                                 BOOTSTRAP_IP, POET_IP)
    print("Waiting for node to boot up")
    #tools.tail(fluentd)
    tools.wait_for_log("App started", fluentd)

    print("Bootstrap booted")
    # collect id and ip.

    bootIP = tools.getExternalIP(advclient, bootstrap)
    if bootIP == "":
        print("bootstrap failed")

    if bootIP != BOOTSTRAP_IP:
        print("bootstrap loaded with wrong ip")

    bootID = tools.getPublicKey(fluentd)
    print("Bootnode is at - " + bootstrap.name + ": " + bootIP + ":7513/" +
          bootID)

    create_nodes(params.genesis_accounts, bootIP, bootID, POET_IP,
                 NETWORK_NAME)
    print("Started " + str(netsize) + " more instances booting from bootnode")

    tools.parse_logs(fluentd, queries.events)
except KeyboardInterrupt:
    print("Run stopped")
except:
    traceback.print_exc()
finally:
    print("Starting to shutdown nodes")
    if fluentd is not None:
Exemplo n.º 2
0
def getpubkey(cont):
    id = tools.getPublicKey(client.containers.get(cont))
    return True, cont, id
Exemplo n.º 3
0
advclient = docker.APIClient(base_url='unix://var/run/docker.sock')

tools.cleanUp(client.containers.list())

time.sleep(1)
print "Creating bootstrap container"
bootstrap = client.containers.run("spaceanton/spacemesh:spacemesh_p2p", detach=True, ports={9090:9999}, environment={"BOOTPARAMS": "--gossip --randcon 3 --bucketsize 100"})
print "Waiting for node to boot up"
tools.waitForRPC(bootstrap)
tools.registerProtocol(advclient, bootstrap, "gossip_test", 8081)


# collect id and ip.

bootIP = tools.getExternalIP(advclient, bootstrap)
bootID = tools.getPublicKey(bootstrap)

print "Bootnode is at - "+ bootstrap.name + ": " + bootIP + ":7513/" + bootID

# Start a network with size `netsize` boot each client and add to the list
# After that run the needed tests.
netsize = 30
idxes = {}
contlist = []


def createNodes(netsize, bootIP, bootID):
    for i in range(netsize):
        node = client.containers.run("spaceanton/spacemesh:spacemesh_p2p", detach=True, ports={"9090": None}, environment={"BOOTPARAMS": "--bootstrap --gossip --randcon " + str(randcon) + " --bucketsize 20 --bootnodes \"" + bootIP + ":7513/" + bootID + "\""})
        contlist.append({"cont": node})
        idxes[node.name] = i