Пример #1
0
    def test_00_setup(self):
        print("-----", sys._getframe().f_code.co_name, "-----")
        domain0_manager.Domain0Manager.DOMAIN_INFO_ADVERTISE_INTERVAL = 4  # just for testing
        domain0_manager.Domain0Manager.DOMAIN_INFO_LIFETIME = 8  # just for testing

        global msg_processor
        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(domain_num):
            for j in range(core_per_domain):
                base_core_index = i * core_per_domain + j
                start_core_thread(index=base_core_index,
                                  core_port_increment=base_core_index,
                                  p2p_port_increment=base_core_index,
                                  use_domain0=True)
                domain_setup_utility(base_core_index, domain_ids[i])
                core_domains[base_core_index] = domain_ids[i]
        time.sleep(1)
        for i in range(domain_num):
            print("domain:", i)
            for j in range(core_per_domain):
                base_core_index = i * core_per_domain + j
                print(" base_core_index:", base_core_index)
                print("  client_index:", base_core_index * client_per_core,
                      base_core_index * client_per_core + 1)
                for k in range(client_per_core):
                    make_client(index=base_core_index * client_per_core + k,
                                core_port_increment=base_core_index,
                                domain_id=domain_ids[i])
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()
        for i in range(client_num):
            msg_processor[i] = clients[i]['app'].callback
Пример #2
0
    def test_00_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")
        print("domain_id =", binascii.b2a_hex(domain_id))

        global msg_processor
        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i,
                              core_port_increment=i,
                              p2p_port_increment=i,
                              use_nodekey=False)
            time.sleep(0.1)
            domain_setup_utility(i, domain_id)  # system administrator
        time.sleep(1)
        for i in range(core_num):
            msg_processor[i * 2] = MessageProcessor(index=i * 2)
            make_client(index=i * 2,
                        core_port_increment=i,
                        callback=msg_processor[i * 2])
            msg_processor[i * 2 + 1] = MessageProcessor(index=i * 2 + 1)
            make_client(index=i * 2 + 1,
                        core_port_increment=i,
                        callback=msg_processor[i * 2 + 1])
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()

        prepare_transactions()
Пример #3
0
    def test_00_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")
        print("domain_id =", binascii.b2a_hex(domain_id))

        keypair = bbclib.KeyPair()
        keypair.generate()
        keyname = domain_id.hex() + ".pem"
        try:
            os.mkdir(".bbc1")
        except:
            pass
        with open(os.path.join(".bbc1", keyname), "wb") as f:
            f.write(keypair.get_private_key_in_pem())

        global msg_processor
        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i,
                              core_port_increment=i,
                              p2p_port_increment=i)
            time.sleep(0.1)
            domain_setup_utility(i, domain_id)  # system administrator
        time.sleep(1)
        for i in range(client_num):
            msg_processor[i] = MessageProcessor(index=i)
            make_client(index=i,
                        core_port_increment=i,
                        callback=msg_processor[i])
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()
Пример #4
0
    def test_00_setup(self):
        print(
            "XXXXXXXXXXXXXXX change value to ASSET_GROUP_INFO_LIFETIME = 20 in bbc_network.py XXXXXXXXXXXXXXX"
        )
        print("-----", sys._getframe().f_code.co_name, "-----")
        global msg_processor
        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i,
                              core_port_increment=i,
                              p2p_port_increment=i,
                              use_global=True)
            domain_and_asset_group_setup(
                i,
                domain_ids[i % domain_num],
                asset_group_ids[i % domain_num],
                advertise_in_domain0=True)  # system administrator
        time.sleep(1)
        for i in range(client_num):
            make_client(index=i,
                        core_port_increment=i % core_num,
                        asset_group_id=asset_group_ids[i % domain_num])
        time.sleep(1)
        # client: i*3 = domain[0], i*3+1 = domain[1], i*3+2 = domain[2]

        global cores, clients
        cores, clients = get_core_client()
        for i in range(client_num):
            msg_processor[i] = clients[i]['app'].callback
Пример #5
0
    def test_01_setup(self):
        print("-----", sys._getframe().f_code.co_name, "-----")

        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i,
                              core_port_increment=i,
                              p2p_port_increment=i,
                              remove_dir=False)
        time.sleep(1)
        for i in range(client_num):
            make_client(index=i,
                        core_port_increment=0,
                        connect_to_core=False,
                        asset_group_id=asset_group_id)

        time.sleep(1)
        global cores, clients
        cores, clients = get_core_client()
        for i in range(core_num):
            cores[i].networking.create_domain(network_module="simple_cluster",
                                              domain_id=domain_id)
            cores[i].send_message = dummy_send_message
            cores[i].storage_manager.set_storage_path(domain_id,
                                                      asset_group_id)
        print("===========")
Пример #6
0
    def test_00_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")

        prepare(core_num=core_num, client_num=client_num)
        for i in range(core_num):
            start_core_thread(index=i)
            make_client(index=i, core_port_increment=0)
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()
Пример #7
0
    def test_01_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")

        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i, core_port_increment=i, p2p_port_increment=i)
        time.sleep(1)
        for i in range(client_num):
            make_client(index=i, core_port_increment=0, connect_to_core=False)

        global cores, clients
        cores, clients = get_core_client()
        for i in range(core_num):
            cores[i].networking.create_domain(domain_id=domain_id)
Пример #8
0
    def test_00_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")

        global msg_processor
        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i)
            domain_and_asset_group_setup(i, domain_id, asset_group_id)  # system administrator
            msg_processor[i] = MessageProcessor(index=i)
            make_client(index=i, core_port_increment=0, callback=msg_processor[i], asset_group_id=asset_group_id)
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()
    def test_00_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")
        bbc_core.TX_TRAVERSAL_MAX = 11

        prepare(core_num=core_num, client_num=client_num)
        for i in range(core_num):
            start_core_thread(index=i, core_port_increment=i)
            domain_setup_utility(i, domain_id)  # system administrator
        time.sleep(1)
        for i in range(client_num):
            make_client(index=i, core_port_increment=0)
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()
    def test_00_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")
        prepare(core_num=core_num, client_num=client_num, loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i, core_port_increment=i, p2p_port_increment=i)
            domain_setup_utility(i, domain_id)  # system administrator
        time.sleep(1)
        for i in range(client_num):
            make_client(index=i, core_port_increment=0)
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()
        for core in cores:
            core.traverse_max_count = 11
Пример #11
0
    def test_00_setup(self):
        print("\n-----", sys._getframe().f_code.co_name, "-----")
        print("domain_id =", binascii.b2a_hex(domain_id))

        global keyname
        keypair = bbclib.KeyPair()
        keypair.generate()
        keyname = os.path.join(".bbc1", domain_id.hex() + ".pem")
        try:
            os.mkdir(".bbc1")
        except:
            pass
        with open(keyname, "wb") as f:
            f.write(keypair.get_private_key_in_pem())

        keypair_dummy = bbclib.KeyPair()
        keypair_dummy.generate()
        with open(os.path.join(".bbc1", "dummy.pem"), "wb") as f:
            f.write(keypair_dummy.get_private_key_in_pem())

        with open(os.path.join(".bbc1", "testconf.json"), "wb") as f:
            f.write(json.dumps(config_file_content).encode())

        global msg_processor
        prepare(core_num=core_num,
                client_num=client_num,
                conf_file=os.path.join(".bbc1", "testconf.json"),
                loglevel=LOGLEVEL)
        for i in range(core_num):
            start_core_thread(index=i,
                              core_port_increment=i,
                              p2p_port_increment=i,
                              use_nodekey=True)
            time.sleep(0.1)
        time.sleep(1)
        for i in range(client_num):
            msg_processor[i] = MessageProcessor(index=i)
            make_client(index=i,
                        core_port_increment=i,
                        callback=msg_processor[i])
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()