Add class mapping to k8s Contrail infra/config

Change-Id: If25585890e87a44e87b3255a8c0b2921ead0e676
diff --git a/classes/cluster/k8s_ha_contrail/infra/config.yml b/classes/cluster/k8s_ha_contrail/infra/config.yml
index d93ba67..8c30574 100644
--- a/classes/cluster/k8s_ha_contrail/infra/config.yml
+++ b/classes/cluster/k8s_ha_contrail/infra/config.yml
@@ -19,27 +19,66 @@
     linux_system_codename: xenial
     salt_api_password_hash: "$6$WV0P1shnoDh2gI/Z$22/Bcd7ffMv0jDlFpT63cAU4PiXHz9pjXwngToKwqAsgoeK4HNR3PiKaushjxp3JsQ8hNoJmAC6TxzVqfV8WH/"
     salt_master_host: ${_param:infra_config_deploy_address}
+  salt:
+    master:
+      reactor:
+        reclass/minion/classify:
+        - salt://reclass/reactor/node_register.sls
   reclass:
     storage:
+      class_mapping:
+        common_node:
+          expression: all
+          node_param:
+            single_address:
+              value_template: <<node_ip>>
+            linux_system_codename:
+              value_template: <<node_os>>
+            salt_master_host:
+              value_template: <<node_master_ip>>
+        infra_config:
+          expression: <<node_hostname>>__startswith__cfg
+          cluster_param:
+            infra_config_address:
+              value_template: <<node_ip>>
+            infra_config_deploy_address:
+              value_template: <<node_ip>>
+        kubernetes_control01:
+          expression: <<node_hostname>>__equals__ctl01
+          cluster_param:
+            kubernetes_control_node01_address:
+              value_template: <<node_ip>>
+        kubernetes_control02:
+          expression: <<node_hostname>>__equals__ctl02
+          cluster_param:
+            kubernetes_control_node02_address:
+              value_template: <<node_ip>>
+        kubernetes_control03:
+          expression: <<node_hostname>>__equals__ctl03
+          cluster_param:
+            kubernetes_control_node03_address:
+              value_template: <<node_ip>>
+        opencontrail_control01:
+          expression: <<node_hostname>>__equals__ntw01
+          cluster_param:
+            opencontrail_control_node01_address:
+              value_template: <<node_ip>>
+        opencontrail_control02:
+          expression: <<node_hostname>>__equals__ntw02
+          cluster_param:
+            opencontrail_control_node02_address:
+              value_template: <<node_ip>>
+        opencontrail_control03:
+          expression: <<node_hostname>>__equals__ntw03
+          cluster_param:
+            opencontrail_control_node03_address:
+              value_template: <<node_ip>>
+        kubernetes_compute:
+          expression: <<node_hostname>>__startswith__cmp
+          node_class:
+            value_template:
+              - cluster.<<node_cluster>>.kubernetes.compute
       node:
-        kubernetes_compute_node01:
-          name: ${_param:kubernetes_compute_node01_hostname}
-          domain: ${_param:cluster_domain}
-          classes:
-          - cluster.${_param:cluster_name}.kubernetes.compute
-          params:
-            salt_master_host: ${_param:infra_config_deploy_address}
-            linux_system_codename: xenial
-            single_address: ${_param:kubernetes_compute_node01_address}
-        kubernetes_compute_node02:
-          name: ${_param:kubernetes_compute_node02_hostname}
-          domain: ${_param:cluster_domain}
-          classes:
-          - cluster.${_param:cluster_name}.kubernetes.compute
-          params:
-            salt_master_host: ${_param:infra_config_deploy_address}
-            linux_system_codename: xenial
-            single_address: ${_param:kubernetes_compute_node02_address}
         opencontrail_control_node01:
           params:
             rabbitmq_cluster_role: master
diff --git a/classes/cluster/k8s_ha_contrail/kubernetes/init.yml b/classes/cluster/k8s_ha_contrail/kubernetes/init.yml
index acc7e93..d999c6b 100644
--- a/classes/cluster/k8s_ha_contrail/kubernetes/init.yml
+++ b/classes/cluster/k8s_ha_contrail/kubernetes/init.yml
@@ -30,13 +30,9 @@
     kubernetes_control_node01_hostname: ctl01
     kubernetes_control_node02_hostname: ctl02
     kubernetes_control_node03_hostname: ctl03
-    kubernetes_compute_node01_hostname: cmp01
-    kubernetes_compute_node02_hostname: cmp02
     kubernetes_control_node01_address: 172.16.10.101
     kubernetes_control_node02_address: 172.16.10.102
     kubernetes_control_node03_address: 172.16.10.103
-    kubernetes_compute_node01_address: 172.16.10.105
-    kubernetes_compute_node02_address: 172.16.10.106
     kubernetes_proxy_node01_hostname: prx01
     kubernetes_proxy_node01_address: 172.16.10.121
 
@@ -81,16 +77,6 @@
           names:
           - ${_param:kubernetes_control_node03_hostname}
           - ${_param:kubernetes_control_node03_hostname}.${_param:cluster_domain}
-        cmp01:
-          address: ${_param:kubernetes_compute_node01_address}
-          names:
-          - ${_param:kubernetes_compute_node01_hostname}
-          - ${_param:kubernetes_compute_node01_hostname}.${_param:cluster_domain}
-        cmp02:
-          address: ${_param:kubernetes_compute_node02_address}
-          names:
-          - ${_param:kubernetes_compute_node02_hostname}
-          - ${_param:kubernetes_compute_node02_hostname}.${_param:cluster_domain}
         prx01:
           address: ${_param:kubernetes_proxy_node01_address}
           names:
diff --git a/classes/cluster/sl_k8s_contrail/infra/config.yml b/classes/cluster/sl_k8s_contrail/infra/config.yml
index a908d66..49029cd 100644
--- a/classes/cluster/sl_k8s_contrail/infra/config.yml
+++ b/classes/cluster/sl_k8s_contrail/infra/config.yml
@@ -19,27 +19,85 @@
     linux_system_codename: xenial
     salt_api_password_hash: "$6$WV0P1shnoDh2gI/Z$22/Bcd7ffMv0jDlFpT63cAU4PiXHz9pjXwngToKwqAsgoeK4HNR3PiKaushjxp3JsQ8hNoJmAC6TxzVqfV8WH/"
     salt_master_host: ${_param:infra_config_deploy_address}
+  salt:
+    master:
+      reactor:
+        reclass/minion/classify:
+        - salt://reclass/reactor/node_register.sls
   reclass:
     storage:
-      node:
-        kubernetes_compute_node01:
-          name: ${_param:kubernetes_compute_node01_hostname}
-          domain: ${_param:cluster_domain}
-          classes:
-          - cluster.${_param:cluster_name}.kubernetes.compute
-          params:
-            salt_master_host: ${_param:infra_config_deploy_address}
-            linux_system_codename: xenial
-            single_address: ${_param:kubernetes_compute_node01_address}
-        kubernetes_compute_node02:
-          name: ${_param:kubernetes_compute_node02_hostname}
-          domain: ${_param:cluster_domain}
-          classes:
-          - cluster.${_param:cluster_name}.kubernetes.compute
-          params:
-            salt_master_host: ${_param:infra_config_deploy_address}
-            linux_system_codename: xenial
-            single_address: ${_param:kubernetes_compute_node02_address}
+      class_mapping:
+        common_node:
+          expression: all
+          node_param:
+            single_address:
+              value_template: <<node_ip>>
+            linux_system_codename:
+              value_template: <<node_os>>
+            salt_master_host:
+              value_template: <<node_master_ip>>
+        infra_config:
+          expression: <<node_hostname>>__startswith__cfg
+          cluster_param:
+            infra_config_address:
+              value_template: <<node_ip>>
+            infra_config_deploy_address:
+              value_template: <<node_ip>>
+        kubernetes_control01:
+          expression: <<node_hostname>>__equals__ctl01
+          cluster_param:
+            kubernetes_control_node01_address:
+              value_template: <<node_ip>>
+        kubernetes_control02:
+          expression: <<node_hostname>>__equals__ctl02
+          cluster_param:
+            kubernetes_control_node02_address:
+              value_template: <<node_ip>>
+        kubernetes_control03:
+          expression: <<node_hostname>>__equals__ctl03
+          cluster_param:
+            kubernetes_control_node03_address:
+              value_template: <<node_ip>>
+        opencontrail_control01:
+          expression: <<node_hostname>>__equals__ntw01
+          cluster_param:
+            opencontrail_control_node01_address:
+              value_template: <<node_ip>>
+        opencontrail_control02:
+          expression: <<node_hostname>>__equals__ntw02
+          cluster_param:
+            opencontrail_control_node02_address:
+              value_template: <<node_ip>>
+        opencontrail_control03:
+          expression: <<node_hostname>>__equals__ntw03
+          cluster_param:
+            opencontrail_control_node03_address:
+              value_template: <<node_ip>
+        kubernetes_proxy:
+          expression: <<node_hostname>>__equals__prx01
+          cluster_param:
+            kubernetes_proxy_node01_address:
+              value_template: <<node_ip>>
+        stacklight_node01:
+          expression: <<node_hostname>>__equals__mon01
+          cluster_param:
+            stacklight_node03_address:
+              value_template: <<node_ip>>
+        stacklight_node02:
+          expression: <<node_hostname>>__equals__mon02
+          cluster_param:
+            stacklight_node03_address:
+              value_template: <<node_ip>>
+        stacklight_node03:
+          expression: <<node_hostname>>__equals__mon03
+          cluster_param:
+            stacklight_node03_address:
+              value_template: <<node_ip>>
+        kubernetes_compute:
+          expression: <<node_hostname>>__startswith__cmp
+          node_class:
+            value_template:
+              - cluster.<<node_cluster>>.kubernetes.compute
         prx_node:
           name: ${_param:kubernetes_proxy_node01_hostname}
           domain: ${_param:cluster_domain}
diff --git a/classes/cluster/sl_k8s_contrail/kubernetes/init.yml b/classes/cluster/sl_k8s_contrail/kubernetes/init.yml
index acc7e93..d999c6b 100644
--- a/classes/cluster/sl_k8s_contrail/kubernetes/init.yml
+++ b/classes/cluster/sl_k8s_contrail/kubernetes/init.yml
@@ -30,13 +30,9 @@
     kubernetes_control_node01_hostname: ctl01
     kubernetes_control_node02_hostname: ctl02
     kubernetes_control_node03_hostname: ctl03
-    kubernetes_compute_node01_hostname: cmp01
-    kubernetes_compute_node02_hostname: cmp02
     kubernetes_control_node01_address: 172.16.10.101
     kubernetes_control_node02_address: 172.16.10.102
     kubernetes_control_node03_address: 172.16.10.103
-    kubernetes_compute_node01_address: 172.16.10.105
-    kubernetes_compute_node02_address: 172.16.10.106
     kubernetes_proxy_node01_hostname: prx01
     kubernetes_proxy_node01_address: 172.16.10.121
 
@@ -81,16 +77,6 @@
           names:
           - ${_param:kubernetes_control_node03_hostname}
           - ${_param:kubernetes_control_node03_hostname}.${_param:cluster_domain}
-        cmp01:
-          address: ${_param:kubernetes_compute_node01_address}
-          names:
-          - ${_param:kubernetes_compute_node01_hostname}
-          - ${_param:kubernetes_compute_node01_hostname}.${_param:cluster_domain}
-        cmp02:
-          address: ${_param:kubernetes_compute_node02_address}
-          names:
-          - ${_param:kubernetes_compute_node02_hostname}
-          - ${_param:kubernetes_compute_node02_hostname}.${_param:cluster_domain}
         prx01:
           address: ${_param:kubernetes_proxy_node01_address}
           names: