--- /dev/null
+#!/usr/bin/python\r
+#\r
+# Copyright 2016 AT&T Intellectual Property, Inc\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+# http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+#\r
+\r
+import os\r
+import time\r
+import yaml\r
+\r
+import functest.utils.functest_logger as ft_logger\r
+import functest.utils.functest_utils as functest_utils\r
+\r
+with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:\r
+ functest_yaml = yaml.safe_load(f)\r
+\r
+dirs = functest_yaml.get('general').get('directories')\r
+FUNCTEST_REPO = dirs.get('dir_repo_functest')\r
+COPPER_REPO = dirs.get('dir_repo_copper')\r
+TEST_DB_URL = functest_yaml.get('results').get('test_db_url')\r
+\r
+logger = ft_logger.Logger("copper").getLogger()\r
+\r
+\r
+def main():\r
+ cmd = ('%s/tests/run.sh' % COPPER_REPO)\r
+ start_time = time.time()\r
+\r
+ ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)\r
+\r
+ stop_time = time.time()\r
+ duration = round(stop_time - start_time, 1)\r
+ if ret == 0:\r
+ logger.info("COPPER PASSED")\r
+ test_status = 'PASS'\r
+ else:\r
+ logger.info("COPPER FAILED")\r
+ test_status = 'FAIL'\r
+\r
+ details = {\r
+ 'timestart': start_time,\r
+ 'duration': duration,\r
+ 'status': test_status,\r
+ }\r
+ pod_name = functest_utils.get_pod_name(logger)\r
+ scenario = functest_utils.get_scenario(logger)\r
+ version = functest_utils.get_version(logger)\r
+ build_tag = functest_utils.get_build_tag(logger)\r
+\r
+ logger.info("Pushing COPPER results: TEST_DB_URL=%(db)s pod_name=%(pod)s "\r
+ "version=%(v)s scenario=%(s)s criteria=%(c)s details=%(d)s" % {\r
+ 'db': TEST_DB_URL,\r
+ 'pod': pod_name,\r
+ 'v': version,\r
+ 's': scenario,\r
+ 'c': details['status'],\r
+ 'b': build_tag,\r
+ 'd': details,\r
+ })\r
+ functest_utils.push_results_to_db("COPPER",\r
+ "COPPER-notification",\r
+ logger,\r
+ start_time,\r
+ stop_time,\r
+ details['status'],\r
+ details)\r
+\r
+if __name__ == '__main__':\r
+ main()\r