Reorder ifup interfaces and modifying /etc/resolv.conf

With day01 image, /etc/resolv.conf gets wrong IPs for nameservers
if modified before ifdown/ifup ens3

Change-Id: Ib30887735ad5d4e48da1ab9bb34fba39d0ceec03
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml
index 7faeee0..fc3d284 100644
--- a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml
@@ -27,6 +27,13 @@
     all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
 
   runcmd:
+   # Prepare network connection
+   - sudo ifup ens3
+   #- sudo route add default gw {gateway} {interface_name}
+   - sudo ifup ens4
+   - sudo ifup ens5
+   - sudo ifup ens6
+
    - rm /etc/resolv.conf
    - touch /etc/resolv.conf
    - export LOCAL_DNS_IP=$(ifconfig ens3 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1)
@@ -37,12 +44,6 @@
    - export TERM=linux
    - export LANG=C
 
-   # Prepare network connection
-   - sudo ifup ens3
-   #- sudo route add default gw {gateway} {interface_name}
-   - sudo ifup ens4
-   - sudo ifup ens5
-   - sudo ifup ens6
 
    # Create swap
    - fallocate -l 4G /swapfile
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-cfg01.yaml b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-cfg01.yaml
index 6f03dca..2aad6bc 100644
--- a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-cfg01.yaml
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-cfg01.yaml
@@ -27,6 +27,12 @@
     all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
 
   runcmd:
+   # Prepare network connection
+   - sudo ifdown ens3
+   - sudo ip r d default || true  # remove existing default route to get it from dhcp
+   - sudo ifup ens3
+   #- sudo route add default gw {gateway} {interface_name}
+
    - rm /etc/resolv.conf
    - touch /etc/resolv.conf
    - LOCAL_IP=$(ifconfig ens3 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1 | cut -d"." -f1-3)
@@ -34,11 +40,6 @@
    - echo "nameserver $DNS_IP" >> /etc/resolv.conf;
    - echo "nameserver $LOCAL_IP.1" >> /etc/resolv.conf;
    - echo "supersede domain-name-servers $DNS_IP" >> /etc/dhcp/dhclient.conf
-   # Prepare network connection
-   - sudo ifdown ens3
-   - sudo ip r d default || true  # remove existing default route to get it from dhcp
-   - sudo ifup ens3
-   #- sudo route add default gw {gateway} {interface_name}
 
    # Create swap
    - fallocate -l 4G /swapfile
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data1604.yaml b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data1604.yaml
index ab572ef..5a02d24 100644
--- a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data1604.yaml
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data1604.yaml
@@ -27,6 +27,10 @@
     all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
 
   runcmd:
+   # Prepare network connection
+   - sudo ifup ens3
+   #- sudo route add default gw {gateway} {interface_name}
+
    - rm /etc/resolv.conf
    - touch /etc/resolv.conf
    - LOCAL_IP=$(ifconfig ens3 | grep "inet addr" | cut -d ':' -f 2 | cut -d ' ' -f 1 | cut -d"." -f1-3)
@@ -34,9 +38,6 @@
    - echo "nameserver $DNS_IP" >> /etc/resolv.conf;
    - echo "nameserver $LOCAL_IP.1" >> /etc/resolv.conf;
    - echo "supersede domain-name-servers $DNS_IP" >> /etc/dhcp/dhclient.conf
-   # Prepare network connection
-   - sudo ifup ens3
-   #- sudo route add default gw {gateway} {interface_name}
 
    # Create swap
    - fallocate -l 4G /swapfile