Return floating IP  for VM deployments only

PROD-35843

Change-Id: I414ac4fc3748811e6b96d3c947059fca33a65246
diff --git a/tcp_tests/templates/_heat_environments/eu-cloud.env b/tcp_tests/templates/_heat_environments/eu-cloud.env
index 5fc6ace..6303e88 100644
--- a/tcp_tests/templates/_heat_environments/eu-cloud.env
+++ b/tcp_tests/templates/_heat_environments/eu-cloud.env
@@ -9,8 +9,10 @@
   "MCP::SingleInstance": fragments/Instance.yaml
   "MCP::SingleInstance2Volumes": fragments/Instance2Volumes.yaml
   "MCP::FoundationNode": fragments/FoundationNode.yaml
+  "MCP::FoundationNodeWithFloating": fragments/FoundationNodeWithFloating.yaml
   "MCP::VsrxNode": fragments/VsrxNode.yaml
   "MCP::Subnets": fragments/Subnets.yaml
+  "MCP::SubnetsWithFloating": fragments/SubnetsWithFloating.yaml
 
 parameter_defaults:
 
diff --git a/tcp_tests/templates/_heat_environments/fragments/FoundationNodeWithFloating.yaml b/tcp_tests/templates/_heat_environments/fragments/FoundationNodeWithFloating.yaml
new file mode 100644
index 0000000..9eed5e4
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/FoundationNodeWithFloating.yaml
@@ -0,0 +1,150 @@
+heat_template_version: queens
+
+description: Single server instance fragment
+
+parameters:
+  instance_flavor:
+    type: string
+  instance_image:
+    type: string
+  instance_name:
+    type: string
+  instance_config_host:
+    type: string
+  management_net:
+    type: string
+  control_net:
+    type: string
+  tenant_net:
+    type: string
+  external_net:
+    type: string
+  key_pair:
+    type: string
+  instance_domain:
+    type: string
+  net_public:
+    type: string
+  management_net_static_ip:
+    type: string
+  control_net_static_ip:
+    type: string
+  tenant_net_static_ip:
+    type: string
+  external_net_static_ip:
+    type: string
+  management_subnet_gateway_ip:
+    type: string
+  nameservers:
+    type: string
+  underlay_userdata:
+    type: string
+  env_name:
+    type: string
+  mcp_version:
+    type: string
+  role:
+    type: comma_delimited_list
+    default: [foundation_jenkins_slave]
+  availability_zone:
+    type: string
+
+resources:
+  instance_port01:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { get_param: management_net }
+      fixed_ips:
+        - ip_address: { get_param: management_net_static_ip }
+  instance_port02:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { get_param: control_net }
+      fixed_ips:
+        - ip_address: { get_param: control_net_static_ip }
+  instance_port03:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { get_param: tenant_net }
+      fixed_ips:
+        - ip_address: { get_param: tenant_net_static_ip }
+  instance_port04:
+    type: OS::Neutron::Port
+    properties:
+      port_security_enabled: false
+      network_id: { get_param: external_net }
+      fixed_ips:
+        - ip_address: { get_param: external_net_static_ip }
+
+  instance_instance:
+    type: OS::Nova::Server
+    properties:
+      image_update_policy: REBUILD
+      flavor: { get_param: instance_flavor }
+      image: { get_param: instance_image }
+      key_name: { get_param: key_pair }
+      availability_zone: { get_param: availability_zone }
+      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 }
+            $management_static_ip: { get_param: management_net_static_ip }
+            $control_static_ip: { get_param: control_net_static_ip }
+            $management_gw: { get_param: management_subnet_gateway_ip }
+            $dnsaddress: { get_param: nameservers }
+      metadata:
+        roles: { get_param: role }
+
+  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
+      - { get_param: management_net }
+      - 0
+      - addr
+    description: "Instance's management IP address"
+  instance:
+    value: { get_resource: instance_instance }
+    description: "Instance"
\ No newline at end of file
diff --git a/tcp_tests/templates/_heat_environments/fragments/SubnetsWithFloating.yaml b/tcp_tests/templates/_heat_environments/fragments/SubnetsWithFloating.yaml
new file mode 100644
index 0000000..f57f8c6
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/SubnetsWithFloating.yaml
@@ -0,0 +1,154 @@
+---
+heat_template_version: queens
+
+description: Subnets fragment
+
+parameters:
+  env_name:
+    type: string
+  net_public:
+    type: string
+  stack_name:
+    type: string
+  management_net:
+    type: string
+  control_net:
+    type: string
+  tenant_net:
+    type: string
+  external_net:
+    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_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { list_join: ['-', [ { get_param: control_net }, 'subnet', { get_param: env_name } ]] }
+      network: { get_param: control_net }
+      cidr: { get_param: control_subnet_cidr }
+      #enable_dhcp: { get_param: control_net_dhcp }
+      dns_nameservers: [0.0.0.0]
+      gateway_ip: null
+      tags:
+      - private-pool01
+
+  tenant_subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      name: { list_join: ['-', [ { get_param: tenant_net }, 'subnet', { get_param: env_name } ]] }
+      network: { get_param: tenant_net }
+      cidr: { get_param: tenant_subnet_cidr }
+      #enable_dhcp: { get_param: tenant_net_dhcp }
+      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: ['-', [ { get_param: management_net }, 'subnet', { get_param: env_name } ]] }
+      network: { get_param: 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: ['-', [ { get_param: external_net }, 'subnet', { get_param: env_name } ]] }
+      network: { get_param: external_net }
+      cidr: { get_param: external_subnet_cidr }
+      #enable_dhcp: { get_param: external_net_dhcp }
+      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]
+
+...
\ No newline at end of file
diff --git a/tcp_tests/templates/_heat_environments/us-cloud.env b/tcp_tests/templates/_heat_environments/us-cloud.env
index 87b40ef..bd62961 100644
--- a/tcp_tests/templates/_heat_environments/us-cloud.env
+++ b/tcp_tests/templates/_heat_environments/us-cloud.env
@@ -9,8 +9,10 @@
   "MCP::SingleInstance": fragments/Instance.yaml
   "MCP::SingleInstance2Volumes": fragments/Instance2Volumes.yaml
   "MCP::FoundationNode": fragments/FoundationNode.yaml
+  "MCP::FoundationNodeWithFloating": fragments/FoundationNodeWithFloating.yaml
   "MCP::VsrxNode": fragments/VsrxNode.yaml
   "MCP::Subnets": fragments/Subnets.yaml
+  "MCP::SubnetsWithFloating": fragments/SubnetsWithFloating.yaml
 
 parameter_defaults:
 
diff --git a/tcp_tests/templates/heat-cicd-pike-dvr-sl/underlay.hot b/tcp_tests/templates/heat-cicd-pike-dvr-sl/underlay.hot
index d8359d9..4c5e949 100644
--- a/tcp_tests/templates/heat-cicd-pike-dvr-sl/underlay.hot
+++ b/tcp_tests/templates/heat-cicd-pike-dvr-sl/underlay.hot
@@ -101,7 +101,7 @@
       env_name: { get_param: env_name }
   subnets:
     depends_on: [networks]
-    type: MCP::Subnets
+    type: MCP::SubnetsWithFloating
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
@@ -666,7 +666,7 @@
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
   foundation_node:
-    type: MCP::FoundationNode
+    type: MCP::FoundationNodeWithFloating
     depends_on: [subnets]
     properties:
       env_name: { get_param: env_name }
diff --git a/tcp_tests/templates/heat-cicd-queens-contrail41-sl/underlay.hot b/tcp_tests/templates/heat-cicd-queens-contrail41-sl/underlay.hot
index 95ebe82..e00f801 100644
--- a/tcp_tests/templates/heat-cicd-queens-contrail41-sl/underlay.hot
+++ b/tcp_tests/templates/heat-cicd-queens-contrail41-sl/underlay.hot
@@ -98,7 +98,7 @@
       env_name: { get_param: env_name }
   subnets:
     depends_on: [networks]
-    type: MCP::Subnets
+    type: MCP::SubnetsWithFloating
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
@@ -920,7 +920,7 @@
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
   foundation_node:
-    type: MCP::FoundationNode
+    type: MCP::FoundationNodeWithFloating
     depends_on: [subnets]
     properties:
       env_name: { get_param: env_name }
diff --git a/tcp_tests/templates/heat-cicd-queens-dvr-sl/underlay.hot b/tcp_tests/templates/heat-cicd-queens-dvr-sl/underlay.hot
index 4b8fac8..c3e09fa 100644
--- a/tcp_tests/templates/heat-cicd-queens-dvr-sl/underlay.hot
+++ b/tcp_tests/templates/heat-cicd-queens-dvr-sl/underlay.hot
@@ -101,7 +101,7 @@
       env_name: { get_param: env_name }
   subnets:
     depends_on: [networks]
-    type: MCP::Subnets
+    type: MCP::SubnetsWithFloating
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
@@ -666,7 +666,7 @@
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
   foundation_node:
-    type: MCP::FoundationNode
+    type: MCP::FoundationNodeWithFloating
     depends_on: [subnets]
     properties:
       env_name: { get_param: env_name }
@@ -1100,10 +1100,4 @@
       get_attr:
       - foundation_node
       - instance_floating_address
-  cfg_public_ip:
-    description: CFG node IP address (floating) from external network
-    value:
-      get_attr:
-      - cfg01_node
-      - instance_floating_address
 ...
diff --git a/tcp_tests/templates/released-heat-cicd-pike-contrail41-sl/underlay.hot b/tcp_tests/templates/released-heat-cicd-pike-contrail41-sl/underlay.hot
index b27c8c3..789f6a5 100644
--- a/tcp_tests/templates/released-heat-cicd-pike-contrail41-sl/underlay.hot
+++ b/tcp_tests/templates/released-heat-cicd-pike-contrail41-sl/underlay.hot
@@ -98,7 +98,7 @@
       env_name: { get_param: env_name }
   subnets:
     depends_on: [networks]
-    type: MCP::Subnets
+    type: MCP::SubnetsWithFloating
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
@@ -920,7 +920,7 @@
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
   foundation_node:
-    type: MCP::FoundationNode
+    type: MCP::FoundationNodeWithFloating
     depends_on: [subnets]
     properties:
       env_name: { get_param: env_name }
diff --git a/tcp_tests/templates/released-heat-cicd-pike-dvr-sl/underlay.hot b/tcp_tests/templates/released-heat-cicd-pike-dvr-sl/underlay.hot
index 8302d0a..6d4be47 100644
--- a/tcp_tests/templates/released-heat-cicd-pike-dvr-sl/underlay.hot
+++ b/tcp_tests/templates/released-heat-cicd-pike-dvr-sl/underlay.hot
@@ -101,7 +101,7 @@
       env_name: { get_param: env_name }
   subnets:
     depends_on: [networks]
-    type: MCP::Subnets
+    type: MCP::SubnetsWithFloating
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
@@ -666,7 +666,7 @@
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
   foundation_node:
-    type: MCP::FoundationNode
+    type: MCP::FoundationNodeWithFloating
     depends_on: [subnets]
     properties:
       env_name: { get_param: env_name }
diff --git a/tcp_tests/templates/released-heat-cicd-queens-contrail41-sl/underlay.hot b/tcp_tests/templates/released-heat-cicd-queens-contrail41-sl/underlay.hot
index f1c94d8..e860b6b 100644
--- a/tcp_tests/templates/released-heat-cicd-queens-contrail41-sl/underlay.hot
+++ b/tcp_tests/templates/released-heat-cicd-queens-contrail41-sl/underlay.hot
@@ -98,7 +98,7 @@
       env_name: { get_param: env_name }
   subnets:
     depends_on: [networks]
-    type: MCP::Subnets
+    type: MCP::SubnetsWithFloating
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
@@ -920,7 +920,7 @@
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
   foundation_node:
-    type: MCP::FoundationNode
+    type: MCP::FoundationNodeWithFloating
     depends_on: [subnets]
     properties:
       env_name: { get_param: env_name }
diff --git a/tcp_tests/templates/released-heat-cicd-queens-dvr-sl/underlay.hot b/tcp_tests/templates/released-heat-cicd-queens-dvr-sl/underlay.hot
index c48e0c2..5ecf130 100644
--- a/tcp_tests/templates/released-heat-cicd-queens-dvr-sl/underlay.hot
+++ b/tcp_tests/templates/released-heat-cicd-queens-dvr-sl/underlay.hot
@@ -101,7 +101,7 @@
       env_name: { get_param: env_name }
   subnets:
     depends_on: [networks]
-    type: MCP::Subnets
+    type: MCP::SubnetsWithFloating
     properties:
       stack_name: { get_param: "OS::stack_name" }
       env_name: { get_param: env_name }
@@ -666,7 +666,7 @@
       instance_config_host: { get_attr: [cfg01_node, instance_address] }
 
   foundation_node:
-    type: MCP::FoundationNode
+    type: MCP::FoundationNodeWithFloating
     depends_on: [subnets]
     properties:
       env_name: { get_param: env_name }