diff --git a/tcp_tests/managers/saltmanager.py b/tcp_tests/managers/saltmanager.py
index 3782c63..a468b02 100644
--- a/tcp_tests/managers/saltmanager.py
+++ b/tcp_tests/managers/saltmanager.py
@@ -167,24 +167,6 @@
         result = self.local(tgt=tgt, fun='pillar.get', args=pillar)
         return result['return']
 
-    def get_single_pillar(self, tgt, pillar):
-        """Get a scalar value from a single node
-
-        :return: pillar value
-        """
-
-        result = self.get_pillar(tgt, pillar)
-        nodes = result[0].keys()
-
-        if not nodes:
-            raise LookupError("No minions selected "
-                              "for the target '{0}'".format(tgt))
-        if len(nodes) > 1:
-            raise LookupError("Too many minions selected "
-                              "for the target '{0}' , expected one: {1}"
-                              .format(tgt, nodes))
-        return result[0][nodes[0]]
-
     def get_grains(self, tgt, grains):
         result = self.local(tgt=tgt, fun='grains.get', args=grains)
         return result['return']
diff --git a/tcp_tests/tests/system/test_cvp_pipelines.py b/tcp_tests/tests/system/test_cvp_pipelines.py
deleted file mode 100644
index 5d2e060..0000000
--- a/tcp_tests/tests/system/test_cvp_pipelines.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#    Copyright 2016 Mirantis, Inc.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-
-import pytest
-
-from tcp_tests import logger
-from tcp_tests import settings
-from tcp_tests.utils import run_jenkins_job
-from tcp_tests.utils import get_jenkins_job_stages
-
-LOG = logger.logger
-
-
-class TestCvpPipelines(object):
-    """Test class for running Cloud Validation Pipelines
-
-    Requires environment variables:
-      ENV_NAME
-      LAB_CONFIG_NAME
-      TESTS_CONFIGS
-    """
-
-    @pytest.mark.grab_versions
-    @pytest.mark.parametrize("_", [settings.ENV_NAME])
-    @pytest.mark.run_cvp_func_smoke
-    def test_run_cvp_func_smoke(self, salt_actions, show_step, _):
-        """Runner for Pipeline CVP - Functional tests
-
-        Scenario:
-            1. Get CICD Jenkins access credentials from salt
-            2. Run job cvp-func
-            3. Get passed stages from cvp-func
-        """
-        salt = salt_actions
-        show_step(1)
-
-        tgt = 'I@docker:client:stack:jenkins and cid01*'
-        jenkins_host = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:host")
-        jenkins_port = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:port")
-        jenkins_url = 'http://{0}:{1}'.format(jenkins_host, jenkins_port)
-        jenkins_user = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:username")
-        jenkins_pass = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:password")
-        jenkins_start_timeout = 60
-        jenkins_build_timeout = 1800
-
-        job_name = 'cvp-func'
-        job_parameters = {
-            'TARGET_NODE': 'gtw01*',
-            'TEMPEST_ENDPOINT_TYPE': 'internalURL',
-            'TEMPEST_TEST_PATTERN': 'set=smoke',
-        }
-        show_step(2)
-        cvp_func_smoke_result = run_jenkins_job.run_job(
-            host=jenkins_url,
-            username=jenkins_user,
-            password=jenkins_pass,
-            start_timeout=jenkins_start_timeout,
-            build_timeout=jenkins_build_timeout,
-            verbose=True,
-            job_name=job_name,
-            job_parameters=job_parameters,
-            job_output_prefix='[ cvp-func/{build_number}:platform {time} ] ')
-
-        show_step(3)
-        (description, stages) = get_jenkins_job_stages.get_deployment_result(
-            host=jenkins_url,
-            username=jenkins_user,
-            password=jenkins_pass,
-            job_name=job_name,
-            build_number='lastBuild')
-
-        LOG.info(description)
-        LOG.info('\n'.join(stages))
-
-        assert cvp_func_smoke_result == 'SUCCESS', "{0}\n{1}".format(
-            description, '\n'.join(stages))
-
-    @pytest.mark.grab_versions
-    @pytest.mark.parametrize("_", [settings.ENV_NAME])
-    @pytest.mark.run_cvp_func_sanity
-    def test_run_cvp_func_sanity(self, salt_actions, show_step, _):
-        """Runner for Pipeline CVP - Functional tests
-
-        Scenario:
-            1. Get CICD Jenkins access credentials from salt
-            2. Run job cvp-sanity
-            3. Get passed stages from cvp-sanity
-        """
-        salt = salt_actions
-        show_step(1)
-
-        tgt = 'I@docker:client:stack:jenkins and cid01*'
-        jenkins_host = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:host")
-        jenkins_port = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:port")
-        jenkins_url = 'http://{0}:{1}'.format(jenkins_host, jenkins_port)
-        jenkins_user = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:username")
-        jenkins_pass = salt.get_single_pillar(
-            tgt=tgt, pillar="jenkins:client:master:password")
-        jenkins_start_timeout = 60
-        jenkins_build_timeout = 1800
-
-        job_name = 'cvp-sanity'
-        job_parameters = {
-            'TEST_SET': '/var/lib/cvp-sanity/cvp_checks/tests/',
-        }
-
-        show_step(2)
-        cvp_func_sanity_result = run_jenkins_job.run_job(
-            host=jenkins_url,
-            username=jenkins_user,
-            password=jenkins_pass,
-            start_timeout=jenkins_start_timeout,
-            build_timeout=jenkins_build_timeout,
-            verbose=True,
-            job_name=job_name,
-            job_parameters=job_parameters,
-            job_output_prefix='[ cvp-func/{build_number}:platform {time} ] ')
-
-        show_step(3)
-        (description, stages) = get_jenkins_job_stages.get_deployment_result(
-            host=jenkins_url,
-            username=jenkins_user,
-            password=jenkins_pass,
-            job_name=job_name,
-            build_number='lastBuild')
-
-        LOG.info(description)
-        LOG.info('\n'.join(stages))
-
-        assert cvp_func_sanity_result == 'SUCCESS', "{0}\n{1}".format(
-            description, '\n'.join(stages))
diff --git a/tcp_tests/utils/get_jenkins_job_stages.py b/tcp_tests/utils/get_jenkins_job_stages.py
index b28e1d2..883494f 100755
--- a/tcp_tests/utils/get_jenkins_job_stages.py
+++ b/tcp_tests/utils/get_jenkins_job_stages.py
@@ -69,15 +69,15 @@
     return parser
 
 
-def get_deployment_result(host, username, password, job_name, build_number):
+def get_deployment_result(opts):
     """Get the pipeline job result from Jenkins
 
     Get all the stages resutls from the specified job,
     show error message if present.
     """
-    jenkins = client.JenkinsClient(host=host,
-                                   username=username,
-                                   password=password)
+    jenkins = client.JenkinsClient(host=opts.host,
+                                   username=opts.username,
+                                   password=opts.password)
 
     def get_stages(nodes, indent=0, show_status=True):
         res = []
@@ -90,15 +90,15 @@
                 res.append(msg)
 
             if node['status'] != 'SUCCESS':
-                wf = jenkins.get_workflow(job_name, build_number,
+                wf = jenkins.get_workflow(opts.job_name, opts.build_number,
                                           int(node['id']))
                 if wf is not None:
                     if 'stageFlowNodes' in wf:
                         res += get_stages(wf['stageFlowNodes'], indent + 2,
                                           show_status=False)
                     elif '_links' in wf and 'log' in wf['_links']:
-                        log = jenkins.get_workflow(job_name,
-                                                   build_number,
+                        log = jenkins.get_workflow(opts.job_name,
+                                                   opts.build_number,
                                                    int(node['id']),
                                                    mode='log')
                         if "text" in log:
@@ -109,8 +109,8 @@
         return res
 
     for _ in range(3):
-        wf = jenkins.get_workflow(job_name, build_number)
-        info = jenkins.build_info(job_name, int(wf['id']))
+        wf = jenkins.get_workflow(opts.job_name, opts.build_number)
+        info = jenkins.build_info(opts.job_name, int(wf['id']))
         if info.get('result'):
             break
         time.sleep(3)
@@ -120,7 +120,7 @@
     stages = get_stages(wf['stages'], 0)
     if not stages:
         msg = wf['status'] + ":\n\n"
-        stages = [msg + jenkins.get_build_output(job_name, int(wf['id']))]
+        stages = [msg + jenkins.get_build_output(opts.job_name, int(wf['id']))]
     return (build_description, stages)
 
 
@@ -133,12 +133,7 @@
         parser.print_help()
         return 10
     else:
-        (build_description, stages) = get_deployment_result(
-            opts.host,
-            opts.username,
-            opts.password,
-            opts.job_name,
-            opts.build_number)
+        (build_description, stages) = get_deployment_result(opts)
         print(build_description)
         print('\n'.join(stages))
 
diff --git a/tcp_tests/utils/run_jenkins_job.py b/tcp_tests/utils/run_jenkins_job.py
index 86a3703..acc2e9f 100755
--- a/tcp_tests/utils/run_jenkins_job.py
+++ b/tcp_tests/utils/run_jenkins_job.py
@@ -97,10 +97,10 @@
     return parser
 
 
-def print_build_header(build, job_params, build_timeout):
+def print_build_header(build, job_params, opts):
     print('\n#############################################################')
     print('##### Building job [{0}] #{1} (timeout={2}) with the following '
-          'parameters:'.format(build[0], build[1], build_timeout))
+          'parameters:'.format(build[0], build[1], opts.build_timeout))
     print('##### ' + '\n##### '.join(
         [str(key) + ": " + str(val) for key, val in job_params.iteritems()]
     ))
@@ -114,44 +114,41 @@
     print('#############################################################\n')
 
 
-def run_job(host, username, password,
-            job_name, job_parameters=None, job_output_prefix='',
-            start_timeout=1800, build_timeout=3600 * 4, verbose=False):
+def run_job(opts):
 
     jenkins = JenkinsClient(
-        host=host,
-        username=username,
-        password=password)
+        host=opts.host,
+        username=opts.username,
+        password=opts.password)
 
-    job_params = jenkins.make_defults_params(job_name)
-    if job_parameters is not None:  # job_parameters = {}
-        job_params.update(job_parameters)
+    job_params = jenkins.make_defults_params(opts.job_name)
+    job_params.update(opts.job_parameters)
 
-    build = jenkins.run_build(job_name,
+    build = jenkins.run_build(opts.job_name,
                               job_params,
-                              verbose=verbose,
-                              timeout=start_timeout)
-    if verbose:
-        print_build_header(build, job_params, build_timeout)
+                              verbose=opts.verbose,
+                              timeout=opts.start_timeout)
+    if opts.verbose:
+        print_build_header(build, job_params, opts)
 
     try:
         jenkins.wait_end_of_build(
             name=build[0],
             build_id=build[1],
-            timeout=build_timeout,
+            timeout=opts.build_timeout,
             interval=1,
-            verbose=verbose,
-            job_output_prefix=job_output_prefix)
+            verbose=opts.verbose,
+            job_output_prefix=opts.job_output_prefix)
     except Exception as e:
         print(str(e))
         raise
 
     result = jenkins.build_info(name=build[0],
                                 build_id=build[1])['result']
-    if verbose:
-        print_build_footer(build, result, host)
+    if opts.verbose:
+        print_build_footer(build, result, opts.host)
 
-    return result
+    return EXIT_CODES.get(result, 2)
 
 
 def main(args=None):
@@ -163,8 +160,8 @@
         parser.print_help()
         return 10
     else:
-        result = run_job(opts)
-        return EXIT_CODES.get(result, 2)
+        exit_code = run_job(opts)
+        return exit_code
 
 
 if __name__ == "__main__":
