N1SDP: Run simple boot test on OpenCI

We will replace the full Linux test, which includes
some network and Linux functional tests, with a
simple boot test to validate build artifacts on OpenCI,
while retaining the comprehensive Linux test for internal CI.

Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: Idc01405b8f413132294e7fc90705b7da9271b30d
diff --git a/arm-env.sh b/arm-env.sh
index efdac7b..fdce21e 100644
--- a/arm-env.sh
+++ b/arm-env.sh
@@ -12,6 +12,7 @@
 nfs_volume="/arm"
 jenkins_url="http://jenkins.oss.arm.com"
 tfa_downloads="http://files.oss.arm.com/downloads/tf-a"
+ci_env="armci"
 
 # Source repositories.
 arm_gerrit_url="gerrit.oss.arm.com"
diff --git a/openci-env.sh b/openci-env.sh
index f96f584..edaa68c 100644
--- a/openci-env.sh
+++ b/openci-env.sh
@@ -12,3 +12,4 @@
 nfs_volume="${WORKSPACE:?}/nfs"
 jenkins_url="http://ci.trustedfirmware.org"
 tfa_downloads="https://downloads.trustedfirmware.org/tf-a"
+ci_env="openci"
diff --git a/openci-staging-env.sh b/openci-staging-env.sh
index d975da4..e64c8e4 100644
--- a/openci-staging-env.sh
+++ b/openci-staging-env.sh
@@ -12,3 +12,4 @@
 nfs_volume="${WORKSPACE:?}/nfs"
 jenkins_url="http://ci.staging.trustedfirmware.org"
 tfa_downloads="https://downloads.trustedfirmware.org/tf-a"
+ci_env="openci_staging"
diff --git a/run_config/n1sdp-fip.uefi b/run_config/n1sdp-fip.uefi
index ce9d6c5..023d7fa 100644
--- a/run_config/n1sdp-fip.uefi
+++ b/run_config/n1sdp-fip.uefi
@@ -14,6 +14,12 @@
 }
 
 generate_lava_job(){
-        target="n1sdp" payload_type="linux" gen_yaml_template
+        if [ "${ci_env}" = "armci" ]; then
+            payload_type="linux"
+        else
+            # Run simple boot test on OpenCI
+            payload_type="boot"
+        fi
+        target="n1sdp" payload_type="${payload_type}" gen_yaml_template
         gen_n1sdp_yaml
 }
diff --git a/run_config/n1sdp-linux b/run_config/n1sdp-linux
index 364982d..5b4479c 100644
--- a/run_config/n1sdp-linux
+++ b/run_config/n1sdp-linux
@@ -6,6 +6,12 @@
 #
 
 generate_lava_job(){
-        target="n1sdp" payload_type="linux" gen_yaml_template
+        if [ "${ci_env}" = "armci" ]; then
+            payload_type="linux"
+        else
+            # Run simple boot test on OpenCi
+            payload_type="boot"
+        fi
+        target="n1sdp" payload_type="${payload_type}" gen_yaml_template
         gen_n1sdp_yaml
 }
diff --git a/script/lava-templates/n1sdp-boot.yaml b/script/lava-templates/n1sdp-boot.yaml
new file mode 100644
index 0000000..cb5fb71
--- /dev/null
+++ b/script/lava-templates/n1sdp-boot.yaml
@@ -0,0 +1,51 @@
+device_type: n1sdp
+job_name: tf-n1sdp TF-A boot test
+timeouts:
+  job:
+    minutes: 15
+  action:
+    minutes: 10
+  connection:
+    minutes: 5
+
+priority: ${LAVA_PRIORITY:-medium}
+visibility: public
+actions:
+#
+# Any firmware bundle deployed must be configured to boot automatically without
+# intervention. This means "PMIC_FORCE" must be set "TRUE" in the config file
+# to be deployed.
+#
+
+#
+# Deploy the primary board firmware bundle
+#
+- deploy:
+    namespace: recovery
+    to: flasher
+    images:
+      recovery_image:
+        url: $recovery_img_url
+        compression: zip
+
+- boot:
+    namespace: recovery
+    timeout:
+        minutes: 2
+    method: minimal
+
+- boot:
+    namespace: uart_one
+    method: new_connection
+    connection: uart1
+
+- test:
+    namespace: uart_one
+    connection-namespace: uart_one
+    timeout:
+      minutes: 5
+    interactive:
+    - name: int_1
+      prompts: ["Press ESCAPE for boot options"]
+      script:
+      - command:
diff --git a/script/lava-templates/n1sdp-linux.yaml b/script/lava-templates/n1sdp-linux.yaml
index dab89c5..639bd71 100644
--- a/script/lava-templates/n1sdp-linux.yaml
+++ b/script/lava-templates/n1sdp-linux.yaml
@@ -24,7 +24,7 @@
     to: flasher
     images:
       recovery_image:
-        url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/n1sdp-board-firmware-force-netboot.zip
+        url: "$tfa_downloads/n1sdp/n1sdp-board-firmware-force-netboot.zip"
         compression: zip
 
 - deploy:
@@ -32,12 +32,12 @@
     to: tftp
     os: debian
     kernel:
-      url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/debian/linux
+      url: "$tfa_downloads/n1sdp/boot/linux"
       type: image
     ramdisk:
-      url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/debian/ramdisk.img
+      url: "$tfa_downloads/n1sdp/boot/ramdisk.img"
     nfsrootfs:
-      url: http://files.oss.arm.com/downloads/lava/health-checks/n1sdp/4/debian/debian-buster-arm64-rootfs.tar.xz
+      url: "$tfa_downloads/n1sdp/boot/debian-buster-arm64-rootfs.tar.xz"
       compression: xz
 
 - boot: