Hello LAVA community,
I'm working with LAVA for automated testing of embedded systems with BMC (Baseboard Management Controller) and I've encountered a limitation that I'd like to ask about.
I'm testing devices that support Redfish API for power management. I need to execute various Redfish commands (forceoff, poweron, forcerestart, etc.) from the dispatcher during test jobs. Currently, I define these as user_commands in my device dictionary:
{% set user_commands = {
'redfish_forceoff': {
'do': '/opt/lava-lab/shared/lab-scripts/dispatcher_command.sh 192.168.17.111 forceoff'
},
'redfish_poweron': {
'do': '/opt/lava-lab/shared/lab-scripts/dispatcher_command.sh 192.168.17.111 poweron'
},
# ... more commands
} %}Then in my job file:
- command:
name: redfish_forceoffEvery time I need to add a new Redfish action, I must modify the device dictionary (Jinja file) to add a new user_command entry. I'd like users to be able to specify the action dynamically from the job file without requiring device configuration changes.
What I want to achieve:
# In job file - specify action dynamically
context:
redfish_action: forceoff
actions:
- command:
name: redfish_command # Generic command that uses context variable{IMAGE}), but this is hardcoded for deploy actions onlyI understand from the documentation that dispatcher commands are intentionally restricted for security reasons, which makes sense.
I'm using Jinja2 loops to auto-generate commands from a list:
{% set redfish_actions = ['auth_test', 'forceoff', 'poweron', 'forcerestart'] %}
{% set user_commands = {} %}
{% for action in redfish_actions %}
{% set _ = user_commands.update({'rf_' + action: {'do': rf_script + ' ' + action}}) %}
{% endfor %}This reduces the pain (just add one word to a list), but still requires device configuration edits.
{IMAGE}), while maintaining security constraints?Thank you for your time and for maintaining LAVA!
Best regards, Mor