refactor: factor frequently-used run environment variables into getters

A number of variables are defined based on the value of run environment
variables (variables that the test configuration configures and sets in
the `artefacts/run/env` file). There are no helpers to help us keep
track of these and their default values across disjoint scripts, so
let's introduce some!

This introduces getters for the `num_uarts`, `primary_uart`,
`payload_uart` and `ports_script` run environment variables. These were
chosen because we need them in the next patch.

Signed-off-by: Chris Kay <chris.kay@arm.com>
Change-Id: I9ddf6f2fc769e023910652b3a3507f1896f97226
diff --git a/script/lava-templates/fvp-linux.yaml b/script/lava-templates/fvp-linux.yaml
index 2203d1b..f512690 100644
--- a/script/lava-templates/fvp-linux.yaml
+++ b/script/lava-templates/fvp-linux.yaml
@@ -62,11 +62,11 @@
       local: true
     image: ${model_dir}/${model_bin}
     version_string: ${version_string}
-    console_string: '${ports[${payload_uart:?}]:?}: Listening for serial connection on port (?P<PORT>\d+)'
+    console_string: '${ports[$(get_payload_uart "${archive}")]:?}: Listening for serial connection on port (?P<PORT>\d+)'
     feedbacks:
 
 $(for port in "${ports[@]}"; do
-	if [ "${port}" = "${ports[${payload_uart}]}" ]; then
+	if [ "${port}" = "${ports[$(get_payload_uart "${archive}")]}" ]; then
 		continue
 	fi
 
diff --git a/script/lava-templates/fvp-tftf.yaml b/script/lava-templates/fvp-tftf.yaml
index 8f41e9e..73d0a2e 100644
--- a/script/lava-templates/fvp-tftf.yaml
+++ b/script/lava-templates/fvp-tftf.yaml
@@ -75,11 +75,11 @@
       local: true
     image: ${model_dir}/${model_bin}
     version_string: ${version_string}
-    console_string: '${ports[${payload_uart:?}]:?}: Listening for serial connection on port (?P<PORT>\d+)'
+    console_string: '${ports[$(get_payload_uart "${archive}")]:?}: Listening for serial connection on port (?P<PORT>\d+)'
     feedbacks:
 
 $(for port in "${ports[@]}"; do
-	if [ "${port}" = "${ports[${payload_uart}]}" ]; then
+	if [ "${port}" = "${ports[$(get_payload_uart "${archive}")]}" ]; then
 		continue
 	fi