Fix runtestmanager for CICD deployments

In CICD deployments, there are no workarounds that install
docker.io before using 'runtest' formula.
Add preparation of necessary packages to runtestmanager.

- Refactor RuntestManager to use salt CLI instead of salt API
  because salt API dones't allow to catch errors from modules
- Add preparations for docker packages, Neutron private and
  public networks based on underlay.yaml address pools, etc.

Change-Id: Iaff8046b9cde6185cd6718a5c2064998ea7dc507
diff --git a/src/com/mirantis/system_qa/SharedPipeline.groovy b/src/com/mirantis/system_qa/SharedPipeline.groovy
index e4779cd..108ee0c 100644
--- a/src/com/mirantis/system_qa/SharedPipeline.groovy
+++ b/src/com/mirantis/system_qa/SharedPipeline.groovy
@@ -2,6 +2,19 @@
 
 import groovy.xml.XmlUtil
 
+def run_sh(String cmd) {
+    // run shell script without catching any output
+    def common = new com.mirantis.mk.Common()
+    common.printMsg("Run shell command:\n" + cmd, "blue")
+    def VENV_PATH='/home/jenkins/fuel-devops30'
+    script = """\
+        set -ex;
+        . ${VENV_PATH}/bin/activate;
+        bash -c '${cmd.stripIndent()}'
+    """
+    return sh(script: script)
+}
+
 def run_cmd(String cmd, Boolean returnStdout=false) {
     def common = new com.mirantis.mk.Common()
     common.printMsg("Run shell command:\n" + cmd, "blue")
@@ -115,6 +128,17 @@
         """)
 }
 
+def update_working_dir() {
+        // Use to fetch a patchset from gerrit to the working dir
+        run_cmd("""\
+            if [ -n "$TCP_QA_REFS" ]; then
+                set -e
+                git fetch https://review.gerrithub.io/Mirantis/tcp-qa $TCP_QA_REFS && git checkout FETCH_HEAD || exit \$?
+            fi
+            pip install -r tcp_tests/requirements.txt
+        """)
+}
+
 def swarm_bootstrap_salt_cluster_devops() {
         def common = new com.mirantis.mk.Common()
         def cookiecutter_template_commit = env.COOKIECUTTER_TEMPLATE_COMMIT ?: env.MCP_VERSION