plugin: shell
id: miscellanea/submission-resources
depends:
 cpuinfo
 dmi
 dpkg
 lsb
 package
 requirements
 uname
 dmi_attachment
 sysfs_attachment
 udev_attachment
estimated_duration: 1.0
command: true
_description:
    A meta-job depending on the resources needed for a valid submission.

plugin: manual
id: miscellanea/tester-info
_description:
 PURPOSE:
     Keep tester related information in the report
 STEPS:
     1. Tester Information
     2. Please enter the following information in the comments field:
        a. Name
        b. Email Address
        c. Reason for this test run
 VERIFICATION:
     Nothing to verify for this test

plugin: user-interact-verify
id: miscellanea/chvt
requires:
 package.name == 'kbd'
user: root
command: cycle_vts
_description:
 PURPOSE:
     This test will check that the system can switch to a virtual terminal and back to X
 STEPS:
     1. Click "Test" to switch to another virtual terminal and then back to X
 VERIFICATION:
     Did your screen change temporarily to a text console and then switch back to your current session?

plugin: shell
id: miscellanea/fwts_test
estimated_duration: 1.2
requires:
  package.name == 'fwts'
user: root
_description:
 Run Firmware Test Suite (fwts) automated tests.
environ: PLAINBOX_SESSION_SHARE
command:
 fwts_test -l $PLAINBOX_SESSION_SHARE/fwts_results.log

plugin: attachment
id: miscellanea/fwts_results.log
command:
 [[ -e ${PLAINBOX_SESSION_SHARE}/fwts_results.log ]] && cat ${PLAINBOX_SESSION_SHARE}/fwts_results.log
_description: Attaches the FWTS results log to the submission

plugin: shell
id: miscellanea/ipmi_test
requires: package.name == 'ipmitool'
user: root
command: ipmi_test
_description:
 This will run some basic connectivity tests against a BMC, verifying that IPMI works.

plugin: shell
id: miscellanea/bmc_info
requires: package.name == 'ipmitool'
estimated_duration: 0.5
user: root
command: bmc_info
_description:
 This will gather some info about the BMC itself for diagnostic purposes.
_summary:
 Gather BMC Identification info

plugin: shell
id: miscellanea/is_laptop
user: root
_description:
    Determine if we need to run tests specific to portable computers that may not apply to desktops.
command: check_is_laptop

plugin: shell
id: miscellanea/apport-directory
requires: package.name == 'apport'
command: if [ -d /var/crash ]; then if [ $(find /var/crash -type f | grep -v .lock | wc -l) -eq 0 ]; then echo "/var/crash is empty"; else echo `ls /var/crash`; false; fi; else echo "/var/crash does not exist"; fi
_description:
 Test that the /var/crash directory doesn't contain anything. Lists the files contained within if it does, or echoes the status of the directory (doesn't exist/is empty)

plugin: shell
id: miscellanea/sources-list
command: sources_test $SOURCES_LIST "$REPOSITORIES"
_description: Checks that a specified sources list file contains the requested repositories

plugin: local
_summary: Automated job to generate the PXE verification test for each NIC.
id: miscellanea/pxe_boot
requires: device.category == 'NETWORK'
_description: Automated job to generate the PXE verification test for each NIC.
command:
 cat <<'EOF' | run_templates -s 'udev_resource | filter_templates -w "category=NETWORK" | awk "/path: / { print \$2 }" | xargs -n 1 sh -c "for i in \`ls /sys\$0/net 2>/dev/null\`; do echo \$0 \$i; done"'
 plugin: manual
 id: miscellanea/pxe_boot_$2
 description:
  PURPOSE:
    This test will verify that you have attempted to PXE boot this machine from
    the network device $2.
  STEPS:
    1. Prior to running this test, you should have attempted to boot this system via PXE on every Network Port available.
  VERIFICATION:
    1. Select Yes if you successfully used PXE boot this system using the NIC $2
    2. Select No if you did not attempt to PXE boot this system using the NIC $2
    3. Select No if you attempted to PXE boot via $2 and it failed for some reason.
 EOF

plugin: local
_summary: Automated job to generate the Remote Shared IPMI verification test for each NIC.
id: miscellanea/remote_shared_ipmi
requires: device.category == 'NETWORK'
_description: Automated job to generate the Remote Shared IPMI verification test for each NIC.
command:
 cat <<'EOF' | run_templates -s 'udev_resource | filter_templates -w "category=NETWORK" | awk "/path: / { print \$2 }" | xargs -n 1 sh -c "for i in \`ls /sys\$0/net 2>/dev/null\`; do echo \$0 \$i; done"'
 plugin: manual
 id: miscellanea/remote_shared_ipmi_$2
 description:
  PURPOSE:
    This test will verify that you have attempted IPMI control of this machine from the network device $2.
  STEPS:
    1. Prior to running this test, you should have configured and used IPMI to power this machine off and on using every Network Port available.
  VERIFICATION:
    1. Select Yes if you successfully used IPMI to remotely power this system off and on using the NIC $2
    2. Select No if you did not attempt to use IPMI to remotely power this sytem off and on via the NIC $2
    3. Select No if you attempted to use IPMI to remotely power off/on this system via $2 and it failed for some reason.
 EOF

plugin: manual
id: miscellanea/remote_dedicated_ipmi
_description:
 PURPOSE:
  Some systems do not share IPMI over all NICs but instead have a dedicated management port directly connected to the BMC.  This test verifies that you have used that port for remote IPMI connections and actions.
 STEPS:
  1. Prior to running the test, you should have configured and used the Dedicated Management Port to remotely power off/on this sytem.
 VERIFICATION:
  Skip this test if this system ONLY uses shared management/ethernet ports OR if this system does not have a BMC (Management Console)
  1. Select Yes if you successfully used IPMI to remotely power this system off and on using the dedicated management port.
  2. Select No if you attempted to use the dedicated management port to remotely power this system off/on and it failed for some reason.

plugin:shell
id: miscellanea/oops
estimated_duration: 10.0
requires:
  package.name == 'fwts'
user: root
_description:
 Run Firmware Test Suite (fwts) oops tests.
environ: PLAINBOX_SESSION_SHARE
command:
 fwts_test -l $PLAINBOX_SESSION_SHARE/fwts_oops_results.log -t oops

plugin: attachment
estimated_duration: 0.5
id: miscellanea/oops_results.log
command:
 [ -e ${PLAINBOX_SESSION_SHARE}/fwts_oops_results.log ] && cat ${PLAINBOX_SESSION_SHARE}/fwts_oops_results.log
_description: Attaches the FWTS oops results log to the submission

plugin: shell
estimated_duration: 0.1
id: miscellanea/get_maas_version
command:
 if [ -e /etc/installed-by-maas ]; then 
   cat /etc/installed-by-maas
 else
   echo "NOT FOUND" >> /dev/stderr
   false
 fi
_description: If system was installed via MAAS from a cert server, the MAAS version used should be contained in /etc/installed-by-maas
_summary: Gets the version of MAAS used to deploy the SUT

plugin: shell
estimated_duration: 30.0
id: miscellanea/get_make_and_model
user: root
command: get_make_and_model
_description: Retrieve the computer's make and model for easier access than digging through the dmidecode output.
_summary: Retrieve the computer's make and model
