aboutsummaryrefslogtreecommitdiff
path: root/lava_scheduler_app/tests/device-types/base.jinja2
blob: ddc63a89568450bfb9f2ceadec57cc7d0b0dd64a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
{# Base Kernel options #}
{% set base_kernel_args = '' %}
{% set base_extra_nfsroot_args = extra_nfsroot_args | default('') %}

{% set base_nfsroot_args = ("nfsroot={NFS_SERVER_IP}:{NFSROOTFS},tcp,hard,intr" + base_extra_nfsroot_args) -%}
{% set base_nbdroot_args = ("nbd.server={NBDSERVERIP} nbd.port={NBDSERVERPORT} root=/dev/ram0 ramdisk_size=16384 rootdelay=7 ") -%}
{% set base_ip_args = base_ip_args|default("ip=dhcp") %}
{# these options are used by both ssh and scp! #}
{# check the manpages *carefully* & ensure compatibility! #}
{# Do not specify port or login (-p/-P or -l) here as this is now handled in the codebase. #}
{% set ssh_options = (
"          - '-o'
          - 'Compression=yes'
          - '-o'
          - 'PasswordAuthentication=no'
          - '-o'
          - 'LogLevel=FATAL'
"
) -%}

{% set ssh_user = 'root' -%}

{# The code will create the correct port arguments for SCP and SSH, as they are different #}
{% set ssh_port = '22' -%}

{# This is no longer a requirement, to support devices that allow login without authentication #}
{% set ssh_identity_file = 'dynamic_vm_keys/lava' -%}

{% set schroot_options = (
"          - 'schroot'
          - '-d'
          - '/'
          - '-u'
          - 'root'"
) -%}

{# UEFI menu support #}
{% set base_menu_interrupt_prompt = 'The default boot selection will start in' -%}
{% set base_menu_interrupt_string = ' ' -%}
{% set base_item_markup_list = (
'            - "["
            - "]"'
) -%}
{% set base_item_class = '0-9' -%}
{% set base_item_separator = ' ' -%}
{% set base_label_class = 'a-zA-Z0-9\s\:' -%}
{% set base_menu_bootloader_prompt = 'Start:' -%}
{% set base_menu_boot_message = "Loaded: LinuxImage" -%}
{% set base_menu_dictionary = {} -%}

{% block character_delays %}
{% if boot_character_delay or test_character_delay %}
character_delays:
{% if boot_character_delay %}
      boot: {{ boot_character_delay }}
{% endif -%}
{% if test_character_delay %}
      test: {{ test_character_delay }}
{% endif -%}
{% endif -%}
{% endblock character_delays -%}

{% block constants %}
constants:
  # bootloader specific
  u-boot:
    interrupt-prompt: '{{ uboot_autoboot_prompt | default("Hit any key to stop autoboot") }}'
    interrupt-character: '{{ uboot_interrupt_character | default(" ") }}'
    final-message: '{{ uboot_final_message | default("Starting kernel") }}'
    error-messages:
      - 'Resetting CPU'
      - 'Must RESET board to recover'
      - 'TIMEOUT'
      - 'Retry count exceeded'
      - 'ERROR: The remote end did not respond in time.'
  {% if uboot_extra_error_message %}
      - '{{ uboot_extra_error_message }}'
  {% endif -%}
  grub:
    interrupt-prompt: '{{ grub_autoboot_prompt | default("Press enter to boot the selected OS") }}'
    interrupt-character: '{{ grub_interrupt_character | default ("c") }}'
  grub-efi:
    interrupt-prompt: '{{ grub_autoboot_prompt | default("Press enter to boot the selected OS") }}'
    interrupt-character: '{{ grub_interrupt_character | default ("c") }}'
    error-messages:
      - 'Undefined OpCode Exception PC at'
      - 'Synchronous Exception at'
  ipxe:
    interrupt-prompt: '{{ ipxe_autoboot_prompt  | default("Press Ctrl-B for the iPXE command line") }}'
    interrupt_ctrl_list: {{ ipxe_interrupt_ctrl_list  | default(['b']) }}
    error-messages:
      - 'No configuration methods succeeded'
      - 'Connection timed out'

  # OS shutdown message
  # Override: set as the shutdown-message parameter of an Action.
  # SHUTDOWN_MESSAGE
  shutdown-message: '{{ shutdown_message | default("The system is going down for reboot NOW") }}'

  # Kernel starting message
  kernel-start-message: '{{ kernel_start_message | default('Linux version [0-9]') }}'

  # Default shell prompt for AutoLogin
  # DEFAULT_SHELL_PROMPT
  default-shell-prompt: '{{ default_shell_prompt | default("lava-test: # ") }}'

{% endblock constants -%}

{% block commands %}
{% if connection_command or user_commands or connection_list %}
commands:
{% if connection_command %}
    connect: {{ connection_command }}
{% elif connection_list %}
    connections:
{% for hardware in connection_list %}
        {{ hardware }}:
            connect: {{ connection_commands.get(hardware) }}
{% if hardware in connection_tags %}
            tags:
{% if connection_tags.get(hardware) is not string %}
{% for tag in connection_tags.get(hardware) %}
            - {{ tag }}
{% endfor -%}  {# tag #}
{% endif -%}  {# is list #}
{% endif -%}  {# if hardware #}
{% endfor %}
{% endif -%}
{% if hard_reset_command %}
    hard_reset: {{ hard_reset_command }}
{% endif -%}
{% if soft_reset_command %}
    soft_reset: {{ soft_reset_command }}
{% endif -%}
{% if soft_reboot_command %}
    soft_reboot: {{ soft_reboot_command }}
{% endif -%}
{% if power_off_command %}
    power_off: {{ power_off_command }}
{% endif %}
{% if power_on_command %}
    power_on: {{ power_on_command }}
{% endif %}
{% if pre_power_command %}
    pre_power_command: {{ pre_power_command }}
{% endif -%}
{% if pre_os_command %}
    pre_os_command: {{ pre_os_command }}
{% endif -%}
{% if user_commands %}
    users:
{% for name, command in user_commands.items() %}
      {{ name }}:
        do: {{ command['do'] }}
{% if 'undo' in command %}
        undo: {{ command['undo'] }}
{% endif %}
{% endfor %}

{% endif %}
{% endif %}
{% endblock commands -%}

{% if device_info %}
{# LXC support for dynamic devices over usb etc. #}
{# admins need to ensure that the device dictionary sets this as a list of dictionaries, where each dictionary value can contain keys such as 'board_id', 'usb_vendor_id', 'usb_product_id'  #}
device_info: {{ device_info }}
{% endif -%}

{% if static_info %}
{# LXC support for adding static devices like energy probes. #}
{# Also used for some phones which need to stay in the bootloader to charge. #}
{# admins need to ensure that the device dictionary sets this as a list of dictionaries, where each dictionary value can contain keys such as 'board_id', 'usb_vendor_id', 'usb_product_id'  #}
static_info: {{ static_info }}
{% endif -%}

{% if storage_info %}
{# Test shell support for exposing temporary storage. #}
{# admins need to ensure that the device dictionary sets this as a list of dictionaries,
where each dictionary value can contain method names such as 'SATA' with the corresponding
value of the block device ID such as '/dev/disk/by-id/ata-ST500DM002-1BD142_W3T79GCW' #}
storage_info: {{ storage_info }}
{% endif -%}

{% block fastboot %}
{% if fastboot_serial_number %}
flash_cmds_order: {{ flash_cmds_order|default(['update', 'ptable',
                     'partition', 'hyp', 'modem', 'rpm', 'sbl1', 'sbl2',
                     'sec', 'tz', 'aboot', 'boot', 'rootfs', 'vendor',
                     'system', 'cache', 'userdata']) }}
{% endif -%}
{% endblock fastboot -%}

{% block vland %}
parameters:
{% if interfaces or device_ip or device_mac %}
  interfaces:
{% if device_ip or device_mac %}
    target:
      ip: {{ device_ip|default('') }}
      mac: '{{ device_mac|default('') }}'
{% endif %}  # device_ip or device_mac
{% for interface in interfaces %}
    {{ interface }}:
      sysfs: "{{ sysfs.get(interface) }}"
      mac: "{{ mac_addr.get(interface) }}"
{% for switch, port in map.get(interface).items() %}
      switch: "{{ switch }}"
      port: {{ port }}
{% endfor %}  # switch, port
      tags:
{% if tags.get(interface) %}
{% for tag in tags.get(interface) %}
      - {{ tag }}
{% endfor %}
{% endif %}  # tags
{% endfor %}  # interfaces
{% endif %}  # interfaces or device_ip or device_mac

{% if sata_uuid or sd_uuid or usb_uuid %}
  media:
{% if sata_uuid %}
    sata:
      UUID-required: {{ uuid_required|default(True) }}
      {{ sata_label|default('ST160LM003') }}:
        uuid: {{ sata_uuid }}
        device_id: {{ sata_id|default(0) }}
{# FIXME: merge into just sata_interface with changes in lava-dispatcher #}
        uboot_interface: {{ sata_interface|default('scsi') }}
        grub_interface: {{ sata_interface|default('hd0') }}
        boot_part: {{ boot_part|default(1) }}
{% endif %} #  sata_uuid
{% if sd_uuid %}
    sd:
      {{ sd_label }}:
        uuid: {{ sd_uuid }}
        device_id: {{ sd_device_id }}  # the bootloader device id for this media on the 'sd' interface
{% endif %} #  sd_uuid
{% if usb_uuid %}
    usb:
      {{ usb_label|default('SanDisk_Ultra') }}:
        uuid: {{ usb_uuid }}  # /dev/disk/by-id/
        device_id: {{ usb_device_id }}  # the bootloader device id for this media on the 'usb' interface
{% endif %} # usb_uuid
{% else %}
  pass:
{%- endif %} # sata_uuid_sd_uuid_usb_uuid
{% endblock vland -%}

{% block body %}{% endblock body -%}

{% block timeouts %}
timeouts:
  actions:
    apply-overlay-image:
      minutes: {{ action_timeout_apply_overlay_image | default(2) }}
    dd-image:
      minutes: {{ action_timeout_dd_image | default(10) }}
    download-retry:
      minutes: {{ action_timeout_download_retry | default(5) }}
    http-download:
      minutes: {{ action_timeout_http_download | default(5) }}
    lava-test-shell:
      minutes: {{ action_timeout_lava_test_shell | default(3) }}
    nfs-deploy:
      minutes: {{ action_timeout_nfs_deploy | default(10) }}
    power-off:
      seconds: {{ action_timeout_power_off | default(5) }}
    bootloader-commands:
      minutes: {{ action_timeout_bootloader_commands | default(3) }}
    bootloader-interrupt:
      seconds: {{ action_timeout_bootloader_interrupt | default(30) }}
    u-boot-interrupt:
      seconds: {{ action_timeout_u_boot_interrupt | default(30) }}
    umount-retry:
      seconds: {{ action_timeout_umount_retry | default(45) }}
    auto-login-action:
      minutes: {{ action_timeout_auto_login | default(2) }}
    bootloader-action:
      minutes: {{ action_timeout_bootloader_action | default(3)}}
    uboot-action:
      minutes: {{ action_timeout_uboot_action | default(3)}}
    uboot-retry:
      minutes: {{ action_timeout_uboot_retry | default(3)}}
    bootloader-retry:
      minutes: {{ action_timeout_bootloader_retry | default(3)}}
    boot-qemu-image:
      minutes: {{ action_timeout_boot_qemu_image | default(2) }}
    boot-image-retry:
      minutes: {{ action_timeout_boot_image_retry | default(2) }}
  connections:
    dd-image:
      minutes: {{ connection_timeout_dd_image | default(10) }}
    uboot-retry:
      seconds: {{ connection_timeout_uboot_retry | default(30) }}
    bootloader-commands:
      seconds: {{ connection_timeout_bootloader_commands | default(30) }}
    auto-login-action:
      minutes: {{ connection_timeout_auto_login | default(2) }}
    bootloader-interrupt:
      seconds: {{ connection_timeout_bootloader_interrupt | default(30) }}
    u-boot-interrupt:
      seconds: {{ connection_timeout_u_boot_interrupt | default(30) }}
    lava-test-shell:
      seconds: {{ connection_timeout_feedback | default(10) }}
{% endblock timeouts -%}