Exemplo n.º 1
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()
Exemplo n.º 2
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
Exemplo n.º 3
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()
Exemplo n.º 4
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_setup_utility(i, domain_id)  # system administrator
            msg_processor[i] = MessageProcessor(index=i)
            make_client(index=i, core_port_increment=0, callback=msg_processor[i])
        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
    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)
        for i in range(core_num):
            domain_setup_utility(
                i, domain_id,
                host="bbc1.securityhub.jp")  # system administrator
        for i in range(client_num):
            msg_processor[i] = MessageProcessor(index=i)
            make_client_direct(i,
                               host="bbc1.securityhub.jp",
                               port=9000,
                               callback=msg_processor[i])
        time.sleep(1)

        global cores, clients
        cores, clients = get_core_client()