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_environments/ReadMe.md b/tcp_tests/templates/_heat_environments/ReadMe.md
index 09f568a..b7250b3 100644
--- a/tcp_tests/templates/_heat_environments/ReadMe.md
+++ b/tcp_tests/templates/_heat_environments/ReadMe.md
@@ -104,13 +104,29 @@
 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:
+The template 'outputs' should contain the 'foundation_public_ip' key,
+in case of virtual deploy it will be floating IP, but in case of BM deploy
+we should use management address. Management address will came from
+instance_address attribute of foundation node, according to output of
+FoundationNode.yaml fragment.
+For example:
+For virtual deploys:
 ```
 outputs:
-  foundation_floating:
+  foundation_public_ip:
     description: foundation node IP address (floating) from external network
     value:
       get_attr:
       - foundation_node
       - instance_floating_address
 ```
+For Baremetal deploys
+```
+outputs:
+  foundation_public_ip:
+    description: foundation node IP address from management network
+    value:
+      get_attr:
+      - foundation_node
+      - instance_address # Here we will get management IP
+```
diff --git a/tcp_tests/templates/_heat_environments/bm-eu-cloud.env b/tcp_tests/templates/_heat_environments/bm-eu-cloud.env
new file mode 100644
index 0000000..149a7af
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/bm-eu-cloud.env
@@ -0,0 +1,51 @@
+
+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
+  "MCP::VsrxNode": fragments/VsrxNode.yaml
+  "MCP::Subnets": fragments/Subnets.yaml
+
+parameter_defaults:
+
+  cfg_flavor: system.virtual.salt_master
+  ctl_flavor: system.compact.openstack.control
+  cid_flavor: system.compact.cicd.control
+  ntw_flavor: system.compact.opencontrail.control
+  nal_flavor: system.compact.opencontrail.analytics
+  dbs_flavor: system.compact.openstack.database
+  msg_flavor: system.compact.openstack.message_queue
+  mon_flavor: system.compact.stacklight.server
+  log_flavor: system.compact.stacklight.log
+  mtr_flavor: system.compact.stacklight.telemetry
+  cmp_flavor: system.virtual.openstack.compute
+  cmn_flavor: system.compact.ceph.mon
+  rgw_flavor: system.compact.ceph.rgw
+  osd_flavor: system.virtual.ceph.osd
+  dns_flavor: system.compact.openstack.dns
+  kmn_flavor: system.compact.openstack.barbican
+  prx_flavor: system.compact.openstack.proxy
+  gtw_flavor: system.compact.openstack.gateway
+  kvm_fake_flavor: system.virtual.fake_kvm
+  mdb_flavor: system.compact.openstack.telemetry
+  foundation_flavor: system.virtual.foundation
+  vsrx_flavor: oc_vsrx
+  key_pair: system_key_8133
+  bm_availability_zone: BM
+  net_public: public
+
+  foundation_image: system.foundation
+  nameservers: 172.18.208.44
+  control_subnet_cidr: "10.6.0.0/24"
+  tenant_subnet_cidr: "10.8.0.0/24"
+  external_subnet_cidr: "192.168.200.0/24"
+  management_subnet_cidr: "172.16.49.64/26"
+  management_subnet_cfg01_ip: 172.16.49.66
+  management_subnet_gateway_ip: 172.16.49.65
+  management_subnet_pool_start: 172.16.49.68
+  management_subnet_pool_end: 172.16.49.124
+  salt_master_control_ip: 10.6.0.15
diff --git a/tcp_tests/templates/_heat_environments/eu-cloud.env b/tcp_tests/templates/_heat_environments/eu-cloud.env
index 7f670c5..b2f1396 100644
--- a/tcp_tests/templates/_heat_environments/eu-cloud.env
+++ b/tcp_tests/templates/_heat_environments/eu-cloud.env
@@ -8,6 +8,7 @@
   "MCP::SingleInstance": fragments/Instance.yaml
   "MCP::FoundationNode": fragments/FoundationNode.yaml
   "MCP::VsrxNode": fragments/VsrxNode.yaml
+  "MCP::Subnets": fragments/Subnets.yaml
 
 parameter_defaults:
 
@@ -25,7 +26,7 @@
   cmp_flavor: system.virtual.openstack.compute
   cmn_flavor: system.compact.ceph.mon
   rgw_flavor: system.compact.ceph.rgw
-  osd_flavor: system.virtual.openstack.compute
+  osd_flavor: system.virtual.ceph.osd
   dns_flavor: system.compact.openstack.dns
   kmn_flavor: system.compact.openstack.barbican
   prx_flavor: system.compact.openstack.proxy
@@ -35,7 +36,7 @@
   vsrx_flavor: oc_vsrx
 
   key_pair: system_key_8133
-
+  bm_availability_zone: BM
   net_public: public
 
   foundation_image: system.foundation
diff --git a/tcp_tests/templates/_heat_environments/fragments/Compute.yaml b/tcp_tests/templates/_heat_environments/fragments/Compute.yaml
index 40ff833..39ff118 100644
--- a/tcp_tests/templates/_heat_environments/fragments/Compute.yaml
+++ b/tcp_tests/templates/_heat_environments/fragments/Compute.yaml
@@ -3,8 +3,6 @@
 description: Single server instance fragment
 
 parameters:
-  network:
-    type: string
   instance_flavor:
     type: string
   instance_name:
diff --git a/tcp_tests/templates/_heat_environments/fragments/FoundationNode.yaml b/tcp_tests/templates/_heat_environments/fragments/FoundationNode.yaml
index 5b2c2d4..533edc0 100644
--- a/tcp_tests/templates/_heat_environments/fragments/FoundationNode.yaml
+++ b/tcp_tests/templates/_heat_environments/fragments/FoundationNode.yaml
@@ -3,8 +3,6 @@
 description: Single server instance fragment
 
 parameters:
-  network:
-    type: string
   instance_flavor:
     type: string
   instance_image:
@@ -13,18 +11,32 @@
     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:
@@ -34,32 +46,40 @@
   role:
     type: comma_delimited_list
     default: [foundation_jenkins_slave]
+  bm_availability_zone:
+    type: string
 
 resources:
   instance_port01:
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      network_id: { get_param: management_net }
+      #network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      fixed_ips:
+        - ip_address: { get_param: management_net_static_ip }
   instance_port02:
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      network_id: { get_param: control_net }
+      #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 } ]] }
+      network_id: { get_param: tenant_net }
+      #network_id: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
       fixed_ips:
         - ip_address: { get_param: tenant_net_static_ip }
   instance_port04:
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
+      network_id: { get_param: external_net }
+      #network_id: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
       fixed_ips:
         - ip_address: { get_param: external_net_static_ip }
 
@@ -70,6 +90,7 @@
       flavor: { get_param: instance_flavor }
       image: { get_param: instance_image }
       key_name: { get_param: key_pair }
+      availability_zone: { get_param: bm_availability_zone }
       name:
         list_join:
         - '.'
@@ -90,6 +111,10 @@
             $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 }
 
@@ -120,10 +145,10 @@
       get_attr:
       - instance_instance
       - addresses
-      - 'management_net'
+      - { get_param: management_net }
       - 0
       - addr
-    description: "Instance's private IP address"
+    description: "Instance's management 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
index 5ead2ed..9ffe121 100644
--- a/tcp_tests/templates/_heat_environments/fragments/Instance.yaml
+++ b/tcp_tests/templates/_heat_environments/fragments/Instance.yaml
@@ -3,8 +3,6 @@
 description: Single server instance fragment
 
 parameters:
-  network:
-    type: string
   instance_flavor:
     type: string
   instance_name:
diff --git a/tcp_tests/templates/_heat_environments/fragments/MasterNode.yaml b/tcp_tests/templates/_heat_environments/fragments/MasterNode.yaml
index 0d85600..24123b3 100644
--- a/tcp_tests/templates/_heat_environments/fragments/MasterNode.yaml
+++ b/tcp_tests/templates/_heat_environments/fragments/MasterNode.yaml
@@ -11,7 +11,13 @@
     type: string
   external_net_static_ip:
     type: string
-  network:
+  management_net:
+    type: string
+  control_net:
+    type: string
+  tenant_net:
+    type: string
+  external_net:
     type: string
   cfg01_flavor:
     type: string
@@ -30,13 +36,16 @@
   role:
     type: comma_delimited_list
     default: [salt_master]
+  bm_availability_zone:
+    type: string
 
 resources:
   instance_port01:
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      network_id: { get_param: management_net }
+      #network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
       fixed_ips:
         - ip_address: { get_param: management_subnet_cfg01_ip }
 
@@ -44,7 +53,8 @@
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      network_id: { get_param: control_net }
+      #network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
       fixed_ips:
         - ip_address: { get_param: salt_master_control_ip }
 
@@ -52,7 +62,8 @@
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+      network_id: { get_param: tenant_net }
+      #network_id: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
       fixed_ips:
         - ip_address: { get_param: tenant_net_static_ip }
 
@@ -60,7 +71,8 @@
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
+      network_id: { get_param: external_net }
+      #network_id: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
       fixed_ips:
         - ip_address: { get_param: external_net_static_ip }
 
@@ -71,6 +83,7 @@
       flavor: { get_param: cfg01_flavor }
       image: { list_join: ['', [ 'cfg01-day01-', { get_param: mcp_version } ]] }
       key_name: { get_param: key_pair }
+      availability_zone: { get_param: bm_availability_zone }
       name:
         list_join:
         - '.'
@@ -109,7 +122,7 @@
       get_attr:
       - instance_instance
       - addresses
-      - 'management_net'
+      - { get_param: management_net }
       - 0
       - addr
     description: "Instance's private IP address"
diff --git a/tcp_tests/templates/_heat_environments/fragments/MultipleInstance.yaml b/tcp_tests/templates/_heat_environments/fragments/MultipleInstance.yaml
index b7282d8..bf14ee0 100644
--- a/tcp_tests/templates/_heat_environments/fragments/MultipleInstance.yaml
+++ b/tcp_tests/templates/_heat_environments/fragments/MultipleInstance.yaml
@@ -5,8 +5,6 @@
 parameters:
   key_pair:
     type: string
-  network:
-    type: string
   instance01_name:
     type: string
   instance02_name:
@@ -60,7 +58,6 @@
       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 }
       tenant_net_static_ip: {get_param: instance01_tenant_net_static_ip }
       external_net_static_ip: {get_param: instance01_external_net_static_ip }
@@ -77,7 +74,6 @@
       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 }
       tenant_net_static_ip: {get_param: instance02_tenant_net_static_ip }
       external_net_static_ip: {get_param: instance02_external_net_static_ip }
@@ -94,7 +90,6 @@
       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 }
       tenant_net_static_ip: {get_param: instance03_tenant_net_static_ip }
       external_net_static_ip: {get_param: instance03_external_net_static_ip }
diff --git a/tcp_tests/templates/_heat_environments/fragments/Networks.yaml b/tcp_tests/templates/_heat_environments/fragments/Networks.yaml
index 076684b..46bb048 100644
--- a/tcp_tests/templates/_heat_environments/fragments/Networks.yaml
+++ b/tcp_tests/templates/_heat_environments/fragments/Networks.yaml
@@ -62,112 +62,8 @@
       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/fragments/Subnets.yaml b/tcp_tests/templates/_heat_environments/fragments/Subnets.yaml
new file mode 100644
index 0000000..330d379
--- /dev/null
+++ b/tcp_tests/templates/_heat_environments/fragments/Subnets.yaml
@@ -0,0 +1,161 @@
+---
+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 } ]] }
+      #name: control_subnet
+      network: { get_param: 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: ['-', [ { get_param: tenant_net }, 'subnet', { get_param: env_name } ]] }
+      #name: tenant_subnet
+      network: { get_param: 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: ['-', [ { get_param: management_net }, 'subnet', { get_param: env_name } ]] }
+      #name: management_subnet
+      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 } ]] }
+      #name: external_subnet
+      network: { get_param: 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/fragments/VsrxNode.yaml b/tcp_tests/templates/_heat_environments/fragments/VsrxNode.yaml
index b3b32ef..e0e3a84 100644
--- a/tcp_tests/templates/_heat_environments/fragments/VsrxNode.yaml
+++ b/tcp_tests/templates/_heat_environments/fragments/VsrxNode.yaml
@@ -3,14 +3,20 @@
 description: Single server instance fragment
 
 parameters:
-  network:
-    type: string
   instance_flavor:
     type: string
   instance_image:
     type: string
   instance_name:
     type: string
+  management_net:
+    type: string
+  control_net:
+    type: string
+  tenant_net:
+    type: string
+  external_net:
+    type: string
   instance_config_host:
     type: string
   key_pair:
@@ -37,28 +43,28 @@
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'control_net', { get_param: env_name } ]] }
+      network_id: { get_param: control_net }
       fixed_ips:
         - ip_address: { get_param: control_net_static_ip }
   instance_port02:
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'tenant_net', { get_param: env_name } ]] }
+      network_id: { get_param: tenant_net }
       fixed_ips:
         - ip_address: { get_param: tenant_net_static_ip }
   instance_port03:
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'external_net', { get_param: env_name } ]] }
+      network_id: { get_param: external_net }
       fixed_ips:
         - ip_address: { get_param: external_net_static_ip }
   instance_port04:
     type: OS::Neutron::Port
     properties:
       port_security_enabled: false
-      network_id: { list_join: ['-', [ 'management_net', { get_param: env_name } ]] }
+      network_id: { get_param: management_net }
 
   instance_instance:
     type: OS::Nova::Server