本文整理汇总了Python中lava_dispatcher.action.Pipeline.add_action方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.add_action方法的具体用法?Python Pipeline.add_action怎么用?Python Pipeline.add_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lava_dispatcher.action.Pipeline
的用法示例。
在下文中一共展示了Pipeline.add_action方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BootCMSISRetry
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class BootCMSISRetry(RetryAction):
name = "boot-cmsis-retry"
description = "boot cmsis usb image with retry"
summary = "boot cmsis usb image with retry"
def validate(self):
super(BootCMSISRetry, self).validate()
method_params = self.job.device['actions']['boot']['methods']['cmsis-dap']['parameters']
usb_mass_device = method_params.get('usb_mass_device', None)
if not usb_mass_device:
self.errors = "usb_mass_device unset"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
method_params = self.job.device['actions']['boot']['methods']['cmsis-dap']['parameters']
usb_mass_device = method_params.get('usb_mass_device', None)
resets_after_flash = method_params.get('resets_after_flash', True)
if self.job.device.hard_reset_command:
self.internal_pipeline.add_action(ResetDevice())
self.internal_pipeline.add_action(WaitDevicePathAction(usb_mass_device))
self.internal_pipeline.add_action(FlashCMSISAction())
if resets_after_flash:
self.internal_pipeline.add_action(WaitUSBSerialDeviceAction())
self.internal_pipeline.add_action(ConnectDevice())
示例2: _make_pipeline
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
def _make_pipeline(self, params):
pipeline = Pipeline()
auto_login = AutoLoginAction()
auto_login.section = "internal"
auto_login.parameters = params
pipeline.add_action(auto_login)
return pipeline
示例3: MountAction
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class MountAction(DeployAction):
"""
Depending on the type of deployment, this needs to perform
an OffsetAction, LoopCheckAction, LoopMountAction
"""
name = "mount-action"
description = "mount with offset"
summary = "mount loop"
def __init__(self, key):
super(MountAction, self).__init__()
self.key = key
def populate(self, parameters):
"""
Needs to take account of the deployment type / image type etc.
to determine which actions need to be added to the internal pipeline
as part of the deployment selection step.
"""
if not self.job:
raise LAVABug("No job object supplied to action")
# FIXME: not all mount operations will need these actions
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(OffsetAction(self.key))
# FIXME: LoopCheckAction and LoopMountAction should be in only one Action
self.internal_pipeline.add_action(LoopCheckAction(self.key))
self.internal_pipeline.add_action(LoopMountAction(self.key))
示例4: TestShellRetry
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class TestShellRetry(RetryAction):
name = "lava-test-retry"
description = "Retry wrapper for lava-test-shell"
summary = "Retry support for Lava Test Shell"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(TestShellAction())
示例5: BootCMSIS
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class BootCMSIS(BootAction):
name = "boot-cmsis"
description = "boot cmsis usb image"
summary = "boot cmsis usb image"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(BootCMSISRetry())
示例6: BootDockerRetry
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class BootDockerRetry(RetryAction):
name = 'boot-docker-retry'
description = "boot docker image with retry"
summary = "boot docker image"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(CallDockerAction())
示例7: BootQemuRetry
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class BootQemuRetry(RetryAction):
name = 'boot-qemu-image'
description = "boot image using QEMU command line"
summary = "boot QEMU image"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(CallQemuAction())
示例8: BootDFU
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class BootDFU(BootAction):
name = 'boot-dfu-image'
description = "boot dfu image with retry"
summary = "boot dfu image with retry"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(BootDFURetry())
示例9: UnmountAction
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class UnmountAction(RetryAction):
name = "umount-retry"
description = "retry support for umount"
summary = "retry umount"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(Unmount())
示例10: InternalRetryAction
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class InternalRetryAction(RetryAction):
section = 'internal'
name = "internal-retry-action"
description = "internal, do not use outside unit tests"
summary = "internal retry action for unit tests"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job)
self.internal_pipeline.add_action(TestAction.FakeAction(), parameters)
示例11: test_overlay_action
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
def test_overlay_action(self): # pylint: disable=too-many-locals
parameters = {
'device_type': 'd02',
'job_name': 'grub-standard-ramdisk',
'job_timeout': '15m',
'action_timeout': '5m',
'priority': 'medium',
'actions': {
'boot': {
'method': 'grub',
'commands': 'ramdisk',
'prompts': ['linaro-test', '[email protected]:~#']
},
'deploy': {
'ramdisk': 'initrd.gz',
'kernel': 'zImage',
'dtb': 'broken.dtb'
}
}
}
device = NewDevice(os.path.join(os.path.dirname(__file__), '../devices/d02-01.yaml'))
job = Job(4212, parameters, None)
job.device = device
pipeline = Pipeline(job=job, parameters=parameters['actions']['boot'])
job.pipeline = pipeline
overlay = BootloaderCommandOverlay()
pipeline.add_action(overlay)
ip_addr = dispatcher_ip(None)
parsed = []
kernel = parameters['actions']['deploy']['kernel']
ramdisk = parameters['actions']['deploy']['ramdisk']
dtb = parameters['actions']['deploy']['dtb']
substitution_dictionary = {
'{SERVER_IP}': ip_addr,
# the addresses need to be hexadecimal
'{RAMDISK}': ramdisk,
'{KERNEL}': kernel,
'{DTB}': dtb
}
params = device['actions']['boot']['methods']
commands = params['grub']['ramdisk']['commands']
self.assertIn('net_bootp', commands)
self.assertIn("linux (tftp,{SERVER_IP})/{KERNEL} console=ttyS0,115200 earlycon=uart8250,mmio32,0x80300000 root=/dev/ram0 ip=dhcp", commands)
self.assertIn('initrd (tftp,{SERVER_IP})/{RAMDISK}', commands)
self.assertIn('devicetree (tftp,{SERVER_IP})/{DTB}', commands)
params['grub']['ramdisk']['commands'] = substitute(params['grub']['ramdisk']['commands'], substitution_dictionary)
substituted_commands = params['grub']['ramdisk']['commands']
self.assertIs(type(substituted_commands), list)
self.assertIn('net_bootp', substituted_commands)
self.assertNotIn("linux (tftp,{SERVER_IP})/{KERNEL} console=ttyS0,115200 earlycon=uart8250,mmio32,0x80300000 root=/dev/ram0 ip=dhcp", substituted_commands)
self.assertIn("linux (tftp,%s)/%s console=ttyS0,115200 earlycon=uart8250,mmio32,0x80300000 root=/dev/ram0 ip=dhcp" % (ip_addr, kernel), substituted_commands)
self.assertNotIn('initrd (tftp,{SERVER_IP})/{RAMDISK}', parsed)
self.assertNotIn('devicetree (tftp,{SERVER_IP})/{DTB}', parsed)
示例12: BootQEMUImageAction
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class BootQEMUImageAction(BootAction):
name = 'boot-image-retry'
description = "boot image with retry"
summary = "boot with retry"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
self.internal_pipeline.add_action(BootQemuRetry())
if self.has_prompts(parameters):
self.internal_pipeline.add_action(AutoLoginAction())
if self.test_has_shell(parameters):
self.internal_pipeline.add_action(ExpectShellSession())
if 'transfer_overlay' in parameters:
self.internal_pipeline.add_action(OverlayUnpack())
self.internal_pipeline.add_action(ExportDeviceEnvironment())
示例13: ResetDevice
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class ResetDevice(Action):
"""
Used within a RetryAction - first tries 'reboot' then
tries PDU.
"""
name = "reset-device"
description = "reboot or power-cycle the device"
summary = "reboot the device"
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
if self.job.device.hard_reset_command:
self.internal_pipeline.add_action(PDUReboot())
else:
self.internal_pipeline.add_action(SendRebootCommands())
示例14: DockerAction
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
class DockerAction(DeployAction):
name = "deploy-docker"
description = "deploy docker images"
summary = "deploy docker"
def validate(self):
super(DockerAction, self).validate()
which("docker")
# Print docker version
try:
out = subprocess.check_output(["docker", "version", "-f", "{{.Server.Version}}"])
out = out.decode("utf-8", errors="replace").strip("\n")
self.logger.debug("docker server, installed at version: %s", out)
out = subprocess.check_output(["docker", "version", "-f", "{{.Client.Version}}"])
out = out.decode("utf-8", errors="replace").strip("\n")
self.logger.debug("docker client, installed at version: %s", out)
except subprocess.CalledProcessError as exc:
raise InfrastructureError("Unable to call '%s': %s" % (exc.cmd, exc.output))
except OSError:
raise InfrastructureError("Command 'docker' does not exist")
# check docker image name
# The string should be safe for command line inclusion
image_name = self.parameters["image"]
if re.compile("^[a-z0-9._:/-]+$").match(image_name) is None:
self.errors = "image_name '%s' is invalid" % image_name
self.set_namespace_data(action=self.name, label='image',
key='name', value=image_name)
def populate(self, parameters):
self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
if self.test_needs_deployment(parameters):
self.internal_pipeline.add_action(DeployDeviceEnvironment())
if self.test_needs_overlay(parameters):
self.internal_pipeline.add_action(OverlayAction())
def run(self, connection, max_end_time, args=None):
# Pull the image
cmd = ["docker", "pull", self.parameters["image"]]
out = self.run_command(cmd, allow_fail=False, allow_silent=False)
if not out:
msg = "Unable to pull docker image '%s'" % self.parameters["image"]
raise JobError(msg)
return super(DockerAction, self).run(connection, max_end_time, args)
示例15: test_overlay_action
# 需要导入模块: from lava_dispatcher.action import Pipeline [as 别名]
# 或者: from lava_dispatcher.action.Pipeline import add_action [as 别名]
def test_overlay_action(self): # pylint: disable=too-many-locals
parameters = {
'device_type': 'x86',
'job_name': 'ipxe-pipeline',
'job_timeout': '15m',
'action_timeout': '5m',
'priority': 'medium',
'actions': {
'boot': {
'method': 'ipxe',
'commands': 'ramdisk',
'prompts': ['linaro-test', '[email protected]:~#']
},
'deploy': {
'ramdisk': 'initrd.gz',
'kernel': 'zImage',
}
}
}
device = NewDevice(os.path.join(os.path.dirname(__file__), '../devices/x86-01.yaml'))
job = Job(4212, parameters, None)
job.device = device
pipeline = Pipeline(job=job, parameters=parameters['actions']['boot'])
job.pipeline = pipeline
overlay = BootloaderCommandOverlay()
pipeline.add_action(overlay)
ip_addr = dispatcher_ip(None)
kernel = parameters['actions']['deploy']['kernel']
ramdisk = parameters['actions']['deploy']['ramdisk']
substitution_dictionary = {
'{SERVER_IP}': ip_addr,
'{RAMDISK}': ramdisk,
'{KERNEL}': kernel,
'{LAVA_MAC}': "00:00:00:00:00:00"
}
params = device['actions']['boot']['methods']
params['ipxe']['ramdisk']['commands'] = substitute(params['ipxe']['ramdisk']['commands'], substitution_dictionary)
commands = params['ipxe']['ramdisk']['commands']
self.assertIs(type(commands), list)
self.assertIn("dhcp net0", commands)
self.assertIn("set console console=ttyS0,115200n8 lava_mac=00:00:00:00:00:00", commands)
self.assertIn("set extraargs init=/sbin/init ip=dhcp", commands)
self.assertNotIn("kernel tftp://{SERVER_IP}/{KERNEL} ${extraargs} ${console}", commands)
self.assertNotIn("initrd tftp://{SERVER_IP}/{RAMDISK}", commands)
self.assertIn("boot", commands)