Rename deprecated mcp_qa helpers to tcp_qa

https://mirantis.jira.com/browse/PROD-11772

Change-Id: I15506ab2bff258735e086a360860d0295a416411
diff --git a/src/com/mirantis/mcp_qa/EnvActions.groovy b/src/com/mirantis/mcp_qa/EnvActions.groovy
deleted file mode 100644
index bc88d64..0000000
--- a/src/com/mirantis/mcp_qa/EnvActions.groovy
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.mirantis.mcp_qa
-
-/**
- * Activate virtual environment and check k8s deployer is specified
- */
-
-def prepareEnv() {
-    sh '''
-        if [ ! -r "${VENV_PATH}/bin/activate" ]; then
-            echo 'Python virtual environment not found! Set correct VENV_PATH!'
-            exit 1
-        fi
-    '''
-
-    sh '''
-        if [ ! -r "${WORKSPACE}/fuel-ccp-installer/${DEPLOY_SCRIPT_REL_PATH}" ]; then
-            echo "Deploy script \"${DEPLOY_SCRIPT_REL_PATH}\" not found in" \
-            "\"${WORKSPACE}/fuel-ccp-installer/\"!"
-        fi
-    '''
-
-    sh '''
-        . ${VENV_PATH}/bin/activate
-        pip install --upgrade --upgrade-strategy=only-if-needed -r fuel_ccp_tests/requirements.txt
-    '''
-}
-
-/**
- * Destroy running environment
- */
-
-def destroyEnv() {
-    if ( !(env.KEEP_BEFORE.equals('yes') || env.KEEP_BEFORE.equals('true')) ) {
-        sh '''
-            . ${VENV_PATH}/bin/activate
-            dos.py destroy ${ENV_NAME} || true
-        '''
-    }
-}
-
-/**
- * Erase running environment
- */
-def eraseEnv() {
-        sh '''
-            . ${VENV_PATH}/bin/activate
-            dos.py erase ${ENV_NAME} || true
-        '''
-}
-
diff --git a/src/com/mirantis/mcp_qa/Common.groovy b/src/com/mirantis/tcp_qa/Common.groovy
similarity index 98%
rename from src/com/mirantis/mcp_qa/Common.groovy
rename to src/com/mirantis/tcp_qa/Common.groovy
index 22dcf81..817f893 100644
--- a/src/com/mirantis/mcp_qa/Common.groovy
+++ b/src/com/mirantis/tcp_qa/Common.groovy
@@ -1,4 +1,4 @@
-package com.mirantis.mcp_qa
+package com.mirantis.tcp_qa
 
 /**
  * Get latest artifacts
@@ -80,7 +80,7 @@
     def remote = "${gerritUrl}/${project}"
     dir(targetDir) {
         for(int i=0; i<refs.size(); i++) {
-            sh "git fetch ${remote} ${refs[i]} && git checkout FETCH_HEAD"
+            sh "git fetch ${remote} ${refs[i]} && git cherry-pick FETCH_HEAD"
         }
     }
 }
diff --git a/src/com/mirantis/tcp_qa/EnvActions.groovy b/src/com/mirantis/tcp_qa/EnvActions.groovy
new file mode 100644
index 0000000..add2c77
--- /dev/null
+++ b/src/com/mirantis/tcp_qa/EnvActions.groovy
@@ -0,0 +1,81 @@
+package com.mirantis.tcp_qa
+
+/**
+ * Activate virtual environment and update requirements if needed
+ */
+def prepareEnv() {
+    sh '''
+        if [ ! -r "${VENV_PATH}/bin/activate" ]; then
+            echo 'Python virtual environment not found! Set correct VENV_PATH!'
+            exit 1
+        fi
+    '''
+
+    sh '''
+        . ${VENV_PATH}/bin/activate
+        pip install --upgrade --upgrade-strategy=only-if-needed -r tcp_tests/requirements.txt
+    '''
+}
+
+
+/**
+ * Download an image for tests
+ */
+def prepareImage() {
+    sh '''
+      if [ -n "${IMAGE_LINK}" ]; then
+          IMAGE_FILE="$(basename "${IMAGE_LINK}")"
+          IMAGES_DIR="$(dirname "${IMAGE_PATH}")"
+          mkdir -p "${IMAGES_DIR}"
+          cd "${IMAGES_DIR}" && wget -N "${IMAGE_LINK}"
+          ln -sf "${IMAGES_DIR}/${IMAGE_FILE}" "${IMAGE_PATH}" || test -f "${IMAGE_PATH}"
+      fi
+
+      if [ ! -r "${IMAGE_PATH}" ]; then
+          echo "Image not found: ${IMAGE_PATH}"
+          exit 1
+      fi
+
+    '''
+}
+
+/**
+ * Check that bridge traffic is not filtered on the host
+ */
+def checkBridgeNetfilterDisabled () {
+    def res = sh(script: 'file /proc/sys/net/bridge/bridge-nf-call-iptables 2>/dev/null || echo "Not found"',
+                 returnStdout: true).trim()
+    if ( ! res.equals('Not found') ) {
+        res = sh(script: 'cat /proc/sys/net/bridge/bridge-nf-call-iptables',
+                     returnStdout: true).trim()
+        if ( ! res.equals('0') ) {
+             error("Kernel parameter 'net.bridge.bridge-nf-call-iptables' should be disabled to run the tests!")
+        }
+    } else {
+        echo("WARNING: it isn't possible to check net.bridge.bridge-nf-call-iptables value. Please make sure it is set to '0'!")
+    }
+}
+
+
+/**
+ * Destroy running environment
+ */
+def destroyEnv() {
+    if ( !(env.KEEP_BEFORE.equals('yes') || env.KEEP_BEFORE.equals('true')) ) {
+        sh '''
+            . ${VENV_PATH}/bin/activate
+            dos.py destroy ${ENV_NAME} || true
+        '''
+    }
+}
+
+/**
+ * Erase running environment
+ */
+def eraseEnv() {
+        sh '''
+            . ${VENV_PATH}/bin/activate
+            dos.py erase ${ENV_NAME} || true
+        '''
+}
+
diff --git a/src/com/mirantis/mcp_qa/RunTest.groovy b/src/com/mirantis/tcp_qa/RunTest.groovy
similarity index 68%
rename from src/com/mirantis/mcp_qa/RunTest.groovy
rename to src/com/mirantis/tcp_qa/RunTest.groovy
index 7d0065d..f64dd53 100644
--- a/src/com/mirantis/mcp_qa/RunTest.groovy
+++ b/src/com/mirantis/tcp_qa/RunTest.groovy
@@ -1,7 +1,7 @@
-package com.mirantis.mcp_qa
+package com.mirantis.tcp_qa
 
 /**
- * Run mcp-qa test by specified group
+ * Run tcp-qa test by specified group
  * @param testGroup defines what tests to run, options are '-m test_mark', '-k test_expression'
  * @param jobSetParameters is additional params needed to run mcp-qa test
  */
@@ -14,14 +14,9 @@
     withEnv(jobSetParameters) {
         sh '''\
             . ${VENV_PATH}/bin/activate
-            exit_code=0
-            export IMAGE_PATH=$(readlink -f "${IMAGE_PATH}")
             if ! py.test ${TEST_ARGS}; then
-            exit_code=1
-            fi
-            if [ ${exit_code} -gt 0 ]; then
-            echo "Tests failed!"
-            exit 1
+              echo "Tests failed!"
+              exit 1
             fi
             '''.stripIndent()
     }