Merge "Improve quotes in testrail reporter params"
diff --git a/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml
index f34cc38..65d1d18 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_bm-cicd-queens-ovs-maas.yaml
@@ -35,8 +35,8 @@
   cmd: |
     sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
     sed -i 's/br\-mgm/br\_mgm/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
-    sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
     sed -i 's/br\-baremetal/br\_baremetal/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
+    sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/gateway.yml;
     salt '*' saltutil.refresh_pillar;
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
diff --git a/tcp_tests/tests/system/test_cvp_pipelines.py b/tcp_tests/tests/system/test_cvp_pipelines.py
index c73bb88..d010664 100644
--- a/tcp_tests/tests/system/test_cvp_pipelines.py
+++ b/tcp_tests/tests/system/test_cvp_pipelines.py
@@ -294,10 +294,20 @@
             tgt=tgt, pillar="jenkins:client:master:username")
         jenkins_pass = salt.get_single_pillar(
             tgt=tgt, pillar="jenkins:client:master:password")
+        cirros_image = salt.get_single_pillar(
+            tgt="I@salt:master",
+            pillar="_param:glance_image_cirros_location")
         jenkins_start_timeout = 60
-        jenkins_build_timeout = 1800
+        jenkins_build_timeout = 50 * 60
 
         job_name = 'cvp-stacklight'
+        job_parameters = {
+            "EXTRA_PARAMS": """
+            envs:
+              - SL_AUTOCONF=True
+              - CIRROS_QCOW2_URL={image}
+            """.format(image=cirros_image)
+        }
 
         show_step(2)
         cvp_stacklight_result = run_jenkins_job.run_job(
@@ -308,7 +318,7 @@
             build_timeout=jenkins_build_timeout,
             verbose=True,
             job_name=job_name,
-            job_parameters={},
+            job_parameters=job_parameters,
             job_output_prefix='[cvp-stacklight/{build_number}:platform {time}]'
         )
 
diff --git a/tcp_tests/tests/system/test_mcp_update.py b/tcp_tests/tests/system/test_mcp_update.py
index 1ff7642..01fa7bb 100644
--- a/tcp_tests/tests/system/test_mcp_update.py
+++ b/tcp_tests/tests/system/test_mcp_update.py
@@ -32,25 +32,37 @@
     underlay = underlay_ssh_manager.UnderlaySSHManager(config)
     saltmanager = salt_manager.SaltManager(config, underlay)
     targets = list()
+    telemetry_exists = False
+    barbican_exists = False
     try:
         targets += saltmanager.run_state(
             "I@keystone:server", 'test.ping')[0]['return'][0].keys()
         targets += saltmanager.run_state(
             "I@nginx:server and not I@salt:master",
             "test.ping")[0]['return'][0].keys()
+        telemetry_exists = saltmanager.get_single_pillar(
+            "I@salt:master",
+            "_param:openstack_telemetry_hostname")
+        barbican_exists = saltmanager.get_single_pillar(
+            "I@salt:master",
+            "_param:barbican_enabled")
     except BaseException as err:
         LOG.warning("Can't retrieve data from Salt. \
             Maybe cluster is not deployed completely.\
             Err: {}".format(err))
 
-    # TODO: add check for Manila  existence
-    # # Commented to avoid fails during OpenStack updates.
-    # # Anyway we don't have deployments with Manila yet
-    # targets.append('share*')
-    # TODO: add check for Tenant Telemetry  existence
-    targets.append('mdb*')
-    # TODO: add check for Barbican existence
-    targets.append('kmn*')
+    # check for Manila  existence
+    # if saltmanager.get_single_pillar("I@salt:master",
+    #                                  "_param:manila_service_protocol"):
+    #     targets.append('share*')
+
+    # check for Tenant Telemetry  existence
+    if telemetry_exists:
+        targets.append('mdb*')
+
+    # check for Barbican existence
+    if barbican_exists:
+        targets.append('kmn*')
     return targets
 
 
diff --git a/tcp_tests/tests/system/test_upgrade_pike_queens.py b/tcp_tests/tests/system/test_upgrade_pike_queens.py
index 6314364..4080646 100644
--- a/tcp_tests/tests/system/test_upgrade_pike_queens.py
+++ b/tcp_tests/tests/system/test_upgrade_pike_queens.py
@@ -46,12 +46,6 @@
                 "grep -v Accepted")['stdout_str'].splitlines()
         LOG.info(list_nodes)
 
-        # #### guarantee that the KeystoneRC metadata is exported to mine ####
-        ret = underlay_actions.check_call(
-            node_name=cfg_node, verbose=verbose,
-            cmd="salt -C 'I@keystone:client:enabled' state.sls"
-                " keystone.upgrade.pre")
-
         # ## For each target node, get the list of the installed applications
         for node in list_nodes:
             salt_pillars = underlay_actions.check_call(
@@ -98,6 +92,7 @@
         # ########## Perform the pre-upgrade activities ##########
         show_step(1)
         LOG.info('Add parameters to {}'.format(infra_init_yaml))
+        # ### Edit Infra INIT
         reclass_actions.add_bool_key(
             'parameters._param.openstack_upgrade_enabled',
             'true',
@@ -112,6 +107,16 @@
             'parameters._param.openstack_old_version',
             'pike',
             infra_init_yaml)
+        # ### Edit Openstack INIT
+        reclass_actions.add_key(
+            'parameters._param.gnocchi_version',
+            4.2,
+            infra_init_yaml)
+        reclass_actions.add_key(
+            'parameters._param.gnocchi_old_version',
+            4.0,
+            infra_init_yaml)
+        # ### Edit Openstack control
         reclass_actions.add_class(
             'system.keystone.client.v3',
             'cluster/*/openstack/control_init.yml'
@@ -122,12 +127,40 @@
                 "git commit --allow-empty -m 'Cluster model update'")
         LOG.info('Perform refresh_pillar')
         salt_actions.run_state("*", "saltutil.refresh_pillar")
+        salt_actions.enforce_state("I@keystone:client:os_client_config",
+                                   "keystone.client.os_client_config")
+        # #### guarantee that the KeystoneRC metadata is exported to mine ####
+        underlay_actions.check_call(
+            node_name=cfg_node, verbose=verbose,
+            cmd="salt -C 'I@keystone:client:enabled' state.sls"
+                " keystone.upgrade.pre")
+
         self.execute_pre_post_steps(underlay_actions, cfg_node,
                                     verbose, 'pre')
         LOG.info('Perform refresh_pillar')
         salt_actions.run_state("*", "saltutil.refresh_pillar")
         # ########## Upgrade control VMs #########
         show_step(2)
+        LOG.info("Enable upgrade jobs in cluster Jenkins")
+        cicd_leader = "cluster/*/cicd/control/leader.yml"
+        reclass_actions.add_class(
+            "system.jenkins.client.job.deploy.update.upgrade",
+            cicd_leader
+        )
+        reclass_actions.add_class(
+            "system.jenkins.client.job.deploy.update.upgrade_ovs_gateway",
+            cicd_leader
+        )
+        reclass_actions.add_class(
+            "system.jenkins.client.job.deploy.update.upgrade_compute",
+            cicd_leader
+        )
+        salt_actions.enforce_state("I@jenkins:client",
+                                   "jenkins.client")
+        # #### Add QUEENS's repos
+        salt_actions.enforce_state("*", "linux.system.repo")
+
+        # ########## Upgrade control nodes  ###########
         LOG.info('Upgrade control VMs')
         job_name = 'deploy-upgrade-control'
         job_parameters = {
@@ -135,10 +168,34 @@
             'OS_DIST_UPGRADE': False,
             'OS_UPGRADE': False
         }
+        # ####### Run job for ctl* ###
+        job_parameters["TARGET_SERVERS"] = "ctl*"
         update_control_vms = dt.start_job_on_cid_jenkins(
             job_name=job_name,
             job_parameters=job_parameters)
         assert update_control_vms == 'SUCCESS'
+
+        # ####### Run job for mdb* ###
+        job_parameters["TARGET_SERVERS"] = "mdb*"
+        update_control_vms = dt.start_job_on_cid_jenkins(
+            job_name=job_name,
+            job_parameters=job_parameters)
+        assert update_control_vms == 'SUCCESS'
+
+        # ####### Run job for kmn* ###
+        job_parameters["TARGET_SERVERS"] = "kmn*"
+        update_control_vms = dt.start_job_on_cid_jenkins(
+            job_name=job_name,
+            job_parameters=job_parameters)
+        assert update_control_vms == 'SUCCESS'
+
+        # ####### Run job for prx* ###
+        job_parameters["TARGET_SERVERS"] = "prx*"
+        update_control_vms = dt.start_job_on_cid_jenkins(
+            job_name=job_name,
+            job_parameters=job_parameters)
+        assert update_control_vms == 'SUCCESS'
+
         # ########## Upgrade gatewey nodes  ###########
         show_step(3)
         LOG.info('Upgrade gateway')
@@ -146,7 +203,8 @@
         job_parameters = {
             'INTERACTIVE': False,
             'OS_DIST_UPGRADE': False,
-            'OS_UPGRADE': False
+            'OS_UPGRADE': False,
+            'TARGET_SERVERS': "gtw*"
         }
         update_gateway = dt.start_job_on_cid_jenkins(
             job_name=job_name,
@@ -159,12 +217,14 @@
         job_parameters = {
             'INTERACTIVE': False,
             'OS_DIST_UPGRADE': False,
-            'OS_UPGRADE': False
+            'OS_UPGRADE': False,
+            'TARGET_SERVERS': "cmp*"
         }
         update_computes = dt.start_job_on_cid_jenkins(
             job_name=job_name,
             job_parameters=job_parameters)
         assert update_computes == 'SUCCESS'
+
         # ############ Perform the post-upgrade activities ##########
         show_step(5)
         LOG.info('Add parameters._param.openstack_upgrade_enabled false'