Commit 8cb3a285 authored by chrissi^'s avatar chrissi^
Browse files

parker/strategy: add force-mode

parent eb787c27
......@@ -11,6 +11,7 @@ from labgrid.driver import SmallUBootDriver, ShellDriver, GpioDigitalOutputDrive
from labgrid.protocol import PowerProtocol
from labgrid.factory import target_factory
from labgrid.strategy.common import Strategy
from labgrid.step import step
with open("parker_test_config.yaml") as fh:
config = yaml.load(fh)
......@@ -36,7 +37,7 @@ states depend on each other.
"""
@target_factory.reg_driver
@attr.s(cmp=False)
@attr.s(eq=False)
class SmallUBootStrategy(Strategy):
"""UbootStrategy - Strategy to switch to uboot or shell"""
bindings = {
......@@ -51,7 +52,8 @@ class SmallUBootStrategy(Strategy):
def __attrs_post_init__(self):
super().__attrs_post_init__()
def transition(self, status):
@step(args=["status"])
def transition(self, status, *, step):
if not isinstance(status, Status):
status = Status[status]
if status == Status.unknown:
......@@ -193,6 +195,15 @@ class SmallUBootStrategy(Strategy):
status
))
@step(args=["status"])
def force(self, status, *, step):
if not isinstance(status, Status):
status = Status[status]
if status == Status.unknown:
raise StrategyError("can not force state {}".format(status))
elif status == Status.good_running:
self.target.activate(self.power)
self.target.activate(self.shell)
else:
raise StrategyError("not setup found for {}".format(status))
self.status = status
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment