Ejemplo n.º 1
0
    def getTarget(target_type, logger, target_ip, server_ip, **kwargs):
        target = None

        if target_ip:
            target_ip_port = target_ip.split(':')
            if len(target_ip_port) == 2:
                target_ip = target_ip_port[0]
                kwargs['port'] = target_ip_port[1]

        if server_ip:
            server_ip_port = server_ip.split(':')
            if len(server_ip_port) == 2:
                server_ip = server_ip_port[0]
                kwargs['server_port'] = int(server_ip_port[1])

        if target_type == 'simpleremote':
            target = OESSHTarget(logger, target_ip, server_ip, **kwargs)
        elif target_type == 'qemu':
            target = OEQemuTarget(logger, server_ip, **kwargs)
        else:
            # XXX: This code uses the old naming convention for controllers and
            # targets, the idea it is to leave just targets as the controller
            # most of the time was just a wrapper.
            # XXX: This code tries to import modules from lib/oeqa/controllers
            # directory and treat them as controllers, it will less error prone
            # to use introspection to load such modules.
            # XXX: Don't base your targets on this code it will be refactored
            # in the near future.
            # Custom target module loading
            target_modules_path = kwargs.get('target_modules_path', '')
            controller = OERuntimeTestContextExecutor.getControllerModule(
                target_type, target_modules_path)
            target = controller(logger, target_ip, server_ip, **kwargs)

        return target
Ejemplo n.º 2
0
    def getTarget(target_type, logger, target_ip, server_ip, **kwargs):
        target = None

        if target_type == 'simpleremote':
            target = OESSHTarget(logger, target_ip, server_ip, **kwargs)
        elif target_type == 'qemu':
            target = OEQemuTarget(logger, target_ip, server_ip, **kwargs)
        else:
            # XXX: This code uses the old naming convention for controllers and
            # targets, the idea it is to leave just targets as the controller
            # most of the time was just a wrapper.
            # XXX: This code tries to import modules from lib/oeqa/controllers
            # directory and treat them as controllers, it will less error prone
            # to use introspection to load such modules.
            # XXX: Don't base your targets on this code it will be refactored
            # in the near future.
            # Custom target module loading
            try:
                target_modules_path = kwargs.get('target_modules_path', '')
                controller = OERuntimeTestContextExecutor.getControllerModule(target_type, target_modules_path)
                target = controller(logger, target_ip, server_ip, **kwargs)
            except ImportError as e:
                raise TypeError("Failed to import %s from available controller modules" % target_type)

        return target
Ejemplo n.º 3
0
    def getTarget(target_type, logger, target_ip, server_ip, **kwargs):
        target = None

        if target_type == 'simpleremote':
            target = OESSHTarget(logger, target_ip, server_ip, **kwargs)
        elif target_type == 'qemu':
            target = OEQemuTarget(logger, target_ip, server_ip, **kwargs)
        else:
            # TODO: Implement custom target module loading
            raise TypeError("target_type %s isn't supported" % target_type)

        return target
Ejemplo n.º 4
0
    def getTarget(target_type, target_modules_path, logger, target_ip,
                  server_ip, **kwargs):
        target = None

        if target_type == 'simpleremote':
            target = OESSHTarget(logger, target_ip, server_ip, **kwargs)
        elif target_type == 'qemu':
            target = OEQemuTarget(logger, target_ip, server_ip, **kwargs)
        else:
            # Custom target module loading
            try:
                controller = OERuntimeTestContextExecutor.getControllerModule(
                    target_type, target_modules_path)
                target = controller(logger, target_ip, server_ip, **kwargs)
            except ImportError as e:
                raise TypeError(
                    "Failed to import %s from available controller modules" %
                    target_type)

        return target