Add heat template for oc41 deploymeent

Change-Id: Ida9e87c6452f9f7769fab1764332c29fce26bf7b
diff --git a/tcp_tests/templates/_heat_environments/ReadMe.md b/tcp_tests/templates/_heat_environments/ReadMe.md
new file mode 100644
index 0000000..09f568a
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/ReadMe.md
@@ -0,0 +1,116 @@
+1. Required template parameters
+===============================
+Parameters with fixed names required by Jenkins pipeline swarm-bootstrap-salt-cluster-heat.groovy.
+These parameters can be defined in .env or .hot file and are used to generate model.
+```
+management_subnet_cidr
+management_subnet_gateway_ip
+management_subnet_cfg01_ip
+control_subnet_cidr
+tenant_subnet_cidr
+external_subnet_cidr
+```
+Also, the following parameters might be useful to define:
+```
+management_subnet_pool_start
+management_subnet_pool_end
+```
+
+2. Required template objects
+============================
+
+2.1 Node roles
+--------------
+
+Node roles are automatically gathered in the envmanager_heat.py
+from OS::Nova::Server , where defined as a list using "metadata:roles" key:
+
+```
+     cfg01_node:
+       type: OS::Nova::Server
+       properties:
+         metadata:
+           roles:
+           - salt_master
+```
+
+2.2 L3 network roles
+--------------------
+
+Network roles are automatically gathered in the envmanager_heat.py
+from OS::Neutron::Subnet , where defined as list of tags:
+
+```
+  control_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      ...
+      tags:
+      - private-pool01
+```
+There are four fixed network roles at the moment:
+```
+admin-pool01    # for management_subnet_cidr
+private-pool01  # for control_subnet_cidr
+tenant-pool01   # for tenant_subnet_cidr
+external-pool01 # for external_subnet_cidr
+```
+
+3. External parameters
+======================
+
+There are parameters which are automatically defined outside
+of the template defaults in the envmanager_heat.py, and can be used
+in the template to define or find specified resources:
+```
+env_name     # set from environment variable ENV_NAME. Matches heat stack name
+mcp_version  # set from environment variable MCP_VERSION
+```
+
+4. Pre-defined resources in the OpenStack cloud
+===============================================
+
+4.1 Public network
+------------------
+Public network for floating IP addresses should be pre-defined.
+Heat templates must use this network to define floating IPs.
+
+4.2 Images
+----------
+Jenkins pipeline swarm-bootstrap-salt-cluster-heat.groovy check and create
+required images. In the template, the following image names should be used:
+
+```
+# Image used to bootstrap salt master node cfg01:
+image: { list_join: ['', [ 'cfg01-day01-', { get_param: mcp_version } ]] }
+
+# Config drive image to boot cfg01, with user-data and reclass model
+image: { list_join: ['', [ 'cfg01.', { get_param: env_name }, '-config-drive.iso' ]] }
+
+# Image used to bootstrap VCP nodes:
+image: { list_join: ['', [ 'ubuntu-vcp-', { get_param: mcp_version } ]] }
+
+# Image used to bootstrap the Foundation node:
+image: { list_join: ['', [ 'ubuntu-16.04-foundation-', { get_param: mcp_version } ]] }
+```
+
+5. The foundation node
+======================
+To get direct access to the environment resources without tunnels and jump hosts,
+the pipeline swarm-bootstrap-salt-cluster-heat.groovy expects that a foundation node
+will be defined in each heat template.
+
+This node is used to launch a Jenkins agent and run Jenkins jobs inside the
+heat stack. Depending on environment, the Foundation node could be connected
+to several or to all the internal networks to run necessary tests.
+
+The template 'outputs' should contain the 'foundation_floating' key, for example:
+```
+outputs:
+  foundation_floating:
+    description: foundation node IP address (floating) from external network
+    value:
+      get_attr:
+      - foundation_node
+      - instance_floating_address
+```
diff --git a/tcp_tests/templates/_heat_environments/eu-cloud.env b/tcp_tests/templates/_heat_environments/eu-cloud.env
new file mode 100644
index 0000000..de3bb06
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/eu-cloud.env
@@ -0,0 +1,40 @@
+
+resource_registry:
+  "MCP::MultipleInstance": fragments/MultipleInstance.yaml
+  #"MCP::Flavors": fragments/Flavors.yaml
+  "MCP::MasterNode": fragments/MasterNode.yaml
+  "MCP::Compute": fragments/Compute.yaml
+  "MCP::Networks": fragments/Networks.yaml
+  "MCP::SingleInstance": fragments/Instance.yaml
+  "MCP::FoundationNode": fragments/FoundationNode.yaml
+
+parameter_defaults:
+
+  cfg_flavor: system.virtual.salt_master
+  ctl_flavor: system.golden.openstack.control
+  cid_flavor: system.golden.cicd.control
+  ntw_flavor: system.compact.opencontrail.control
+  nal_flavor: system.compact.opencontrail.analytics
+  dbs_flavor: system.golden.openstack.database
+  msg_flavor: system.golden.openstack.message_queue
+  mon_flavor: system.golden.stacklight.server
+  log_flavor: system.golden.stacklight.log
+  mtr_flavor: system.golden.stacklight.telemetry
+  cmp_flavor: system.virtual.openstack.compute
+  kvm_fake_flavor: system.virtual.fake_kvm
+  foundation_flavor: system.virtual.foundation
+
+  key_pair: system_key_8133
+
+  net_public: public
+
+  nameservers: 172.18.208.44
+  control_subnet_cidr: "10.6.0.0/24"
+  tenant_subnet_cidr: "10.8.0.0/24"
+  external_subnet_cidr: "10.9.0.0/24"
+  management_subnet_cidr: "10.7.0.0/24"
+  management_subnet_cfg01_ip: 10.7.0.15
+  management_subnet_gateway_ip: 10.7.0.1
+  management_subnet_pool_start: 10.7.0.20
+  management_subnet_pool_end: 10.7.0.60
+  salt_master_control_ip: 10.6.0.15
diff --git a/tcp_tests/templates/_heat_environments/fragments/Compute.yaml b/tcp_tests/templates/_heat_environments/fragments/Compute.yaml
new file mode 100644
index 0000000..6b4c0c7
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/Compute.yaml
@@ -0,0 +1,110 @@
+heat_template_version: queens
+
+description: Single server instance fragment
+
+parameters:
+  network:
+    type: string
+  instance_flavor:
+    type: string
+  instance_name:
+    type: string
+  instance_config_host:
+    type: string
+  key_pair:
+    type: string
+  instance_domain:
+    type: string
+  net_public:
+    type: string
+  control_net_static_ip:
+    type: string
+  underlay_userdata:
+    type: string
+  mcp_version:
+    type: string
+  env_name:
+    type: string
+
+resources:
+  instance_port01:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+  instance_port02:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      fixed_ips:
+        - ip_address: { get_param: control_net_static_ip }
+  instance_port03:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+
+  instance_instance:
+    type: OS::Nova::Server
+    properties:
+      image_update_policy: REBUILD
+      flavor: { get_param: instance_flavor }
+      image: { list_join: ['', [ 'ubuntu-vcp-', { get_param: mcp_version } ]] }
+      key_name: { get_param: key_pair }
+      name:
+        list_join:
+        - '.'
+        - [ { get_param: instance_name }, { get_param: instance_domain } ]
+      networks:
+      - port: { get_resource: instance_port01 }
+      - port: { get_resource: instance_port02 }
+      - port: { get_resource: instance_port03 }
+      block_device_mapping_v2:
+      - device_name: /dev/vdb
+        device_type: disk
+        boot_index: -1
+        delete_on_termination: true
+        ephemeral_size: 10
+
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          #template: { get_file: underlay--user-data-cfg01--heat.yaml }
+          #template: { get_file: ../underlay-userdata.yaml }
+          template: { get_param: underlay_userdata }
+          params:
+            hostname: { list_join: ['.', [ { get_param: instance_name }, { get_param: instance_domain } ]] }
+            $node_hostname: { get_param: instance_name }
+            $node_domain: { get_param: instance_domain }
+            $config_host: { get_param: instance_config_host }
+      metadata:
+        roles:
+        - salt_minion
+
+  floating_ip:
+    depends_on: [instance_instance]
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network: { get_param: net_public }
+      port_id: { get_resource: instance_port01 }
+  floating_ip_association:
+    depends_on: [floating_ip]
+    type: OS::Neutron::FloatingIPAssociation
+    properties:
+      floatingip_id:  { get_resource: floating_ip }
+      port_id: { get_resource: instance_port01 }
+
+outputs:
+  instance_address:
+    value:
+      get_attr:
+      - instance_instance
+      - addresses
+      - 'management_net'
+      - 0
+      - addr
+    description: "Instance's private IP address"
+  instance:
+    value: { get_resource: instance_instance }
+    description: "Instance"
diff --git a/tcp_tests/templates/_heat_environments/fragments/Flavors.yaml b/tcp_tests/templates/_heat_environments/fragments/Flavors.yaml
new file mode 100644
index 0000000..6db41e6
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/Flavors.yaml
@@ -0,0 +1,123 @@
+---
+
+heat_template_version: queens
+
+resources:
+  cfg01_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 100
+      extra_specs: {"capabilities:hypervisor_type": "QEMU", "hw:numa_nodes": "2", "hw:numa_cpus.0": "0,4,1,5", "hw:numa_cpus.1": "2,6,3,7", "hw:numa_mem.0": "8192", "hw:numa_mem.1": "8192"}
+      name: cfg01_virtual
+      ram: 16384
+      vcpus: 8
+
+  kvm_fake_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 120
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: kvm_fake_virtual
+      ram: 2048
+      vcpus: 1
+
+  ctl_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 120
+      extra_specs: {"capabilities:hypervisor_type": "QEMU", "hw:numa_nodes": "2", "hw:numa_cpus.0": "0,4,1,5", "hw:numa_cpus.1": "2,6,3,7", "hw:numa_mem.0": "8192", "hw:numa_mem.1": "8192"}
+      name: ctl_virtual
+      ram: 16384
+      vcpus: 8
+
+  cid_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 120
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: cid_virtual
+      ram: 6144
+      vcpus: 2
+
+  ntw_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 120
+      extra_specs: {"capabilities:hypervisor_type": "QEMU", "hw:numa_nodes": "2", "hw:numa_cpus.0": "0,1", "hw:numa_cpus.1": "2,3", "hw:numa_mem.0": "8192", "hw:numa_mem.1": "8192"}
+      name: ntw_virtual
+      ram: 16384
+      vcpus: 4
+
+  nal_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 120
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: nal_virtual
+      ram: 4096
+      vcpus: 4
+
+  dbs_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 150
+      extra_specs: {"capabilities:hypervisor_type": "QEMU", "hw:numa_nodes": "2", "hw:numa_cpus.0": "0,1", "hw:numa_cpus.1": "2,3", "hw:numa_mem.0": "4096", "hw:numa_mem.1": "4096"}
+      name: dbs_virtual
+      ram: 8192
+      vcpus: 4
+
+  msg_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 120
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: msg_virtual
+      ram: 16384
+      vcpus: 4
+
+  mon_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 120
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: mon_virtual
+      ram: 4096
+      vcpus: 2
+
+  log_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 100
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: log_virtual
+      ram: 4096
+      vcpus: 2
+
+  mtr_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 100
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: mtr_virtual
+      ram: 4096
+      vcpus: 2
+
+  cmp_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 150
+      extra_specs: {"capabilities:hypervisor_type": "QEMU", "hw:numa_nodes": "2", "hw:numa_cpus.0": "0,1", "hw:numa_cpus.1": "2,3", "hw:numa_mem.0": "4096", "hw:numa_mem.1": "4096"}
+      name: cmp_virtual
+      ephemeral: 10
+      ram: 8192
+      vcpus: 4
+
+  foundation_virtual:
+    type: OS::Nova::Flavor
+    properties:
+      disk: 100
+      extra_specs: {"capabilities:hypervisor_type": "QEMU"}
+      name: foundation_virtual
+      ram: 4096
+      vcpus: 2
+...
diff --git a/tcp_tests/templates/_heat_environments/fragments/FoundationNode.yaml b/tcp_tests/templates/_heat_environments/fragments/FoundationNode.yaml
new file mode 100644
index 0000000..91f058a
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/FoundationNode.yaml
@@ -0,0 +1,117 @@
+heat_template_version: queens
+
+description: Single server instance fragment
+
+parameters:
+  network:
+    type: string
+  instance_flavor:
+    type: string
+  instance_name:
+    type: string
+  instance_config_host:
+    type: string
+  key_pair:
+    type: string
+  instance_domain:
+    type: string
+  net_public:
+    type: string
+  control_net_static_ip:
+    type: string
+  underlay_userdata:
+    type: string
+  env_name:
+    type: string
+  mcp_version:
+    type: string
+
+resources:
+  instance_port01:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+  instance_port02:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      fixed_ips:
+        - ip_address: { get_param: control_net_static_ip }
+  instance_port03:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+  instance_port04:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
+
+  instance_instance:
+    type: OS::Nova::Server
+    properties:
+      image_update_policy: REBUILD
+      flavor: { get_param: instance_flavor }
+      image: { list_join: ['', [ 'ubuntu-16.04-foundation-', { get_param: mcp_version } ]] }
+      key_name: { get_param: key_pair }
+      name:
+        list_join:
+        - '.'
+        - [ { get_param: instance_name }, { get_param: env_name } ]
+      networks:
+      - port: { get_resource: instance_port01 }
+      - port: { get_resource: instance_port02 }
+      - port: { get_resource: instance_port03 }
+      - port: { get_resource: instance_port04 }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          #template: { get_file: underlay--user-data-cfg01--heat.yaml }
+          #template: { get_file: ../underlay-userdata.yaml }
+          template: { get_param: underlay_userdata }
+          params:
+            hostname: { list_join: ['.', [ { get_param: instance_name }, { get_param: instance_domain } ]] }
+            $node_hostname: { get_param: instance_name }
+            $node_domain: { get_param: instance_domain }
+            $config_host: { get_param: instance_config_host }
+      metadata:
+        roles:
+        - foundation_jenkins_slave
+
+  floating_ip:
+    depends_on: [instance_instance]
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network: { get_param: net_public }
+      port_id: { get_resource: instance_port01 }
+  floating_ip_association:
+    depends_on: [floating_ip]
+    type: OS::Neutron::FloatingIPAssociation
+    properties:
+      floatingip_id:  { get_resource: floating_ip }
+      port_id: { get_resource: instance_port01 }
+
+outputs:
+
+  instance_floating_address:
+    description: foundation node IP address (floating) from external network
+    value:
+      get_attr:
+      - floating_ip
+      - floating_ip_address
+
+  instance_address:
+    value:
+      get_attr:
+      - instance_instance
+      - addresses
+      - 'management_net'
+      - 0
+      - addr
+    description: "Instance's private IP address"
+  instance:
+    value: { get_resource: instance_instance }
+    description: "Instance"
diff --git a/tcp_tests/templates/_heat_environments/fragments/Instance.yaml b/tcp_tests/templates/_heat_environments/fragments/Instance.yaml
new file mode 100644
index 0000000..1c9be45
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/Instance.yaml
@@ -0,0 +1,103 @@
+heat_template_version: queens
+
+description: Single server instance fragment
+
+parameters:
+  network:
+    type: string
+  instance_flavor:
+    type: string
+  instance_name:
+    type: string
+  instance_config_host:
+    type: string
+  key_pair:
+    type: string
+  instance_domain:
+    type: string
+  net_public:
+    type: string
+  control_net_static_ip:
+    type: string
+  underlay_userdata:
+    type: string
+  mcp_version:
+    type: string
+  env_name:
+    type: string
+
+resources:
+  instance_port01:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+  instance_port02:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      fixed_ips:
+        - ip_address: { get_param: control_net_static_ip }
+  instance_port03:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+
+  instance_instance:
+    type: OS::Nova::Server
+    properties:
+      image_update_policy: REBUILD
+      flavor: { get_param: instance_flavor }
+      image: { list_join: ['', [ 'ubuntu-vcp-', { get_param: mcp_version } ]] }
+      key_name: { get_param: key_pair }
+      name:
+        list_join:
+        - '.'
+        - [ { get_param: instance_name }, { get_param: instance_domain } ]
+      networks:
+      - port: { get_resource: instance_port01 }
+      - port: { get_resource: instance_port02 }
+      - port: { get_resource: instance_port03 }
+      user_data_format: RAW
+      user_data:
+        str_replace:
+          #template: { get_file: underlay--user-data-cfg01--heat.yaml }
+          template: { get_param: underlay_userdata }
+          #template: { get_file: ../../templates/{ get_param: lab_config_name }/underlay-userdata.yaml }
+          params:
+            hostname: { list_join: ['.', [ { get_param: instance_name }, { get_param: instance_domain } ]] }
+            $node_hostname: { get_param: instance_name }
+            $node_domain: { get_param: instance_domain }
+            $config_host: { get_param: instance_config_host }
+      metadata:
+        roles:
+        - salt_minion
+
+  floating_ip:
+    depends_on: [instance_instance]
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network: { get_param: net_public }
+      port_id: { get_resource: instance_port01 }
+  floating_ip_association:
+    depends_on: [floating_ip]
+    type: OS::Neutron::FloatingIPAssociation
+    properties:
+      floatingip_id:  { get_resource: floating_ip }
+      port_id: { get_resource: instance_port01 }
+
+outputs:
+  instance_address:
+    value:
+      get_attr:
+      - instance_instance
+      - addresses
+      - 'management_net'
+      - 0
+      - addr
+    description: "Instance's private IP address"
+  instance:
+    value: { get_resource: instance_instance }
+    description: "Instance"
diff --git a/tcp_tests/templates/_heat_environments/fragments/MasterNode.yaml b/tcp_tests/templates/_heat_environments/fragments/MasterNode.yaml
new file mode 100644
index 0000000..410deb6
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/MasterNode.yaml
@@ -0,0 +1,94 @@
+heat_template_version: queens
+
+description: Single server instance fragment
+
+parameters:
+  management_subnet_cfg01_ip:
+    type: string
+  salt_master_control_ip:
+    type: string
+  network:
+    type: string
+  cfg01_flavor:
+    type: string
+  instance_name:
+    type: string
+  key_pair:
+    type: string
+  instance_domain:
+    type: string
+  net_public:
+    type: string
+  mcp_version:
+    type: string
+  env_name:
+    type: string
+
+resources:
+  instance_port01:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      fixed_ips:
+        - ip_address: { get_param: management_subnet_cfg01_ip }
+
+  instance_port02:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      fixed_ips:
+        - ip_address: { get_param: salt_master_control_ip }
+
+  instance_instance:
+    type: OS::Nova::Server
+    properties:
+      image_update_policy: REBUILD
+      flavor: { get_param: cfg01_flavor }
+      image: { list_join: ['', [ 'cfg01-day01-', { get_param: mcp_version } ]] }
+      key_name: { get_param: key_pair }
+      name:
+        list_join:
+        - '.'
+        - [ { get_param: instance_name }, { get_param: instance_domain } ]
+      networks:
+      - port: { get_resource: instance_port01 }
+      - port: { get_resource: instance_port02 }
+      block_device_mapping_v2:
+      - device_name: /dev/cdrom
+        device_type: cdrom
+        boot_index: -1
+        delete_on_termination: true
+        image: { list_join: ['', [ 'cfg01.', { get_param: env_name }, '-config-drive.iso' ]] }
+        volume_size: 1
+      metadata:
+        roles:
+        - salt_master
+
+  floating_ip:
+    depends_on: [instance_instance]
+    type: OS::Neutron::FloatingIP
+    properties:
+      floating_network: { get_param: net_public }
+      port_id: { get_resource: instance_port01 }
+  floating_ip_association:
+    depends_on: [floating_ip]
+    type: OS::Neutron::FloatingIPAssociation
+    properties:
+      floatingip_id:  { get_resource: floating_ip }
+      port_id: { get_resource: instance_port01 }
+
+outputs:
+  instance_address:
+    value:
+      get_attr:
+      - instance_instance
+      - addresses
+      - 'management_net'
+      - 0
+      - addr
+    description: "Instance's private IP address"
+  instance:
+    value: { get_resource: instance_instance }
+    description: "Instance"
diff --git a/tcp_tests/templates/_heat_environments/fragments/MultipleInstance.yaml b/tcp_tests/templates/_heat_environments/fragments/MultipleInstance.yaml
new file mode 100644
index 0000000..986b855
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/MultipleInstance.yaml
@@ -0,0 +1,76 @@
+heat_template_version: queens
+
+description: 3 single nodes fragment
+
+parameters:
+  key_pair:
+    type: string
+  network:
+    type: string
+  instance01_name:
+    type: string
+  instance02_name:
+    type: string
+  instance03_name:
+    type: string
+  instance_domain:
+    type: string
+  instance_flavor:
+    type: string
+  instance_config_host:
+    type: string
+  instance01_control_net_static_ip:
+    type: string
+  instance02_control_net_static_ip:
+    type: string
+  instance03_control_net_static_ip:
+    type: string
+  underlay_userdata:
+    type: string
+  mcp_version:
+    type: string
+  env_name:
+    type: string
+
+resources:
+  instance01:
+    type: MCP::SingleInstance
+    properties:
+      env_name: { get_param: env_name }
+      mcp_version: { get_param: mcp_version }
+      key_pair: { get_param: key_pair }
+      network: { get_param: network }
+      control_net_static_ip: {get_param: instance01_control_net_static_ip }
+      instance_name: { get_param: instance01_name }
+      instance_domain: { get_param: instance_domain }
+      instance_flavor: { get_param: instance_flavor }
+      instance_config_host: { get_param: instance_config_host }
+      underlay_userdata: { get_param: underlay_userdata }
+
+  instance02:
+    type: MCP::SingleInstance
+    properties:
+      env_name: { get_param: env_name }
+      mcp_version: { get_param: mcp_version }
+      key_pair: { get_param: key_pair }
+      network: { get_param: network }
+      control_net_static_ip: {get_param: instance02_control_net_static_ip }
+      instance_name: { get_param: instance02_name }
+      instance_domain: { get_param: instance_domain }
+      instance_flavor: { get_param: instance_flavor }
+      instance_config_host: { get_param: instance_config_host }
+      underlay_userdata: { get_param: underlay_userdata }
+
+  instance03:
+    type: MCP::SingleInstance
+    properties:
+      env_name: { get_param: env_name }
+      mcp_version: { get_param: mcp_version }
+      key_pair: { get_param: key_pair }
+      network: { get_param: network }
+      control_net_static_ip: {get_param: instance03_control_net_static_ip }
+      instance_name: { get_param: instance03_name }
+      instance_domain: { get_param: instance_domain }
+      instance_flavor: { get_param: instance_flavor }
+      instance_config_host: { get_param: instance_config_host }
+      underlay_userdata: { get_param: underlay_userdata }
diff --git a/tcp_tests/templates/_heat_environments/fragments/Networks.yaml b/tcp_tests/templates/_heat_environments/fragments/Networks.yaml
new file mode 100644
index 0000000..076684b
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/Networks.yaml
@@ -0,0 +1,173 @@
+---
+heat_template_version: queens
+
+description: Network fragment
+
+parameters:
+  env_name:
+    type: string
+  net_public:
+    type: string
+  stack_name:
+    type: string
+  control_subnet_cidr:
+    type: string
+  tenant_subnet_cidr:
+    type: string
+  management_subnet_cidr:
+    type: string
+  external_subnet_cidr:
+    type: string
+  management_subnet_gateway_ip:
+    type: string
+#  control_net_dhcp:
+#    type: boolean
+#    default: false
+#  tenant_net_dhcp:
+#    type: boolean
+#    default: false
+  management_net_dhcp:
+    type: boolean
+    default: true
+  management_subnet_pool_start:
+    type: string
+  management_subnet_pool_end:
+    type: string
+#  external_net_dhcp:
+#    type: boolean
+#    default: false
+
+  nameservers:
+    type: comma_delimited_list
+
+resources:
+  control_net:
+    type: OS::Neutron::Net
+    properties:
+      port_security_enabled: false
+      name: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+  tenant_net:
+    type: OS::Neutron::Net
+    properties:
+      port_security_enabled: false
+      name: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+  management_net:
+    type: OS::Neutron::Net
+    properties:
+      port_security_enabled: false
+      name: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+  external_net:
+    type: OS::Neutron::Net
+    properties:
+      port_security_enabled: false
+      name: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
+
+  control_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { list_join: ['-', [ 'control_subnet', { get_param: env_name } ]] }
+      #name: control_subnet
+      network: { get_resource: control_net }
+      cidr: { get_param: control_subnet_cidr }
+      #enable_dhcp: { get_param: control_net_dhcp }
+      #dns_nameservers: { get_param: nameservers }
+      dns_nameservers: [0.0.0.0]
+      gateway_ip: null
+      tags:
+      - private-pool01
+
+  tenant_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { list_join: ['-', [ 'tenant_subnet', { get_param: env_name } ]] }
+      #name: tenant_subnet
+      network: { get_resource: tenant_net }
+      cidr: { get_param: tenant_subnet_cidr }
+      #enable_dhcp: { get_param: tenant_net_dhcp }
+      #dns_nameservers: { get_param: nameservers }
+      dns_nameservers: [0.0.0.0]
+      gateway_ip: null
+      tags:
+      - tenant-pool01
+
+  management_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      gateway_ip: { get_param: management_subnet_gateway_ip }
+      name: { list_join: ['-', [ 'management_subnet', { get_param: env_name } ]] }
+      #name: management_subnet
+      network: { get_resource: management_net }
+      cidr: { get_param: management_subnet_cidr }
+      enable_dhcp: { get_param: management_net_dhcp }
+      allocation_pools:
+        - start: { get_param: management_subnet_pool_start }
+          end: { get_param: management_subnet_pool_end }
+      dns_nameservers: { get_param: nameservers }
+      tags:
+      - admin-pool01
+
+  external_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { list_join: ['-', [ 'external_subnet', { get_param: env_name } ]] }
+      #name: external_subnet
+      network: { get_resource: external_net }
+      cidr: { get_param: external_subnet_cidr }
+      #enable_dhcp: { get_param: external_net_dhcp }
+      #dns_nameservers: { get_param: nameservers }
+      dns_nameservers: [0.0.0.0]
+      gateway_ip: null
+      tags:
+      - external-pool01
+
+  router:
+    type: OS::Neutron::Router
+    properties:
+      #name: publicbarerouter
+      external_gateway_info:
+        network: { get_param: net_public }
+        #enable_snat: True
+
+  router_subnet:
+    type: OS::Neutron::RouterInterface
+    depends_on: management_subnet
+    properties:
+      router: { get_resource: router }
+      subnet: { get_resource: management_subnet }
+
+outputs:
+  network:
+    value: { get_param: stack_name }
+  management_net_prefix:
+    value:
+      list_join:
+        - '.'
+        - - str_split: ['.', { get_param: management_subnet_cidr }, 0]
+          - str_split: ['.', { get_param: management_subnet_cidr }, 1]
+          - str_split: ['.', { get_param: management_subnet_cidr }, 2]
+
+  control_net_prefix:
+    value:
+      list_join:
+        - '.'
+        - - str_split: ['.', { get_param: control_subnet_cidr }, 0]
+          - str_split: ['.', { get_param: control_subnet_cidr }, 1]
+          - str_split: ['.', { get_param: control_subnet_cidr }, 2]
+
+  tenant_net_prefix:
+    value:
+      list_join:
+        - '.'
+        - - str_split: ['.', { get_param: tenant_subnet_cidr }, 0]
+          - str_split: ['.', { get_param: tenant_subnet_cidr }, 1]
+          - str_split: ['.', { get_param: tenant_subnet_cidr }, 2]
+
+  external_net_prefix:
+    value:
+      list_join:
+        - '.'
+        - - str_split: ['.', { get_param: external_subnet_cidr }, 0]
+          - str_split: ['.', { get_param: external_subnet_cidr }, 1]
+          - str_split: ['.', { get_param: external_subnet_cidr }, 2]
+
+...
diff --git a/tcp_tests/templates/_heat_environments/microcloud-8116-cookied-cicd-queens-dvr-sl.sh b/tcp_tests/templates/_heat_environments/microcloud-8116-cookied-cicd-queens-dvr-sl.sh
old mode 100755
new mode 100644
diff --git a/tcp_tests/templates/_heat_environments/microcloud-8116.env b/tcp_tests/templates/_heat_environments/microcloud-8116.env
deleted file mode 100644
index 9570a55..0000000
--- a/tcp_tests/templates/_heat_environments/microcloud-8116.env
+++ /dev/null
@@ -1,24 +0,0 @@
----
-
-parameter_defaults:
-  #flavor_medium: baremetal
-  flavor_medium: cfg01-virtual
-  flavor_ctl: ctl-virtual
-  image_vcp: ironic_provision_image
-  image_ubuntu_cloud_xenial: cfg01-day01
-  #keypair: system-ci-keypair
-  keypair: baremetal
-
-  net_public: public
-
-  # ironic-specific parameters
-  management_physical_network: ironicnet1
-  management_subnet_cidr: 10.13.0.0/24
-  management_subnet_pool_start: 10.13.0.20
-  management_subnet_pool_end: 10.13.0.60
-  management_subnet_gateway_ip: 10.13.0.1
-  management_subnet_cfg01_ip: 10.13.0.15
-
-  cfg01_configdrive_image: cfg01.cookied-cicd-queens-dvr-sl-config-drive.iso
-  dns_nameservers: 172.18.208.44
-...
diff --git a/tcp_tests/templates/_heat_environments/microcloud-8133.env b/tcp_tests/templates/_heat_environments/microcloud-8133.env
new file mode 100644
index 0000000..6e1cb3b
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/microcloud-8133.env
@@ -0,0 +1,40 @@
+
+resource_registry:
+  "MCP::MultipleInstance": fragments/MultipleInstance.yaml
+  "MCP::Flavors": fragments/Flavors.yaml
+  "MCP::MasterNode": fragments/MasterNode.yaml
+  "MCP::Compute": fragments/Compute.yaml
+  "MCP::Networks": fragments/Networks.yaml
+  "MCP::SingleInstance": fragments/Instance.yaml
+  "MCP::FoundationNode": fragments/FoundationNode.yaml
+
+parameter_defaults:
+
+  cfg_flavor: system.virtual.salt_master
+  ctl_flavor: system.golden.openstack.control
+  cid_flavor: system.golden.cicd.control
+  ntw_flavor: system.compact.opencontrail.control
+  nal_flavor: system.compact.opencontrail.analytics
+  dbs_flavor: system.golden.openstack.database
+  msg_flavor: system.golden.openstack.message_queue
+  mon_flavor: system.golden.stacklight.server
+  log_flavor: system.golden.stacklight.log
+  mtr_flavor: system.golden.stacklight.telemetry
+  cmp_flavor: system.virtual.openstack.compute
+  kvm_fake_flavor: system.virtual.fake_kvm
+  foundation_flavor: system.virtual.foundation
+
+  key_pair: system_key_8133
+
+  net_public: public
+
+  nameservers: 172.18.208.44
+  control_subnet_cidr: "10.6.0.0/24"
+  tenant_subnet_cidr: "10.8.0.0/24"
+  external_subnet_cidr: "10.9.0.0/24"
+  management_subnet_cidr: "10.7.0.0/24"
+  management_subnet_cfg01_ip: 10.7.0.15
+  management_subnet_gateway_ip: 10.7.0.1
+  management_subnet_pool_start: 10.7.0.20
+  management_subnet_pool_end: 10.7.0.60
+  salt_master_control_ip: 10.6.0.15