Change networks and subnets schemes due to different
ways of deploying BM cloud or virtaul

Add heat template for BM deploy (heat-bm-cicd-queens-contrail-sl)
Add bm-eu-cloud.env with parameters for BM deploy
Normalize output for getting correct IP of foundation node
Align all virtual models to new changes

Change-Id: I1e0daac4e82aea06e75de61d2fc5041e6ec4d138
diff --git a/tcp_tests/templates/heat-cicd-k8s-calico-sl/underlay.hot b/tcp_tests/templates/heat-cicd-k8s-calico-sl/underlay.hot
index c8ec4fe..d1f77b4 100644
--- a/tcp_tests/templates/heat-cicd-k8s-calico-sl/underlay.hot
+++ b/tcp_tests/templates/heat-cicd-k8s-calico-sl/underlay.hot
@@ -59,6 +59,16 @@
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
+  subnets:
+    depends_on: [networks]
+    type: MCP::Subnets
+    properties:
+      stack_name: { get_param: "OS::stack_name" }
+      env_name: { get_param: env_name }
+      management_net: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      control_net: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      tenant_net: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+      external_net: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
 
   #flavors:
   #  type: MCP::Flavors
@@ -70,17 +80,20 @@
       env_name: { get_param: env_name }
       mcp_version: { get_param: mcp_version }
       cfg01_flavor: { get_param: cfg_flavor }
+      management_net: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      control_net: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      tenant_net: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+      external_net: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '15' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '15' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '15' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '15' ]
       instance_name: cfg01
       instance_domain: {get_param: instance_domain}
-      network: { get_attr: [networks, network] }
 
   control_cluster:
     type: MCP::MultipleInstance
@@ -94,44 +107,43 @@
       instance03_name: ctl03
       instance01_role: k8s_controller
       instance_flavor: {get_param: ctl_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       instance01_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '11' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '11' ]
       instance02_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '12' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '12' ]
       instance03_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '13' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '13' ]
       instance01_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '11' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '11' ]
       instance02_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '12' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '12' ]
       instance03_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '13' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '13' ]
       instance01_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '11' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '11' ]
       instance02_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '12' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '12' ]
       instance03_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '13' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '13' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -146,44 +158,43 @@
       instance02_name: kvm02
       instance03_name: kvm03
       instance_flavor: {get_param: kvm_fake_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       instance01_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '241' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '241' ]
       instance02_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '242' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '242' ]
       instance03_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '243' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '243' ]
       instance01_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '241' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '241' ]
       instance02_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '242' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '242' ]
       instance03_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '243' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '243' ]
       instance01_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '241' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '241' ]
       instance02_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '242' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '242' ]
       instance03_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '243' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '243' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -198,44 +209,43 @@
       instance02_name: cid02
       instance03_name: cid03
       instance_flavor: {get_param: cid_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       instance01_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '91' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '91' ]
       instance02_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '92' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '92' ]
       instance03_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '93' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '93' ]
       instance01_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '91' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '91' ]
       instance02_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '92' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '92' ]
       instance03_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '93' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '93' ]
       instance01_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '91' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '91' ]
       instance02_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '92' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '92' ]
       instance03_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '93' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '93' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -250,44 +260,43 @@
       instance02_name: mon02
       instance03_name: mon03
       instance_flavor: {get_param: mon_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       instance01_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '71' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '71' ]
       instance02_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '72' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '72' ]
       instance03_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '73' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '73' ]
       instance01_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '71' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '71' ]
       instance02_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '72' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '72' ]
       instance03_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '73' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '73' ]
       instance01_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '71' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '71' ]
       instance02_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '72' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '72' ]
       instance03_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '73' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '73' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -302,44 +311,43 @@
       instance02_name: log02
       instance03_name: log03
       instance_flavor: {get_param: log_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       instance01_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '61' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '61' ]
       instance02_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '62' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '62' ]
       instance03_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '63' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '63' ]
       instance01_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '61' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '61' ]
       instance02_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '62' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '62' ]
       instance03_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '63' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '63' ]
       instance01_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '61' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '61' ]
       instance02_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '62' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '62' ]
       instance03_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '63' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '63' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -354,44 +362,43 @@
       instance02_name: mtr02
       instance03_name: mtr03
       instance_flavor: {get_param: mtr_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       instance01_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '86' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '86' ]
       instance02_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '87' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '87' ]
       instance03_control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '88' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '88' ]
       instance01_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '86' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '86' ]
       instance02_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '87' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '87' ]
       instance03_tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '88' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '88' ]
       instance01_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '86' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '86' ]
       instance02_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '87' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '87' ]
       instance03_external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '88' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '88' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -404,20 +411,19 @@
       instance_domain: {get_param: instance_domain}
       instance_name: prx01
       instance_flavor: {get_param: cid_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '221' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '221' ]
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '221' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '221' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '221' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '221' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -430,20 +436,19 @@
       instance_domain: {get_param: instance_domain}
       instance_name: prx02
       instance_flavor: {get_param: cid_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '222' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '222' ]
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '222' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '222' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '222' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '222' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -456,20 +461,19 @@
       instance_domain: {get_param: instance_domain}
       instance_name: cmp001
       instance_flavor: {get_param: cmp_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '101' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '101' ]
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '101' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '101' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '101' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '101' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -482,20 +486,19 @@
       instance_domain: {get_param: instance_domain}
       instance_name: cmp002
       instance_flavor: {get_param: cmp_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '102' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '102' ]
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '102' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '102' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '102' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '102' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -508,20 +511,19 @@
       instance_domain: {get_param: instance_domain}
       instance_name: cmp003
       instance_flavor: {get_param: cmp_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '103' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '103' ]
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '103' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '103' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '103' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '103' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -534,20 +536,19 @@
       instance_domain: {get_param: instance_domain}
       instance_name: cmp004
       instance_flavor: {get_param: cmp_flavor}
-      network: { get_attr: [networks, network] }
       underlay_userdata: { get_file: ./underlay-userdata.yaml }
       control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '104' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '104' ]
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '104' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '104' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '104' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '104' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
@@ -561,34 +562,32 @@
       instance_name: foundation
       instance_image: { get_param: foundation_image }
       instance_flavor: {get_param: foundation_flavor}
-      network: { get_attr: [networks, network] }
+      management_net: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      control_net: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      tenant_net: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+      external_net: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
       underlay_userdata: { get_file: ./underlay--user-data-foundation.yaml }
+      management_net_static_ip:
+        list_join:
+        - '.'
+        - [ { get_attr: [subnets, management_net_prefix] }, '5' ]
       control_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, control_net_prefix] }, '5' ]
+        - [ { get_attr: [subnets, control_net_prefix] }, '5' ]
       tenant_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, tenant_net_prefix] }, '5' ]
+        - [ { get_attr: [subnets, tenant_net_prefix] }, '5' ]
       external_net_static_ip:
         list_join:
         - '.'
-        - [ { get_attr: [networks, external_net_prefix] }, '5' ]
+        - [ { get_attr: [subnets, external_net_prefix] }, '5' ]
 
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
 outputs:
-
-  control_subnet_cidr:
-    description: Control network CIDR
-    value: { get_param: control_subnet_cidr }
-
-  management_subnet_cidr:
-    description: Admin network CIDR
-    value: { get_param: management_subnet_cidr }
-
-  foundation_floating:
+  foundation_public_ip:
     description: foundation node IP address (floating) from external network
     value:
       get_attr: