[mk] Add common functions for tempest run

- Use docker tempest image to setup tempest and execute it

Change-Id: If99a6964ea07e509487b1efb8773c295102ffe02
diff --git a/src/com/mirantis/mk/Test.groovy b/src/com/mirantis/mk/Test.groovy
index 9d239d2..702fb76 100644
--- a/src/com/mirantis/mk/Test.groovy
+++ b/src/com/mirantis/mk/Test.groovy
@@ -27,3 +27,32 @@
     salt.runSaltProcessStep(master, 'cfg01*', 'cmd.run', ["scp ctl01:/root/${image}.output /home/ubuntu/"])
 }
 
+/**
+ * Execute tempest tests
+ *
+ * @param tempestLink   Docker image link with rally and tempest
+ */
+def runTempestTests(master, tempestLink) {
+    def salt = new com.mirantis.mk.Salt()
+    salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["docker run --rm --net=host " +
+                                                          "-e TEMPEST_CONF=mcp.conf " +
+                                                          "-e SKIP_LIST=mcp_skip.list " +
+                                                          "-e SOURCE_FILE=keystonercv3 " +
+                                                          "-v /root/:/home/rally ${tempestLink} >> docker-tempest.log"])
+}
+
+/**
+ * Upload results to worker
+ *
+ */
+def copyTempestResults(master) {
+    def salt = new com.mirantis.mk.Salt()
+    salt.runSaltProcessStep(master, 'ctl01*', 'cmd.run', ["scp /root/docker-tempest.log cfg01:/home/ubuntu/ && " +
+                                                          "find /root -name result.xml -exec scp {} cfg01:/home/ubuntu \\;"])
+}
+
+
+/**
+ * Upload results to testrail
+ *
+ */
\ No newline at end of file