Baremetal deployment on top on Ironic

Heat templates have been refactored to deploy both VM
cases and baremetal nodes cases on top of Ironic.

Related-PROD: PRODX-2342
Change-Id: I6439ec670c69d67b65eb1806040a64f800dc6628
diff --git a/de/heat-templates/top.yaml b/de/heat-templates/top.yaml
index 4595008..66f5680 100644
--- a/de/heat-templates/top.yaml
+++ b/de/heat-templates/top.yaml
@@ -1,16 +1,18 @@
 heat_template_version: queens
 
 parameters:
-  key_name:
-    type: string
-    description: Name of keypair to assign to servers
   image:
     type: string
     description: Name of image to use for servers
   public_net_id:
     type: string
+    default: ''
     description: >
-      ID of public network for which floating IP addresses will be allocated
+      ID of public network for which floating IP addresses will be allocated/
+      for baremetal case flat provision network for nodes
+  host_interface:
+    type: string
+    description: Interface which connects server with public network (world accessible network).
   masters_size:
     type: number
     description: Number of masters instances to deploy
@@ -44,6 +46,18 @@
   private_floating_network_cidr:
     type: string
     default: '10.11.12.0/24'
+  private_floating_network_pool_start:
+    type: string
+    default: '10.11.12.100'
+  private_floating_network_pool_end:
+    type: string
+    default: '10.11.12.200'
+  private_floating_network_gateway:
+    type: string
+    default: '10.11.12.11'
+  private_floating_interface:
+    description: Interface which carries floating network for child OpenStack.
+    type: string
   worker_metadata:
     type: json
     default: {}
@@ -80,6 +94,8 @@
   osds_flavor:
     type: string
     default: 'system.compact.openstack.control'
+  functions_override:
+    type: string
 
 resources:
   key_pair:
@@ -89,178 +105,187 @@
       public_key: { get_param: cluster_public_key}
       save_private_key: false
 
-  network:
-    type: OS::Neutron::Net
-  subnet:
-    type: OS::Neutron::Subnet
+  accessible_network:
+    type: MCP2::NetworkAcc
     properties:
-      network: { get_resource: network }
-      cidr: 10.10.0.0/24
-      dns_nameservers:
-        - 172.18.224.6
-        - 172.18.176.6
-  router:
-    type: OS::Neutron::Router
-    properties:
-      external_gateway_info:
-        network: { get_param: public_net_id }
-  router_iface:
-    type: OS::Neutron::RouterInterface
-    properties:
-      router: { get_resource: router }
-      subnet: { get_resource: subnet }
+      public_net_id: { get_param: public_net_id }
 
   private_floating_network:
-    type: OS::Neutron::Net
+    type: MCP2::NetworkPrvFl
     properties:
-      port_security_enabled: false
-  private_floating_subnet:
-    type: OS::Neutron::Subnet
-    properties:
-      network: { get_resource: private_floating_network }
-      cidr: { get_param: private_floating_network_cidr }
-      enable_dhcp: false
-      gateway_ip: ~
+      private_floating_network_cidr: { get_param: private_floating_network_cidr }
 
   ucp:
-    depends_on: router_iface
-    type: ./srv-group.yaml
+    depends_on: accessible_network
+    type: MCP2::SrvInstances
     properties:
-      image: { get_param: image }
-      flavor: { get_param: ucp_flavor }
-      key_name: { get_param: "OS::stack_name" }
-      public_net_id: { get_param: public_net_id }
-      private_net_id: { get_resource: network }
-      private_subnet_id: { get_resource: subnet }
-      private_floating_network: { get_resource: private_floating_network }
       metadata: {"role":"ucp"}
       node_type: "ucp"
+      key_name: { get_param: "OS::stack_name" }
+      image: { get_param: image }
+      flavor: { get_param: ucp_flavor }
+      accessible_network: { get_attr: [accessible_network, public_network] }
+      private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
+      private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
+      private_floating_interface: { get_param: private_floating_interface }
+      private_floating_network_cidr: { get_param: private_floating_network_cidr }
+      accessible_subnet_id: { get_attr: [accessible_network, accessible_subnet_id]}
+      public_net_id: { get_param: public_net_id }
+      host_interface: { get_param: host_interface }
+      functions_override: { get_param: functions_override }
+
 
   masters:
     type: OS::Heat::ResourceGroup
     depends_on:
      - ucp
-     - router_iface
     properties:
       count: { get_param: masters_size }
       resource_def:
-        type: ./srv-group.yaml
+        type: MCP2::SrvInstances
         properties:
-          image: { get_param: image }
-          flavor: { get_param: masters_flavor }
-          key_name: { get_param: "OS::stack_name" }
-          public_net_id: { get_param: public_net_id }
-          private_net_id: { get_resource: network }
-          private_subnet_id: { get_resource: subnet }
-          private_floating_network: { get_resource: private_floating_network }
           metadata: {"role":"master"}
           node_type: "master"
+          key_name: { get_param: "OS::stack_name" }
+          image: { get_param: image }
+          flavor: { get_param: masters_flavor }
+          accessible_network: { get_attr: [accessible_network, public_network] }
+          private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
+          private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
+          private_floating_interface: { get_param: private_floating_interface }
+          private_floating_network_cidr: { get_param: private_floating_network_cidr }
+          accessible_subnet_id: { get_attr: [accessible_network, accessible_subnet_id]}
+          public_net_id: { get_param: public_net_id }
+          host_interface: { get_param: host_interface }
           ucp_master_host: { get_attr: [ucp, server_private_ip] }
+          functions_override: { get_param: functions_override }
+
 
   workers:
     type: OS::Heat::ResourceGroup
     depends_on:
      - ucp
-     - router_iface
     properties:
       count: { get_param: worker_size }
       resource_def:
-        type: ./srv-group.yaml
+        type: MCP2::SrvInstances
         properties:
+          metadata: { get_param: worker_metadata}
+          node_type: "worker"
+          key_name: { get_param: "OS::stack_name" }
           image: { get_param: image }
           flavor: { get_param: workers_flavor }
           key_name: { get_param: "OS::stack_name" }
+          accessible_network: { get_attr: [accessible_network, public_network] }
+          private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
+          private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
+          private_floating_interface: { get_param: private_floating_interface }
+          private_floating_network_cidr: { get_param: private_floating_network_cidr }
+          accessible_subnet_id: { get_attr: [accessible_network, accessible_subnet_id]}
           public_net_id: { get_param: public_net_id }
-          private_net_id: { get_resource: network }
-          private_subnet_id: { get_resource: subnet }
-          private_floating_network: { get_resource: private_floating_network }
-          metadata: { get_param: worker_metadata}
-          node_type: "worker"
+          host_interface: { get_param: host_interface }
           ucp_master_host: { get_attr: [ucp, server_private_ip] }
+          functions_override: { get_param: functions_override }
 
   cmps:
     type: OS::Heat::ResourceGroup
     depends_on:
      - ucp
-     - router_iface
     properties:
       count: { get_param: cmp_size }
       resource_def:
-        type: ./srv-group.yaml
+        type: MCP2::SrvInstances
         properties:
+          metadata: { get_param: cmp_metadata }
+          node_type: "worker"
+          key_name: { get_param: "OS::stack_name" }
           image: { get_param: image }
           flavor: { get_param: cmps_flavor }
-          key_name: { get_param: "OS::stack_name" }
+          accessible_network: { get_attr: [accessible_network, public_network] }
+          private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
+          private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
+          private_floating_interface: { get_param: private_floating_interface }
+          private_floating_network_cidr: { get_param: private_floating_network_cidr }
+          accessible_subnet_id: { get_attr: [accessible_network, accessible_subnet_id]}
           public_net_id: { get_param: public_net_id }
-          private_net_id: { get_resource: network }
-          private_subnet_id: { get_resource: subnet }
-          private_floating_network: { get_resource: private_floating_network }
-          metadata: { get_param: cmp_metadata}
-          node_type: "worker"
+          host_interface: { get_param: host_interface }
           ucp_master_host: { get_attr: [ucp, server_private_ip] }
+          functions_override: { get_param: functions_override }
 
   gtws:
     type: OS::Heat::ResourceGroup
     depends_on:
      - ucp
-     - router_iface
     properties:
       count: { get_param: gtw_size }
       resource_def:
-        type: ./srv-group.yaml
+        type: MCP2::SrvInstances
         properties:
+          metadata: { get_param: gtw_metadata }
+          node_type: "worker"
+          key_name: { get_param: "OS::stack_name" }
           image: { get_param: image }
           flavor: { get_param: gtws_flavor }
-          key_name: { get_param: "OS::stack_name" }
+          accessible_network: { get_attr: [accessible_network, public_network] }
+          private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
+          private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
+          private_floating_interface: { get_param: private_floating_interface }
+          private_floating_network_cidr: { get_param: private_floating_network_cidr }
+          accessible_subnet_id: { get_attr: [accessible_network, accessible_subnet_id]}
           public_net_id: { get_param: public_net_id }
-          private_net_id: { get_resource: network }
-          private_subnet_id: { get_resource: subnet }
-          private_floating_network: { get_resource: private_floating_network }
-          metadata: { get_param: gtw_metadata}
-          node_type: "worker"
+          host_interface: { get_param: host_interface }
           ucp_master_host: { get_attr: [ucp, server_private_ip] }
+          functions_override: { get_param: functions_override }
 
   lmas:
     type: OS::Heat::ResourceGroup
     depends_on:
      - ucp
-     - router_iface
     properties:
       count: { get_param: lma_size }
       resource_def:
-        type: ./srv-group.yaml
+        type: MCP2::SrvInstances
         properties:
+          metadata: { get_param: lma_metadata }
+          node_type: "worker"
+          key_name: { get_param: "OS::stack_name" }
           image: { get_param: image }
           flavor: { get_param: lmas_flavor }
-          key_name: { get_param: "OS::stack_name" }
+          accessible_network: { get_attr: [accessible_network, public_network] }
+          private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
+          private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
+          private_floating_interface: { get_param: private_floating_interface }
+          private_floating_network_cidr: { get_param: private_floating_network_cidr }
+          accessible_subnet_id: { get_attr: [accessible_network, accessible_subnet_id]}
           public_net_id: { get_param: public_net_id }
-          private_net_id: { get_resource: network }
-          private_subnet_id: { get_resource: subnet }
-          private_floating_network: { get_resource: private_floating_network }
-          metadata: { get_param: lma_metadata}
-          node_type: "worker"
+          host_interface: { get_param: host_interface }
           ucp_master_host: { get_attr: [ucp, server_private_ip] }
+          functions_override: { get_param: functions_override }
 
   osds:
     type: OS::Heat::ResourceGroup
     depends_on:
      - ucp
-     - router_iface
     properties:
       count: { get_param: osd_size }
       resource_def:
-        type: ./srv-group.yaml
+        type: MCP2::SrvInstances
         properties:
+          metadata: { get_param: osd_metadata }
+          node_type: "worker"
+          key_name: { get_param: "OS::stack_name" }
           image: { get_param: image }
           flavor: { get_param: osds_flavor }
-          key_name: { get_param: "OS::stack_name" }
+          accessible_network: { get_attr: [accessible_network, public_network] }
+          private_floating_network: { get_attr: [private_floating_network, private_floating_network_id] }
+          private_floating_subnet_id: { get_attr: [private_floating_network, private_floating_subnet_id] }
+          private_floating_interface: { get_param: private_floating_interface }
+          private_floating_network_cidr: { get_param: private_floating_network_cidr }
+          accessible_subnet_id: { get_attr: [accessible_network, accessible_subnet_id]}
           public_net_id: { get_param: public_net_id }
-          private_net_id: { get_resource: network }
-          private_subnet_id: { get_resource: subnet }
-          private_floating_network: { get_resource: private_floating_network }
-          metadata: { get_param: osd_metadata}
-          node_type: "worker"
+          host_interface: { get_param: host_interface }
           ucp_master_host: { get_attr: [ucp, server_private_ip] }
+          functions_override: { get_param: functions_override }
 
 outputs:
   ucp_ips:
@@ -289,3 +314,10 @@
     value: { get_attr: [workers, server_private_floating_ip] }
   private_floating_cidr:
     value: { get_param: private_floating_network_cidr }
+  private_floating_network_pool_start:
+    value: { get_param: private_floating_network_pool_start }
+  private_floating_network_pool_end:
+    value: { get_param: private_floating_network_pool_end }
+  private_floating_network_gateway:
+    value: { get_param: private_floating_network_gateway }
+