Deploy 250 computes after success deploy main stack

Change-Id: I37c1c4a975e6eca00dd369f6b76a4cf5c8bf852e
diff --git a/jobs/templates/released-bm-b300-cicd-queens-ovs-maas.yml b/jobs/templates/released-bm-b300-cicd-queens-ovs-maas.yml
index 8e868d6..bd20f81 100644
--- a/jobs/templates/released-bm-b300-cicd-queens-ovs-maas.yml
+++ b/jobs/templates/released-bm-b300-cicd-queens-ovs-maas.yml
@@ -92,7 +92,13 @@
         name: SALT_MODELS_SYSTEM_COMMIT
         trim: 'false'
     - string:
-        default: -m "run_cvp_func_sanity|run_cvp_tempest|run_stacklight"
+        default: |-
+          --keep-duplicates --maxfail=1 \
+            tcp_tests/tests/system/test_deploy_250_computes.py::TestkDeploy250Computes::test_deploy_250_computes \
+            \
+            tcp_tests/tests/system/test_cvp_pipelines.py::TestCvpPipelines::test_run_cvp_tempest \
+            tcp_tests/tests/system/test_cvp_pipelines.py::TestCvpPipelines::test_run_cvp_func_sanity \
+            tcp_tests/tests/system/test_cvp_pipelines.py::TestCvpPipelines::test_run_cvp_stacklight
         description: |-
           Pytest option -k or -m, with expression to select necessary tests.
           Additional pytest options are allowed.
diff --git a/tcp_tests/templates/cookied-model-generator/salt_released-bm-b300-cicd-queens-ovs-maas.yaml b/tcp_tests/templates/cookied-model-generator/salt_released-bm-b300-cicd-queens-ovs-maas.yaml
index 7a726d4..2051d4a 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_released-bm-b300-cicd-queens-ovs-maas.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_released-bm-b300-cicd-queens-ovs-maas.yaml
@@ -29,70 +29,6 @@
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
 
 {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
-
-- description: "Upload vcompute cluster config to cfg01.{{ DOMAIN_NAME }}"
-  upload:
-    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
-    local_filename: openstack_vcompute_cluster.yml
-    remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: "Upload vcmp config to cfg01.{{ DOMAIN_NAME }}"
-  upload:
-    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
-    local_filename: vcmp.yml
-    remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/compute/
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: "Upload vcmp network definition to cfg01.{{ DOMAIN_NAME }}"
-  upload:
-    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
-    local_filename: vcmpcompute.yml
-    remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/networking/
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: "Upload env_add.yml to cfg01.{{ DOMAIN_NAME }}"
-  upload:
-    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
-    local_filename: env_add.yml
-    remote_path: /root/environment/
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: "Upload infra_config_nodes_add.yml to cfg01.{{ DOMAIN_NAME }}"
-  upload:
-    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
-    local_filename: infra_config_nodes_add.yml
-    remote_path: /root/environment/
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: "Upload infra_kvm_add.yml to cfg01.{{ DOMAIN_NAME }}"
-  upload:
-    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
-    local_filename: infra_kvm_add.yml
-    remote_path: /root/environment/
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
-- description: "Upload openstack_init_add.yml to cfg01.{{ DOMAIN_NAME }}"
-  upload:
-    local_path:  {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
-    local_filename: openstack_init_add.yml
-    remote_path: /root/environment/
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
 - description: Temporary WR for correct bridge name according to envoronment templates
   cmd: |
     sed -i 's/br\-ctl/br\_ctl/g' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/kvm.yml;
diff --git a/tcp_tests/tests/system/test_deploy_250_computes.py b/tcp_tests/tests/system/test_deploy_250_computes.py
new file mode 100644
index 0000000..1b2fa2a
--- /dev/null
+++ b/tcp_tests/tests/system/test_deploy_250_computes.py
@@ -0,0 +1,122 @@
+#    Copyright 2017 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
+
+
+LOG = logger.logger
+
+
+@pytest.mark.deploy
+class TestkDeploy250Computes(object):
+    "https://mirantis.jira.com/browse/PROD-36488 Deploy 250vcpu for BM"
+
+    @pytest.mark.grab_versions
+    @pytest.mark.parametrize("_", [settings.ENV_NAME])
+    @pytest.mark.run_mcp_update
+    def test_deploy_250_computes(self, reclass_actions, underlay_actions,
+                                 show_step, salt_actions, _):
+        reclass = reclass_actions
+        ssh = underlay_actions
+        master_host = "cfg01"
+
+        # ################# Upload patched parts of model  ####################
+        show_step(1)
+
+        lab_name = settings.LAB_CONFIG_NAME
+
+        reclass.merge_context("/root/environment/env_add.yml".format(lab_name),
+                              "cluster/*/init.yml")
+        reclass.merge_context("/root/environment/infra_config_nodes_add.yml"
+                              .format(lab_name),
+                              "cluster/*/infra/config/nodes.yml")
+        reclass.merge_context("/root/environment/infra_kvm_add.yml"
+                              .format(lab_name),
+                              "cluster/*/infra/kvm.yml")
+        reclass.merge_context("/root/environment/openstack_init_add.yml"
+                              .format(lab_name),
+                              "cluster/*/openstack/init.yml")
+
+        # ###### Generate nodes configs and apply changes to kvm nodes ########
+        show_step(2)
+
+        ssh.check_call(
+            "salt-call state.apply reclass.storage",
+            node_name=master_host
+        )
+        salt_actions.run_state("kvm*", "saltutil.sync_all")
+        salt_actions.run_state("kvm*", "saltutil.refresh_pillar")
+
+        # ################# One by one apply network changes ##################
+        show_step(3)
+
+        kvm_nodes = ssh.check_call(
+            "salt 'cfg01*' pillar.get linux:network:host | grep '  kvm' "
+            "| sed 's/   *//g' | sed 's/://g'",
+            master_host
+        )
+        for node in kvm_nodes.split('\n'):
+            salt_actions.run_state(node, "state.apply", "linux.network")
+
+        # ########## Check that bridges are available on all nodes ############
+        show_step(4)
+
+        salt_actions.cmd_run("kvm*", "brctl show | grep 'ctl'")
+        salt_actions.cmd_run("kvm*", "brctl show | grep 'mesh'")
+
+        # ########### One by one for each kvm create vcmp VMs #################
+        show_step(5)
+
+        for node in kvm_nodes.split('\n'):
+            salt_actions.run_state(node, "state.apply", "salt.control")
+
+        # ########################### Check VMs ###############################
+        show_step(6)
+
+        salt_actions.cmd_run("kvm01*", "virsh list")
+        ssh.check_call(
+            "salt-key",
+            node_name=master_host
+        )
+
+        ssh.check_call(
+            "salt-call mine.get '*' x509.get_pem_entries",
+            node_name=master_host
+        )
+
+        salt_actions.run_state(node, "state.apply", "salt.minion")
+
+        # ######################## Deploy vcmp nodes ##########################
+        show_step(7)
+
+        for vcmp in range(3, 255):
+            cmd = "salt 'vcmp${i}.*' saltutil.sync_all; " \
+                  "salt 'vcmp${i}.*' saltutil.sync_grains; " \
+                  "salt 'vcmp${i}.*' saltutil.refresh_pillar; " \
+                  "sleep 5; " \
+                  "salt 'vcmp${i}.*' state.sls linux,ntp,openssh,salt;" \
+                  "sleep 5; " \
+                  "salt 'vcmp${i}.*' state.highstate"
+            ssh.check_call(
+                cmd,
+                node_name=master_host
+            )
+
+        # ####################### Discover new computes #######################
+        show_step(8)
+
+        salt_actions.run_state(node, "state.sls", "nova.controller")