Merge "Revert "Disable DHCP on the networks""
diff --git a/de/heat-templates/env/migration-mstr1-wrkr5-cmp2-ntw3.yaml b/de/heat-templates/env/migration-mstr1-wrkr5-cmp2-ntw3.yaml
index a4fc520..d55232c 100644
--- a/de/heat-templates/env/migration-mstr1-wrkr5-cmp2-ntw3.yaml
+++ b/de/heat-templates/env/migration-mstr1-wrkr5-cmp2-ntw3.yaml
@@ -32,6 +32,8 @@
   ironic_baremetal_network_pool_start: '10.14.0.100'
   ironic_baremetal_network_pool_end: '10.14.0.200'
   control_network_cidr: '10.9.10.0/24'
+  control_network_vsrx_peering_ip: '10.9.10.131'
+  data_network_vsrx_ip: '10.15.0.131'
   private_floating_interface: 'ens4'
   tunnel_interface: 'ens8'
   worker_metadata: {"labels": {"openstack-control-plane":"enabled","local-volume-provisioner": "enabled"}}
@@ -40,7 +42,7 @@
   # hardware_metadata which is used for Ceph requires flavor with
   # ephemeral storage because it is used for Ceph bluestore.
   workers_flavor: 'system.compact.openstack.control.ephemeral'
-  cmps_flavor: 'system.compact.openstack.compute.ephemeral'
+  cmps_flavor: 'system.compact.openstack.control.ephemeral'
   storage_frontend_network_cidr: '10.12.1.0/24'
   storage_backend_network_cidr: '10.12.0.0/24'
   hardware_metadata: |
diff --git a/de/heat-templates/scripts/instance_boot.sh b/de/heat-templates/scripts/instance_boot.sh
index 68a4a62..e160b24 100644
--- a/de/heat-templates/scripts/instance_boot.sh
+++ b/de/heat-templates/scripts/instance_boot.sh
@@ -521,6 +521,13 @@
     systemctl restart ntp
 }
 
+function wait_for_external_network {
+    function _check_access {
+        curl --connect-timeout 10 ${DOCKER_UCP_IMAGE%%/*} || (sleep 1; /bin/false)
+    }
+    retry 180 "Failed to wait for external networks reachable." _check_access
+}
+
 function prepare_network {
     if [ -z "${CONTROL_IP_ADDRESS}" ]; then
         wait_condition_send "FAILURE" "CONTROL_IP_ADDRESS is not found."
@@ -994,6 +1001,7 @@
         # Please keep the "prepare_metadata_files", "disable-rp-filter", "network_config" and "prepare_network" functions
         # at the very beginning in the same order.
         ucp)
+            wait_for_external_network
             prepare_metadata_files
             disable_rp_filter
             network_config
@@ -1033,6 +1041,7 @@
             cron_disable_calico_offloading
             ;;
         master)
+            wait_for_external_network
             nested_virt_config
             prepare_metadata_files
             disable_rp_filter
@@ -1063,6 +1072,7 @@
             cron_disable_calico_offloading
             ;;
         worker)
+            wait_for_external_network
             if [[ "${CONFIGURE_HUGE_PAGES}" == true ]]; then
                 configure_huge_pages
             fi
@@ -1102,6 +1112,7 @@
             cron_disable_calico_offloading
             ;;
         spare)
+            wait_for_external_network
             prepare_metadata_files
             disable_rp_filter
             network_config
@@ -1125,6 +1136,7 @@
             cron_disable_calico_offloading
             ;;
         frr)
+            wait_for_external_network
             prepare_metadata_files
             disable_rp_filter
             network_config