Add cookied-cicd models for openstack configs: ovs/dvr/dpdk

Change-Id: If9e72928b90bb13fd51199c93f9255ec52576bc4
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/cookiecutter-context-k8s-sl.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/cookiecutter-context-k8s-sl.yaml
index e055d78..7d453c1 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/cookiecutter-context-k8s-sl.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/cookiecutter-context-k8s-sl.yaml
@@ -1,4 +1,5 @@
 default_context:
+  auditd_enabled: 'False'
   backup_private_key: |-
     -----BEGIN RSA PRIVATE KEY-----
     MIIEowIBAAKCAQEAtyCfiXxwB6Dk6n7Y1t9u2XqMkLPvMArKwRUWGEwTzS7w0NzY
@@ -108,12 +109,11 @@
   internal_proxy_enabled: 'False'
   kqueen_custom_mail_enabled: 'False'
   kqueen_enabled: 'False'
-  kubernetes_compute_node01_address: 10.167.4.101
-  kubernetes_compute_node01_deploy_address: 10.167.5.101
-  kubernetes_compute_node01_hostname: cmp01
-  kubernetes_compute_node02_address: 10.167.4.102
-  kubernetes_compute_node02_deploy_address: 10.167.5.102
-  kubernetes_compute_node02_hostname: cmp02
+  kubernetes_compute_count: 2
+  kubernetes_compute_rack01_deploy_subnet: 10.167.5
+  kubernetes_compute_rack01_single_subnet: 10.167.4
+  kubernetes_compute_rack01_tenant_subnet: 10.167.6
+  kubernetes_compute_rack01_hostname: cmp
   kubernetes_control_address: 10.167.4.10
   kubernetes_control_node01_address: 10.167.4.11
   kubernetes_control_node01_deploy_address: 10.167.5.11
@@ -131,10 +131,10 @@
   kubernetes_virtlet_enabled: 'False'
   local_repositories: 'False'
   maas_deploy_address: 10.167.5.15
-  maas_deploy_range_end: 10.167.5.254
-  maas_deploy_range_start: 10.167.5.1
+  maas_deploy_range_end: 10.167.5.199
+  maas_deploy_range_start: 10.167.5.180
   maas_deploy_vlan: '0'
-  maas_fabric_name: fabric-0
+  maas_fabric_name: deploy-fabric0
   maas_hostname: cfg01
   mcp_common_scripts_branch: ''
   mcp_version: proposed
@@ -148,6 +148,8 @@
   oss_enabled: 'False'
   oss_node03_address: ${_param:stacklight_monitor_node03_address}
   oss_webhook_app_id: '24'
+  oss_pushkin_email_sender_password: password
+  oss_pushkin_smtp_port: '587'
   oss_webhook_login_id: '13'
   platform: kubernetes_enabled
   public_host: ${_param:infra_config_address}
@@ -158,7 +160,7 @@
   salt_master_address: 10.167.4.15
   salt_master_hostname: cfg01
   salt_master_management_address: 10.167.5.15
-  shared_reclass_branch: ''
+  shared_reclass_branch: 'proposed'
   shared_reclass_url: https://gerrit.mcp.mirantis.net/salt-models/reclass-system.git
   stacklight_enabled: 'True'
   stacklight_log_address: 10.167.4.60
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/deploy-and-test.groovy b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/deploy-and-test.groovy
index 71b3e8d..616ad61 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/deploy-and-test.groovy
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/deploy-and-test.groovy
@@ -1,85 +1,17 @@
+@Library('tcp-qa')_
+
 common = new com.mirantis.mk.Common()
-
-def run_cmd(cmd, returnStdout=false) {
-    common.printMsg("Run shell command:\n" + cmd, "blue")
-    def VENV_PATH='/home/jenkins/fuel-devops30'
-    script = "set +x; echo 'activate python virtualenv ${VENV_PATH}';. ${VENV_PATH}/bin/activate; bash -c 'set -ex;set -ex;${cmd.stripIndent()}'"
-    return sh(script: script, returnStdout: returnStdout)
-}
-
-def run_cmd_stdout(cmd) {
-    return run_cmd(cmd, true)
-}
+shared = new com.mirantis.system_qa.SharedPipeline()
 
 node ("${NODE_NAME}") {
   try {
 
-    stage("Clean the environment") {
-        println "Clean the working directory ${env.WORKSPACE}"
-        deleteDir()
-        // do not fail if environment doesn't exists
-        println "Remove environment ${ENV_NAME}"
-        run_cmd("""\
-            dos.py erase ${ENV_NAME} || true
-        """)
-        println "Remove config drive ISO"
-        run_cmd("""\
-            rm /home/jenkins/images/${CFG01_CONFIG_IMAGE_NAME} || true
-        """)
+    stage("Clean the environment and clone tcp-qa") {
+        shared.prepare_working_dir()
     }
 
-    stage("Clone tcp-qa project and install requirements") {
-        run_cmd("""\
-        git clone https://github.com/Mirantis/tcp-qa.git ${env.WORKSPACE}
-        #cd tcp-qa
-        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 --upgrade --upgrade-strategy=only-if-needed -r tcp_tests/requirements.txt
-        """)
-    }
-
-    // load shared methods from the clonned tcp-qa repository.
-    // DO NOT MOVE this code before clonning the repo
-    def rootDir = pwd()
-    def shared = load "${rootDir}/tcp_tests/templates/SharedPipeline.groovy"
-
-    stage("Create an environment ${ENV_NAME} in disabled state") {
-        // do not fail if environment doesn't exists
-        run_cmd("""\
-        python ./tcp_tests/utils/create_devops_env.py
-        """)
-    }
-
-    stage("Generate the model") {
-        shared.generate_cookied_model()
-    }
-
-    stage("Generate config drive ISO") {
-        shared.generate_configdrive_iso()
-    }
-
-    stage("Upload generated config drive ISO into volume on cfg01 node") {
-        run_cmd("""\
-        virsh vol-upload ${ENV_NAME}_cfg01.${LAB_CONFIG_NAME}.local_config /home/jenkins/images/${CFG01_CONFIG_IMAGE_NAME} --pool default
-        virsh pool-refresh --pool default
-        """)
-    }
-
-    stage("Run the 'underlay' and 'salt-deployed' fixtures to bootstrap salt cluster") {
-        run_cmd("""\
-        export MANAGER=devops
-        export SHUTDOWN_ENV_ON_TEARDOWN=false
-        export BOOTSTRAP_TIMEOUT=900
-        export PYTHONIOENCODING=UTF-8
-        export REPOSITORY_SUITE=${MCP_VERSION}
-        #export SALT_STEPS_PATH=templates/${LAB_CONFIG_NAME}/salt.yaml
-        export TEST_GROUP=test_install_local_salt
-        py.test -vvv -s -p no:django -p no:ipdb --junit-xml=nosetests.xml -k \${TEST_GROUP}
-        sleep 60  # wait for jenkins to start and IO calm down
-
-        """)
+    stage("Create environment, generate mode, bootstrap the salt-cluster") {
+        shared.swarm_bootstrap_salt_cluster_devops()
     }
 
     // Install core and cicd
@@ -92,14 +24,14 @@
     }
 
     // Install the cluster
-    for (stack in "${STACK_INSTALL}".split(",")) {
+    for (stack in "${PLATFORM_STACK_INSTALL}".split(",")) {
         stage("Run Jenkins job on CICD [deploy_openstack:${stack}]") {
             shared.run_job_on_cicd_nodes(stack)
         }
     }
 
     stage("Run tests") {
-        run_cmd("""\
+        shared.run_cmd("""\
             export ENV_NAME=${ENV_NAME}
             . ./tcp_tests/utils/env_salt
             . ./tcp_tests/utils/env_k8s
@@ -133,7 +65,7 @@
   } finally {
     // TODO(ddmitriev): analyze the "def currentResult = currentBuild.result ?: 'SUCCESS'"
     // and report appropriate data to TestRail
-    run_cmd("""\
+    shared.run_cmd("""\
         dos.py destroy ${ENV_NAME}
     """)
   }
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/environment-context-k8s-sl.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/environment-context-k8s-sl.yaml
index 248b42d..2b89364 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/environment-context-k8s-sl.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/environment-context-k8s-sl.yaml
@@ -109,8 +109,9 @@
         ens4:
           role: single_ctl
 
-    cmp01:
-      reclass_storage_name: kubernetes_compute_node01
+    # Generator-based computes. For compatibility only
+    cmp<<count>>:
+      reclass_storage_name: kubernetes_compute_rack01
       roles:
       - kubernetes_compute
       - linux_system_codename_xenial
@@ -120,20 +121,6 @@
           role: single_dhcp
         ens4:
           role: single_ctl
-          single_address: ${_param:kubernetes_compute_node01_address}
-
-    cmp02:
-      reclass_storage_name: kubernetes_compute_node02
-      roles:
-      - kubernetes_compute
-      - linux_system_codename_xenial
-      - salt_master_host
-      interfaces:
-        ens3:
-          role: single_dhcp
-        ens4:
-          role: single_ctl
-          single_address: ${_param:kubernetes_compute_node02_address}
 
     mon01:
       reclass_storage_name: stacklight_server_node01
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml
index 7c3ae61..8a739fc 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/salt.yaml
@@ -7,12 +7,6 @@
 
 {% import 'shared-salt.yaml' as SHARED with context %}
 
-- description: Workaround, configure ntp and rsyslog on salt master node
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:master' state.sls ntp,rsyslog
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 10}
-  skip_fail: false
-
 {{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
 
 {{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml
index 10c716e..be12324 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico-sl/underlay.yaml
@@ -11,8 +11,8 @@
 {% set HOSTNAME_CTL01 = os_env('HOSTNAME_CTL01', 'ctl01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_CTL02 = os_env('HOSTNAME_CTL02', 'ctl02.' + DOMAIN_NAME) %}
 {% set HOSTNAME_CTL03 = os_env('HOSTNAME_CTL03', 'ctl03.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CMP01 = os_env('HOSTNAME_CMP01', 'cmp01.' + DOMAIN_NAME) %}
-{% set HOSTNAME_CMP02 = os_env('HOSTNAME_CMP02', 'cmp02.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CMP01 = os_env('HOSTNAME_CMP01', 'cmp001.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CMP02 = os_env('HOSTNAME_CMP02', 'cmp002.' + DOMAIN_NAME) %}
 {% set HOSTNAME_LOG01 = os_env('HOSTNAME_LOG01', 'log01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_LOG02 = os_env('HOSTNAME_LOG02', 'log02.' + DOMAIN_NAME) %}
 {% set HOSTNAME_LOG03 = os_env('HOSTNAME_LOG03', 'log03.' + DOMAIN_NAME) %}