Add get_param_heat_template.py

get_param_heat_template.py is used to extract a default parameter
from a heat template .hot or heat template environment file .env

Related-task: #PROD-27687
Change-Id: I2c0f649e26e60e086df99d3086894685a9d79424
diff --git a/tcp_tests/fixtures/config_fixtures.py b/tcp_tests/fixtures/config_fixtures.py
index 973e034..8026e5b 100644
--- a/tcp_tests/fixtures/config_fixtures.py
+++ b/tcp_tests/fixtures/config_fixtures.py
@@ -32,6 +32,8 @@
         for test_config in tests_configs.split(','):
             config_files.append(test_config)
 
+    LOG.info("\n" + "-" * 10 + " Initialize oslo.config variables with "
+             "defaults from environment" + "-" * 10)
     config_opts = settings_oslo.load_config(config_files)
 
     if os.path.isfile(config_opts.underlay.ssh_key_file):
diff --git a/tcp_tests/settings_oslo.py b/tcp_tests/settings_oslo.py
index 7fc8870..fa61884 100644
--- a/tcp_tests/settings_oslo.py
+++ b/tcp_tests/settings_oslo.py
@@ -22,8 +22,6 @@
 from tcp_tests.helpers import oslo_cfg_types as ct
 from tcp_tests import settings
 
-print("\n" + "-" * 10 + " Initialize oslo.config variables with defaults"
-      " from environment" + "-" * 10)
 
 _default_conf = pkg_resources.resource_filename(
     __name__, 'templates/{0}/underlay.yaml'.format(settings.LAB_CONFIG_NAME))
diff --git a/tcp_tests/utils/get_param_heat_template.py b/tcp_tests/utils/get_param_heat_template.py
new file mode 100755
index 0000000..9b8b236
--- /dev/null
+++ b/tcp_tests/utils/get_param_heat_template.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+import os
+import sys
+
+from heatclient.common import template_utils
+
+
+if len(sys.argv) <= 1:
+    print("Usage:\n"
+          "  export LAB_CONFIG_NAME=cookied-cicd-...  "
+          "# see directories in tcp_tests/templates/\n"
+          "  export LAB_PARAM_DEFAULTS=nnnn.env "
+          "# see files in tcp_tests/templates/_heat_environments")
+    sys.exit(1)
+
+sys.path.append(os.getcwd())
+try:
+    from tcp_tests import settings_oslo
+except ImportError:
+    print("ImportError: Run the application from the tcp-qa directory or "
+          "set the PYTHONPATH environment variable to directory which contains"
+          " ./tcp_tests")
+    sys.exit(1)
+
+config = settings_oslo.load_config([])
+
+template_file = config.hardware.heat_conf_path
+env_file = config.hardware.heat_env_path
+
+if not os.path.exists(template_file):
+    raise Exception("Heat template '{0}' not found!\n"
+                    "Please set the correct LAB_CONFIG_NAME with underlay.hot"
+                    .format(template_file))
+
+tpl_files, template = template_utils.get_template_contents(
+    template_file)
+
+if os.path.exists(env_file):
+    env_files_list = []
+    env_files, env = (
+        template_utils.process_multiple_environments_and_files(
+            env_paths=[env_file],
+            env_list_tracker=env_files_list))
+else:
+    env = {}
+
+parameter_name = sys.argv[1]
+parameter_value = env['parameter_defaults'].get(parameter_name)
+if parameter_value is None:
+    parameter_value = template['parameters'].get(parameter_name)
+    if parameter_value is None:
+        raise Exception("Parameter '{0}' not found in env file '{1}' "
+                        "and temlate file '{2}'"
+                        .format(parameter_name, env_file, template_file))
+
+print(parameter_value)