Ejemplo n.º 1
0
    def test_direct_accesses(self):
        coord_address1 = CoordAddress.CoordAddress.translate_address(
                'server:instance@machine'
            )

        coord_address2 = CoordAddress.CoordAddress.translate_address(
                'server2:instance@machine'
            )

        coord_address3 = CoordAddress.CoordAddress.translate_address(
                'server:instance2@machine'
            )

        direct_address1 = DirectAddress.from_coord_address(coord_address1)
        direct_address2 = DirectAddress.from_coord_address(coord_address2)
        direct_address3 = DirectAddress.from_coord_address(coord_address3)

        direct_network1 = DirectNetwork.DirectNetwork(direct_address1)
        direct_network2 = DirectNetwork.DirectNetwork(direct_address2)
        direct_network3 = DirectNetwork.DirectNetwork(direct_address3)

        a1 = Access.Access(Protocols.Direct,AccessLevel.instance,
                (direct_network1,)
            )
        a2 = Access.Access(Protocols.Direct,AccessLevel.instance,
                (direct_network2,)
            )
        a3 = Access.Access(Protocols.Direct,AccessLevel.instance,
                (direct_network3,)
            )

        self.assertEquals(a1.possible_connections(a2)[0],direct_network2)
        self.assertEquals(a2.possible_connections(a1)[0],direct_network1)

        self.assertEquals(len(a1.possible_connections(a3)),0)
        self.assertEquals(len(a2.possible_connections(a3)),0)
        self.assertEquals(len(a3.possible_connections(a1)),0)
        self.assertEquals(len(a3.possible_connections(a2)),0)
Ejemplo n.º 2
0
    def _create_coordinator_server(self, global_config, machine_name,
                                   instance_name):
        map_builder = CoordinatorMapBuilder.CoordinatorMapBuilder()
        map = map_builder.build(global_config)

        coordinator_server_name = self._generate_coordinator_server_name(
            machine_name, instance_name)

        any_server = global_config.machines[machine_name].instances[
            instance_name].servers.values()[0]

        server_type = getattr(any_server.server_type_module, 'Coordinator')

        map.add_new_server(machine_name, instance_name,
                           coordinator_server_name, server_type, (), ())

        coordinator_coord_address = map[machine_name][instance_name][
            coordinator_server_name].address
        coordinator_network = DirectNetwork.DirectNetwork(
            DirectAddress.from_coord_address(coordinator_coord_address))
        coordinator_access = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (coordinator_network, ))
        map.append_accesses(machine_name, instance_name,
                            coordinator_server_name, (coordinator_access, ))

        protocols = (Protocols.Direct, )

        cfg_manager = self._create_config_manager_for_instance(
            global_config, machine_name, instance_name)

        generated_coordinator = ServerSkel.factory(
            cfg_manager, protocols, voodoo_exported_methods.coordinator)

        class RealCoordinatorServer(CoordinatorServer.CoordinatorServer,
                                    generated_coordinator):
            def __init__(self, cfg_manager, map, *args, **kargs):
                CoordinatorServer.CoordinatorServer.__init__(
                    self, cfg_manager, map, *args, **kargs)

        real_coordinator_server = RealCoordinatorServer(
            cfg_manager,
            map,
            Direct=(coordinator_coord_address.address, ),
        )
        real_coordinator_server.start()
        return real_coordinator_server
Ejemplo n.º 3
0
def create_coordinator_map():
    map = CoordInfo.CoordinationMap()

    login_t = SampleServerType.Login
    map.add_new_machine('machine0')
    map.add_new_instance('machine0', 'instance0')
    map.add_new_server('machine0', 'instance0', 'server0', login_t, ())
    map.add_new_server('machine0', 'instance0', 'server1', login_t, ())

    map.add_new_instance('machine0', 'instance1')
    map.add_new_server('machine0', 'instance1', 'server0', login_t, ())

    map.add_new_machine('machine1')
    map.add_new_instance('machine1', 'instance0')
    map.add_new_server('machine1', 'instance0', 'server0', login_t, ())

    # 4 servers
    # We are in machine0, instance0, server0

    # They all have Direct

    # 1st: address
    address1 = map['machine0']['instance0']['server0'].address
    address2 = map['machine0']['instance0']['server1'].address
    address3 = map['machine0']['instance1']['server0'].address
    address4 = map['machine1']['instance0']['server0'].address

    # 2nd: network
    direct_network1 = DirectNetwork.DirectNetwork(
        DirectAddress.from_coord_address(address1))
    direct_network2 = DirectNetwork.DirectNetwork(
        DirectAddress.from_coord_address(address2))
    direct_network3 = DirectNetwork.DirectNetwork(
        DirectAddress.from_coord_address(address3))
    direct_network4 = DirectNetwork.DirectNetwork(
        DirectAddress.from_coord_address(address4))

    # 3rd: accesses
    access_direct1 = Access.Access(Protocols.Direct, AccessLevel.instance,
                                   (direct_network1, ))
    access_direct2 = Access.Access(Protocols.Direct, AccessLevel.instance,
                                   (direct_network2, ))
    access_direct3 = Access.Access(Protocols.Direct, AccessLevel.instance,
                                   (direct_network3, ))
    access_direct4 = Access.Access(Protocols.Direct, AccessLevel.instance,
                                   (direct_network4, ))

    # 4th: appending accesses
    map.append_accesses('machine0', 'instance0', 'server0', (access_direct1, ))
    map.append_accesses('machine0', 'instance0', 'server1', (access_direct2, ))
    map.append_accesses('machine0', 'instance1', 'server0', (access_direct3, ))
    map.append_accesses('machine1', 'instance0', 'server0', (access_direct4, ))

    # They all have SOAP

    # 1st: address
    server_ip_address1 = SOAPAddress.Address('127.0.0.1:9025@NETWORK')
    server_ip_address2 = SOAPAddress.Address('127.0.0.1:9026@NETWORK')
    server_ip_address3 = SOAPAddress.Address('127.0.0.1:9027@NETWORK')
    server_ip_address4 = SOAPAddress.Address('127.0.0.1:9028@NETWORK')

    # 2nd: network
    soap_network1 = SOAPNetwork.SOAPNetwork(server_ip_address1)
    soap_network2 = SOAPNetwork.SOAPNetwork(server_ip_address2)
    soap_network3 = SOAPNetwork.SOAPNetwork(server_ip_address3)
    soap_network4 = SOAPNetwork.SOAPNetwork(server_ip_address4)

    # 3rd: accesses
    access_soap1 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                 (soap_network1, ))
    access_soap2 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                 (soap_network2, ))
    access_soap3 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                 (soap_network3, ))
    access_soap4 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                 (soap_network4, ))

    # 4th: appending accesses
    map.append_accesses('machine0', 'instance0', 'server0', (access_soap1, ))
    map.append_accesses('machine0', 'instance0', 'server1', (access_soap2, ))
    map.append_accesses('machine0', 'instance1', 'server0', (access_soap3, ))
    map.append_accesses('machine1', 'instance0', 'server0', (access_soap4, ))
    return map
Ejemplo n.º 4
0
 def do_get_networks2(self, original_server_address, server_address):
     return [DirectNetwork.DirectNetwork(login_server1_address)]
Ejemplo n.º 5
0
        def test_with_coordinator(self):
            cfg_manager = ConfigurationManager.ConfigurationManager()
            cfg_manager.append_module(configuration_module)

            map = CoordInfo.CoordinationMap()

            login_t = SampleServerType.Login
            map.add_new_machine('machine0')
            map.add_new_instance('machine0', 'instance0')
            map.add_new_server('machine0', 'instance0', 'server0', login_t, ())
            map.add_new_server('machine0', 'instance0', 'server1', login_t, ())

            map.add_new_instance('machine0', 'instance1')
            map.add_new_server('machine0', 'instance1', 'server0', login_t, ())

            map.add_new_machine('machine1')
            map.add_new_instance('machine1', 'instance0')
            map.add_new_server('machine1', 'instance0', 'server0', login_t, ())

            # 4 servers
            # We are in machine0, instance0, server0

            # They all have Direct

            # 1st: address
            address1 = map['machine0']['instance0']['server0'].address
            address2 = map['machine0']['instance0']['server1'].address
            address3 = map['machine0']['instance1']['server0'].address
            address4 = map['machine1']['instance0']['server0'].address

            # 2nd: network
            direct_network1 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address1))
            direct_network2 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address2))
            direct_network3 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address3))
            direct_network4 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address4))

            # 3rd: accesses
            access_direct1 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network1, ))
            access_direct2 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network2, ))
            access_direct3 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network3, ))
            access_direct4 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network4, ))

            # 4th: appending accesses
            map.append_accesses('machine0', 'instance0', 'server0',
                                (access_direct1, ))
            map.append_accesses('machine0', 'instance0', 'server1',
                                (access_direct2, ))
            map.append_accesses('machine0', 'instance1', 'server0',
                                (access_direct3, ))
            map.append_accesses('machine1', 'instance0', 'server0',
                                (access_direct4, ))

            # They all have SOAP

            # 1st: address
            server_ip_address1 = SOAPAddress.Address('127.0.0.1:12345@NETWORK')
            server_ip_address2 = SOAPAddress.Address('127.0.0.1:12346@NETWORK')
            server_ip_address3 = SOAPAddress.Address('127.0.0.1:12347@NETWORK')
            server_ip_address4 = SOAPAddress.Address('127.0.0.1:12348@NETWORK')

            # 2nd: network
            soap_network1 = SOAPNetwork.SOAPNetwork(server_ip_address1)
            soap_network2 = SOAPNetwork.SOAPNetwork(server_ip_address2)
            soap_network3 = SOAPNetwork.SOAPNetwork(server_ip_address3)
            soap_network4 = SOAPNetwork.SOAPNetwork(server_ip_address4)

            # 3rd: accesses
            access_soap1 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network1, ))
            access_soap2 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network2, ))
            access_soap3 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network3, ))
            access_soap4 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network4, ))

            # 4th: appending accesses
            map.append_accesses('machine0', 'instance0', 'server0',
                                (access_soap1, ))
            map.append_accesses('machine0', 'instance0', 'server1',
                                (access_soap2, ))
            map.append_accesses('machine0', 'instance1', 'server0',
                                (access_soap3, ))
            map.append_accesses('machine1', 'instance0', 'server0',
                                (access_soap4, ))

            direct_coordinator = ServerSkel.factory(
                cfg_manager, (Protocols.Direct, Protocols.SOAP),
                coordinator_methods)

            class YetAnother(CoordinatorServer.CoordinatorServer,
                             direct_coordinator):
                def __init__(self, cfg_manager, map, *args, **kargs):
                    CoordinatorServer.CoordinatorServer.__init__(
                        self, cfg_manager, map, *args, **kargs)

            direct_login = ServerSkel.factory(
                cfg_manager, (Protocols.Direct, Protocols.SOAP), login_methods)
            coordinator_server_address = DirectAddress.Address(
                "machine0", "instance0", "server0")

            s1 = YetAnother(cfg_manager,
                            map,
                            Direct=(coordinator_server_address.address, ),
                            SOAP=('', 12345))
            s1.start()

            class YetAnother2(direct_login):
                def do_method1(self, arg):
                    return arg * 3

            s2 = YetAnother2(Direct=(address2.address, ), SOAP=('', 12346))
            s2.start()

            server_type_handler = ServerTypeHandler.ServerTypeHandler(
                SampleServerType, {
                    'Login': login_methods,
                    'Coordinator': coordinator_methods,
                    'YetAnother': []
                })

            locator = ServerLocator.ServerLocator(coordinator_server_address,
                                                  server_type_handler)
            login_server = locator.get_server(
                coordinator_server_address.address, SampleServerType.Login,
                None)

            full_name = '%s.%s' % (login_server.__class__.__module__,
                                   login_server.__class__.__name__)
            self.assertEquals(
                'voodoo.gen.protocols.Direct.ClientDirect.ClientDirect',
                full_name)

            msg = "hello"
            answer = login_server.method1(msg)
            self.assertEquals(msg * 3, answer)

            other_login_server = locator.get_server(
                coordinator_server_address.address, SampleServerType.Login,
                None)

            # It will ask for it from the cache
            self.assertEquals(login_server, other_login_server)

            # Let's say that the login server is broken
            locator.inform_server_not_working(login_server,
                                              SampleServerType.Login, None)

            old_test_me = YetAnother2.do_test_me

            def wrong_test_me(self, arg):
                YetAnother2.do_test_me = old_test_me
                return arg * 2

            YetAnother2.do_test_me = wrong_test_me

            yet_another_login_server = locator.get_server(
                coordinator_server_address.address, SampleServerType.Login,
                None)

            self.assertNotEquals(login_server, yet_another_login_server)

            full_name = '%s.%s' % (
                yet_another_login_server.__class__.__module__,
                yet_another_login_server.__class__.__name__)
            self.assertEquals(
                'voodoo.gen.protocols.SOAP.ClientSOAP.ClientSOAP', full_name)

            answer = yet_another_login_server.method1(msg)
            self.assertEquals(msg * 3, answer)

            def wrong_test_me_forever(self, arg):
                return arg * 2

            YetAnother2.do_test_me = wrong_test_me_forever

            locator.inform_server_not_working(yet_another_login_server,
                                              SampleServerType.Login, None)

            return  # TODO:

            # YetAnother2 doesn't work anymore, and the other two ports are not going to work
            self.assertRaises(LocatorErrors.NoServerFoundError,
                              locator.get_server,
                              coordinator_server_address.address,
                              SampleServerType.Login, None)
Ejemplo n.º 6
0
    def test_get_servers(self):
        # Create map, machine and instance
        map = CoordInfo.CoordinationMap()


        # Create servers

        # There are gonna be:
        # 2 machines, each machine with:
        # 2 instances, each instance with:
        # 2 servers, one of Login, the other of Coordinator. each one has:
        # 2 protocols
        #
        # 1st protocol) direct network
        # 2nd protocol) SOAP network, with IP number:
        #       192.168.0.$(machine_number):$(PORT):NETWORK
        #

        for machine_num in range(2):
            map.add_new_machine('machine' + str(machine_num))
            for instance_num in range(2):
                map.add_new_instance(
                        'machine' + str(machine_num),
                        'instance' + str(instance_num)
                    )
                for server_num in range(2):
                    if server_num % 2 == 0:
                        server_type = ServerType.Login
                    else:
                        server_type = ServerType.Coordinator

                    map.add_new_server(
                        'machine' + str(machine_num),
                        'instance' + str(instance_num),
                        'server' + str(server_num),
                        server_type,
                        ()
                    )
                    # 1st: address
                    address = map['machine' + str(machine_num)
                        ]['instance' + str(instance_num)
                        ]['server' + str(server_num)
                        ].address
                    # 2nd: network
                    dir_addr = DirectAddress.from_coord_address(address)
                    network = DirectNetwork.DirectNetwork(
                        dir_addr
                    )

                    # 3rd: access
                    access_direct = Access.Access(
                                Protocols.Direct,
                                AccessLevel.instance,
                                (network,)
                            )
                    # 1st: address
                    server_ip_address1 = SOAPAddress.Address(
                        '192.168.0.%i:%i@NETWORK'
                        % (
                            machine_num + 1,
                            8000 + machine_num * 100
                            + instance_num * 10
                            + server_num
                        )
                    )
                    # 2nd: network
                    server_soap_network1 = SOAPNetwork.SOAPNetwork(
                        server_ip_address1
                    )

                    # access
                    access_soap = Access.Access(
                            Protocols.SOAP,
                            AccessLevel.network,
                            (
                                server_soap_network1,
                            )
                        )

                    # append accesses to the server
                    map.append_accesses(
                        'machine' + str(machine_num),
                        'instance' + str(instance_num),
                        'server' + str(server_num),
                        (
                            access_direct,
                            access_soap
                        )
                    )

        server = map['machine1']['instance0']['server0']
        it = map.get_servers(server,ServerType.Coordinator)

        server,networks  = it.next()
        self.assertEquals(server,map['machine1']['instance0']['server1'])
        self.assertEquals(len(networks),2)
        self.assertEquals(
                networks[0].address.address,
                'server1:instance0@machine1'
            )
        self.assertEquals(
                networks[1].address.address,
                '192.168.0.2:8101'
            )

        server,networks  = it.next()
        self.assertEquals(server,map['machine1']['instance1']['server1'])
        self.assertEquals(len(networks),1)
        self.assertEquals(
                networks[0].address.address,
                '192.168.0.2:8111'
            )

        server,networks  = it.next()
        self.assertEquals(server,map['machine0']['instance0']['server1'])
        self.assertEquals(len(networks),1)
        self.assertEquals(
                networks[0].address.address,
                '192.168.0.1:8001'
            )

        server,networks  = it.next()
        self.assertEquals(len(networks),1)
        self.assertEquals(server,map['machine0']['instance1']['server1'])
        self.assertEquals(
                networks[0].address.address,
                '192.168.0.1:8011'
            )

        self.assertRaises(StopIteration,it.next)
Ejemplo n.º 7
0
    def test_accesses(self):
        # Create map, machine and instance
        map = CoordInfo.CoordinationMap()
        map.add_new_machine('machine')
        map.add_new_instance('machine','instance')
        # Create servers
        map.add_new_server(
                'machine',
                'instance',
                'server1',
                ServerType.Login,
                ()
            )
        map.add_new_server(
                'machine',
                'instance',
                'server2',
                ServerType.Login,
                ()
            )

        # Create accesses for server1

        # 1st: address
        server1_address = map['machine']['instance']['server1'].address

        # 2nd: network
        server1_direct_address = DirectAddress.from_coord_address(server1_address)
        server1_direct_network = DirectNetwork.DirectNetwork(server1_direct_address)

        # 3rd: access
        access1_direct = Access.Access(
                    Protocols.Direct,
                    AccessLevel.instance,
                    (server1_direct_network,)
                )

        # 1st: address
        server1_ip_address1 = SOAPAddress.Address(
                '192.168.0.1:8080@NETWORK1'
            )
        # 2nd: network
        server1_soap_network1 = SOAPNetwork.SOAPNetwork(
                server1_ip_address1
            )

        # 1st: address
        server1_ip_address2 = SOAPAddress.Address(
                '130.206.137.60:8080@NETWORK2'
            )

        # 2nd: network
        server1_soap_network2 = SOAPNetwork.SOAPNetwork(
                server1_ip_address2
            )

        # access (with two networks)
        access1_soap = Access.Access(
                    Protocols.SOAP,
                    AccessLevel.network,
                    (
                        server1_soap_network1,
                        server1_soap_network2
                    )
                )

        # append accesses to the server
        map.append_accesses('machine', 'instance', 'server1',
                (
                    access1_direct,
                    access1_soap
                )
            )

        # Same with the other server
        server2_address = map['machine']['instance']['server2'].address
        server2_direct_address = DirectAddress.from_coord_address(server2_address)
        server2_direct_network = DirectNetwork.DirectNetwork(server2_direct_address)


        access2_direct = Access.Access(
                    Protocols.Direct,
                    AccessLevel.instance,
                    (server2_direct_network,)
                )

        # 1st: address
        server2_ip_address1 = SOAPAddress.Address(
                '192.168.0.2:8080@NETWORK1'
            )
        # 2nd: network
        server2_soap_network1 = SOAPNetwork.SOAPNetwork(
                server2_ip_address1
            )

        # 1st: address
        server2_ip_address2 = SOAPAddress.Address(
                '130.206.137.61:8080@NETWORK3'
            )

        # 2nd: network
        server2_soap_network2 = SOAPNetwork.SOAPNetwork(
                server2_ip_address2
            )

        access2_soap = Access.Access(
                    Protocols.SOAP,
                    AccessLevel.network,
                    (
                        server2_soap_network1,
                        server2_soap_network2
                    )
                )

        map.append_accesses('machine', 'instance', 'server2',
                (
                    access2_direct,
                    access2_soap
                )
            )

        # Now, check results

        server1 = map[server1_address]
        server2 = map[server2_address]

        networks = server1.can_connect(server2)
        # There should be only 2 networks (130.206.137.61:8080@NETWORK3 is
        # at NETWORK3, which is different to 130.206.137.60)
        self.assertEquals(len(networks),2)
        # First one: the direct one
        self.assertEquals(networks[0].address.address,'server2:instance@machine')
        # Second one: the network one
        self.assertEquals(networks[1].address.address,'192.168.0.2:8080')

        # Let's try exceptions...

        # Machine does not exist
        self.assertRaises(
                CoordErrors.CoordMachineNotFound,
                map.add_new_instance,
                'machine_not_exists',
                'instanceX'
            )

        # Instance does not exist
        self.assertRaises(
                CoordErrors.CoordInstanceNotFound,
                map.add_new_server,
                'machine',
                'instance_not_exists',
                'server',
                ServerType.Login,
                ()
            )

        # Server does not exist
        self.assertRaises(
                CoordErrors.CoordServerNotFound,
                map.append_accesses,
                'machine',
                'instance',
                'server_not_exists',
                ()
            )

        # Invalid key
        self.assertRaises(
                CoordErrors.CoordInvalidKey,
                lambda : map[5])

        self.assertRaises(CoordErrors.CoordInvalidKey,
                lambda : map['machine'][5])

        self.assertRaises(CoordErrors.CoordInvalidKey,
                lambda : map['machine']['instance'][5])
Ejemplo n.º 8
0
    def gen_coordination_map(self, protocols):
        map = CoordInfo.CoordinationMap()

        map.add_new_machine('WL_MACHINE1')
        map.add_new_instance('WL_MACHINE1', 'WL_SERVER1')
        map.add_new_server('WL_MACHINE1', 'WL_SERVER1', 'login1',
                           ServerType.Login, ())
        map.add_new_server('WL_MACHINE1', 'WL_SERVER1', 'ups1',
                           ServerType.UserProcessing, ())
        map.add_new_server('WL_MACHINE1', 'WL_SERVER1', 'coordinator1',
                           ServerType.Coordinator, ())
        map.add_new_server('WL_MACHINE1', 'WL_SERVER1', 'laboratory1',
                           ServerType.Laboratory, ())
        map.add_new_server('WL_MACHINE1', 'WL_SERVER1', 'experiment1',
                           ServerType.Experiment, (),
                           ('ud-fpga@FPGA experiments', ))
        map.add_new_server('WL_MACHINE1', 'WL_SERVER1', 'experiment2',
                           ServerType.Experiment, (),
                           ('ud-pld@PLD experiments', ))

        if len(protocols) == 1 and protocols[0] == Protocols.Direct:
            # They all have Direct

            # 1st: address
            address1 = map['WL_MACHINE1']['WL_SERVER1']['login1'].address
            address2 = map['WL_MACHINE1']['WL_SERVER1']['ups1'].address
            address3 = map['WL_MACHINE1']['WL_SERVER1']['coordinator1'].address
            address5 = map['WL_MACHINE1']['WL_SERVER1']['laboratory1'].address
            address7 = map['WL_MACHINE1']['WL_SERVER1']['experiment1'].address
            address8 = map['WL_MACHINE1']['WL_SERVER1']['experiment2'].address

            # 2nd: network
            direct_network1 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address1))
            direct_network2 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address2))
            direct_network3 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address3))
            direct_network5 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address5))
            direct_network7 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address7))
            direct_network8 = DirectNetwork.DirectNetwork(
                DirectAddress.from_coord_address(address8))

            # 3rd: accesses
            access_direct1 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network1, ))
            access_direct2 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network2, ))
            access_direct3 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network3, ))
            access_direct5 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network5, ))
            access_direct7 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network7, ))
            access_direct8 = Access.Access(Protocols.Direct,
                                           AccessLevel.instance,
                                           (direct_network8, ))

            # 4th: appending accesses
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'login1',
                                (access_direct1, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'ups1',
                                (access_direct2, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'coordinator1',
                                (access_direct3, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'laboratory1',
                                (access_direct5, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'experiment1',
                                (access_direct7, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'experiment2',
                                (access_direct8, ))

        else:
            # They all have SOAP

            # 1st: address
            address1 = SOAPAddress.Address('127.0.0.1:10025@NETWORK')
            address2 = SOAPAddress.Address('127.0.0.1:10026@NETWORK')
            address3 = SOAPAddress.Address('127.0.0.1:10027@NETWORK')
            address5 = SOAPAddress.Address('127.0.0.1:10029@NETWORK')
            address7 = SOAPAddress.Address('127.0.0.1:10031@NETWORK')
            address8 = SOAPAddress.Address('127.0.0.1:10032@NETWORK')

            # 2nd: network
            soap_network1 = SOAPNetwork.SOAPNetwork(address1)
            soap_network2 = SOAPNetwork.SOAPNetwork(address2)
            soap_network3 = SOAPNetwork.SOAPNetwork(address3)
            soap_network5 = SOAPNetwork.SOAPNetwork(address5)
            soap_network7 = SOAPNetwork.SOAPNetwork(address7)
            soap_network8 = SOAPNetwork.SOAPNetwork(address8)

            # 3rd: accesses
            access_soap1 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network1, ))
            access_soap2 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network2, ))
            access_soap3 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network3, ))
            access_soap5 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network5, ))
            access_soap7 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network7, ))
            access_soap8 = Access.Access(Protocols.SOAP, AccessLevel.network,
                                         (soap_network8, ))

            # 4th: appending accesses
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'login1',
                                (access_soap1, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'ups1',
                                (access_soap2, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'coordinator1',
                                (access_soap3, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'laboratory1',
                                (access_soap5, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'experiment1',
                                (access_soap7, ))
            map.append_accesses('WL_MACHINE1', 'WL_SERVER1', 'experiment2',
                                (access_soap8, ))

        return map