# Simple example of a LAVA MultiNode test using two beaglebone-black devices
# and a cubietruck
job_name: Second MultiNode job - NFS

# Reasonable defaults for a simple job
timeouts:
  job:
    minutes: 30
  action:
    minutes: 5
  connection:
    minutes: 3
priority: medium
visibility: public

metadata:
  # please change these fields when modifying this job for your own tests.
  docs-source: writing-multinode
  docs-filename: second-multinode-job.yaml
  build-readme: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/debian-stretch-armmp-armhf-readme.html
  build-script: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/armmp-nfs.sh

# Very simple multinode definition for our example
# START-PROTOCOLS-BLOCK
protocols:
  lava-multinode:
    roles:
      server:
        device_type: cubietruck
        count: 1
      client:
        device_type: beaglebone-black
        count: 2
    timeout:
      minutes: 6
# END-PROTOCOLS-BLOCK

# START-DEPLOY-BLOCK
actions:
- deploy:
    role:
    - server
    timeout:
      minutes: 10
    to: tftp
    kernel:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/vmlinuz-4.9.0-4-armmp
      sha256sum: b6043cc5a07e2cead3f7f098018e7706ea7840eece2a456ba5fcfaddaf98a21e
      type: zimage
    ramdisk:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/initrd.img-4.9.0-4-armmp
      sha256sum: 4cc25f499ae74e72b5d74c9c5e65e143de8c2e3b019f5d1781abbf519479b843
      compression: gz
    modules:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/modules.tar.gz
      sha256sum: 10e6930e9282dd44905cfd3f3a2d5a5058a1d400374afb2619412554e1067d58
      compression: gz
    nfsrootfs:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/stretch-armhf-nfs.tar.gz
      sha256sum: 46d18f339ac973359e8ac507e5258b620709add94cf5e09a858d936ace38f698
      compression: gz
    dtb:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/dtbs/sun7i-a20-cubietruck.dtb
      sha256sum: b727c17dce4a67a865cbcd53447f7297e35ffbd18f0a99c7e9f8a10026237cea

- deploy:
    role:
    - client
    timeout:
      minutes: 10
    to: tftp
    kernel:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/vmlinuz-4.9.0-4-armmp
      sha256sum: b6043cc5a07e2cead3f7f098018e7706ea7840eece2a456ba5fcfaddaf98a21e
      type: zimage
    ramdisk:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/initrd.img-4.9.0-4-armmp
      sha256sum: 4cc25f499ae74e72b5d74c9c5e65e143de8c2e3b019f5d1781abbf519479b843
      compression: gz
    modules:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/modules.tar.gz
      sha256sum: 10e6930e9282dd44905cfd3f3a2d5a5058a1d400374afb2619412554e1067d58
      compression: gz
    nfsrootfs:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/stretch-armhf-nfs.tar.gz
      sha256sum: 46d18f339ac973359e8ac507e5258b620709add94cf5e09a858d936ace38f698
      compression: gz
    dtb:
      url: https://files.lavasoftware.org/components/lava/standard/debian/stretch/armhf/3/dtbs/am335x-boneblack.dtb
      sha256sum: c4c461712bf52af7d020e78678e20fc946f1d9b9552ef26fd07ae85c5373ece9
# END-DEPLOY-BLOCK

# START-BOOT-BLOCK
- boot:
    role:
    - client
    - server
    method: u-boot
    commands: nfs
    auto_login:
      login_prompt: 'login:'
      username: root
    prompts:
    - 'root@stretch:'
    timeout:
      minutes: 5
# END-BOOT-BLOCK

# START-TEST-CLIENT-BLOCK
- test:
    role:
    - client
    timeout:
      minutes: 5
    definitions:
    - repository:
        metadata:
          format: Lava-Test Test Definition 1.0
          name: client-wait
          description: "client waiting for server"
          os:
          - debian
        run:
          steps:
          - lava-test-case client --shell uname -a
          - lava-wait server_installed
      from: inline
      name: client-wait
      path: inline/client-wait.yaml
# END-TEST-CLIENT-BLOCK

# START-TEST-SERVER-BLOCK
- test:
    role:
    - server
    timeout:
      minutes: 5
    definitions:
    - repository:
        metadata:
          format: Lava-Test Test Definition 1.0
          name: apache-server
          description: "server installation"
          os:
          - debian
        run:
          steps:
          - apt -q update
          - apt -q -y install apache2
          - lava-test-case dpkg --shell dpkg -s apache2
          - lava-send server_installed
      from: inline
      name: apache-server
      path: inline/apache-server.yaml
# END-TEST-SERVER-BLOCK
