Use reclass generator for k8s computes instead of 'static'

Change-Id: I779c954acb5f16f293bb6e930441b4e55b8c21d4
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 0414b30..56f8465 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
@@ -119,6 +119,11 @@
   kubernetes_control_node03_address: 10.167.4.13
   kubernetes_control_node03_deploy_address: 10.167.5.13
   kubernetes_control_node03_hostname: ctl03
+  kubernetes_compute_count: 4
+  kubernetes_compute_rack01_hostname: cmp
+  kubernetes_compute_deploy_address_ranges: 10.167.5.101-10.167.5.104
+  kubernetes_compute_single_address_ranges: 10.167.4.101-10.167.4.104
+  kubernetes_compute_tenant_address_ranges: 10.167.6.101-10.167.6.104
   kubernetes_enabled: 'True'
   kubernetes_externaldns_enabled: 'False'
   kubernetes_keepalived_vip_interface: br_ctl
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 bfff297..6097cba 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_calico
 
-    cmp001:
-      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,46 +121,6 @@
           role: single_dhcp
         ens4:
           role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node01_address}
-
-    cmp002:
-      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_calico
-          single_address: ${_param:kubernetes_compute_node02_address}
-
-    cmp003:
-      reclass_storage_name: kubernetes_compute_node03
-      roles:
-      - kubernetes_compute
-      - linux_system_codename_xenial
-      - salt_master_host
-      interfaces:
-        ens3:
-          role: single_dhcp
-        ens4:
-          role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node03_address}
-
-    cmp004:
-      reclass_storage_name: kubernetes_compute_node04
-      roles:
-      - kubernetes_compute
-      - linux_system_codename_xenial
-      - salt_master_host
-      interfaces:
-        ens3:
-          role: single_dhcp
-        ens4:
-          role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node04_address}
 
     mon01:
       reclass_storage_name: stacklight_server_node01
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico/cookiecutter-context-k8s.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico/cookiecutter-context-k8s.yaml
index f042844..8fcb519 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico/cookiecutter-context-k8s.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico/cookiecutter-context-k8s.yaml
@@ -119,6 +119,11 @@
   kubernetes_control_node03_address: 10.167.4.13
   kubernetes_control_node03_deploy_address: 10.167.5.13
   kubernetes_control_node03_hostname: ctl03
+  kubernetes_compute_count: 4
+  kubernetes_compute_rack01_hostname: cmp
+  kubernetes_compute_deploy_address_ranges: 10.167.5.101-10.167.5.104
+  kubernetes_compute_single_address_ranges: 10.167.4.101-10.167.4.104
+  kubernetes_compute_tenant_address_ranges: 10.167.6.101-10.167.6.104
   kubernetes_enabled: 'True'
   kubernetes_externaldns_enabled: 'False'
   kubernetes_keepalived_vip_interface: br_ctl
diff --git a/tcp_tests/templates/cookied-cicd-k8s-calico/environment-context-k8s.yaml b/tcp_tests/templates/cookied-cicd-k8s-calico/environment-context-k8s.yaml
index 8af2c0c..d9e20c6 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-calico/environment-context-k8s.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-calico/environment-context-k8s.yaml
@@ -109,8 +109,9 @@
         ens4:
           role: single_ctl_calico
 
-    cmp001:
-      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,43 +121,3 @@
           role: single_dhcp
         ens4:
           role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node01_address}
-
-    cmp002:
-      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_calico
-          single_address: ${_param:kubernetes_compute_node02_address}
-
-    cmp003:
-      reclass_storage_name: kubernetes_compute_node03
-      roles:
-      - kubernetes_compute
-      - linux_system_codename_xenial
-      - salt_master_host
-      interfaces:
-        ens3:
-          role: single_dhcp
-        ens4:
-          role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node03_address}
-
-    cmp004:
-      reclass_storage_name: kubernetes_compute_node04
-      roles:
-      - kubernetes_compute
-      - linux_system_codename_xenial
-      - salt_master_host
-      interfaces:
-        ens3:
-          role: single_dhcp
-        ens4:
-          role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node04_address}
diff --git a/tcp_tests/templates/cookied-cicd-k8s-genie/cookiecutter-context-k8s-genie.yaml b/tcp_tests/templates/cookied-cicd-k8s-genie/cookiecutter-context-k8s-genie.yaml
index 55d1c5e..118322a 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-genie/cookiecutter-context-k8s-genie.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-genie/cookiecutter-context-k8s-genie.yaml
@@ -119,6 +119,11 @@
   kubernetes_control_node03_address: 10.167.4.13
   kubernetes_control_node03_deploy_address: 10.167.5.13
   kubernetes_control_node03_hostname: ctl03
+  kubernetes_compute_count: 4
+  kubernetes_compute_rack01_hostname: cmp
+  kubernetes_compute_deploy_address_ranges: 10.167.5.101-10.167.5.104
+  kubernetes_compute_single_address_ranges: 10.167.4.101-10.167.4.104
+  kubernetes_compute_tenant_address_ranges: 10.167.6.101-10.167.6.104
   kubernetes_enabled: 'True'
   kubernetes_externaldns_enabled: 'False'
   kubernetes_keepalived_vip_interface: br_ctl
diff --git a/tcp_tests/templates/cookied-cicd-k8s-genie/environment-context-k8s-genie.yaml b/tcp_tests/templates/cookied-cicd-k8s-genie/environment-context-k8s-genie.yaml
index 8af2c0c..d9e20c6 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-genie/environment-context-k8s-genie.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-genie/environment-context-k8s-genie.yaml
@@ -109,8 +109,9 @@
         ens4:
           role: single_ctl_calico
 
-    cmp001:
-      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,43 +121,3 @@
           role: single_dhcp
         ens4:
           role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node01_address}
-
-    cmp002:
-      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_calico
-          single_address: ${_param:kubernetes_compute_node02_address}
-
-    cmp003:
-      reclass_storage_name: kubernetes_compute_node03
-      roles:
-      - kubernetes_compute
-      - linux_system_codename_xenial
-      - salt_master_host
-      interfaces:
-        ens3:
-          role: single_dhcp
-        ens4:
-          role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node03_address}
-
-    cmp004:
-      reclass_storage_name: kubernetes_compute_node04
-      roles:
-      - kubernetes_compute
-      - linux_system_codename_xenial
-      - salt_master_host
-      interfaces:
-        ens3:
-          role: single_dhcp
-        ens4:
-          role: single_ctl_calico
-          single_address: ${_param:kubernetes_compute_node04_address}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml
index cf03c60..7cf52a7 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico-sl.yaml
@@ -18,18 +18,4 @@
 
 {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
 
-- description: "Workaround for combined roles: remove unnecessary classes"
-  cmd: |
-    set -e;
-    . /root/venv-reclass-tools/bin/activate;
-    # Workaround for compute nodes. Auto-registration for compute nodes cannot be used without external address inventory
-    reclass-tools add-key parameters._param.kubernetes_compute_node01_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node02_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node03_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.103 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node04_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.104 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 5}
-  skip_fail: false
-
 {{ SHARED.MACRO_GENERATE_INVENTORY(RERUN_SALTMASTER_STATE=true) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico.yaml
index 7eacc05..130b3b3 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-calico.yaml
@@ -18,18 +18,4 @@
 
 {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
 
-- description: "Workaround for combined roles: remove unnecessary classes"
-  cmd: |
-    set -e;
-    . /root/venv-reclass-tools/bin/activate;
-    # Workaround for compute nodes. Auto-registration for compute nodes cannot be used without external address inventory
-    reclass-tools add-key parameters._param.kubernetes_compute_node01_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node02_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node03_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.103 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node04_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.104 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 5}
-  skip_fail: false
-
 {{ SHARED.MACRO_GENERATE_INVENTORY(RERUN_SALTMASTER_STATE=true) }}
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml
index 21349bf..65f3c2b 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-cicd-k8s-genie.yaml
@@ -18,18 +18,4 @@
 
 {{ SHARED.MACRO_GENERATE_AND_ENABLE_ENVIRONMENT_MODEL() }}
 
-- description: "Workaround for computes"
-  cmd: |
-    set -e;
-    . /root/venv-reclass-tools/bin/activate;
-    # Workaround for compute nodes. Auto-registration for compute nodes cannot be used without external address inventory
-    reclass-tools add-key parameters._param.kubernetes_compute_node01_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.101 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node02_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.102 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node03_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.103 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-    reclass-tools add-key parameters._param.kubernetes_compute_node04_address {{ SHARED.IPV4_NET_CONTROL_PREFIX }}.104 /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/kubernetes/init.yml;
-
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 5}
-  skip_fail: false
-
 {{ SHARED.MACRO_GENERATE_INVENTORY(RERUN_SALTMASTER_STATE=true) }}