Offline deployment improvement

Change-Id: I722033a5ce4999430a1eea831cfd63ad9032e3c8
diff --git a/tcp_tests/templates/physical-mcp-ocata-offline-ovs/salt.yaml b/tcp_tests/templates/physical-mcp-ocata-offline-ovs/salt.yaml
index 19cc801..8faef2b 100644
--- a/tcp_tests/templates/physical-mcp-ocata-offline-ovs/salt.yaml
+++ b/tcp_tests/templates/physical-mcp-ocata-offline-ovs/salt.yaml
@@ -26,7 +26,7 @@
   skip_fail: false
 
 - description: MaaS auth
-  cmd: maas logout mirantis && maas login mirantis http://localhost:5240/MAAS/api/2.0/ 'FTvqwe7ybBp68gPar2:5mcctTAXVL8mns4ef4:zrA9LZwu2tMc8BAZpsPUfwWwTyQnAtDN'
+  cmd: bash -x  /var/lib/maas/.maas_login.sh
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
   skip_fail: false
diff --git a/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay--user-data-cfg01.yaml b/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay--user-data-cfg01.yaml
index b850283..8e4d506 100644
--- a/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay--user-data-cfg01.yaml
+++ b/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay--user-data-cfg01.yaml
@@ -41,16 +41,20 @@
    - ifdown --force ens3; ifconfig ens3 down; ip a flush dev ens3; rm -f /var/run/network/ifstate.ens3
    - ifdown --force ens4; ifconfig ens4 down; ip a flush dev ens4; rm -f /var/run/network/ifstate.ens4
    - ifdown --force ens5; ifconfig ens5 down; ip a flush dev ens5; rm -f /var/run/network/ifstate.ens5
-   - cd /root/config-drive && /bin/bash -xe ./user-data
+   - cp /root/config-drive/user-data /root/config.sh && chmod 664 /root/config.sh
+   - sed -i '/^reboot$/d' /root/config.sh
+   - cd /root && /bin/bash -xe ./config.sh
 
    # Enable root access
    - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
+   - systemctl reload sshd
 
    ########################################################
-   # Node is ready, allow SSH access
+   # Node is ready, allow SSH access and reboot
    - echo "Allow SSH access ..."
    - "sed -i -e '/sshd:ALL/d' /etc/hosts.deny"
    - touch /is_cloud_init_finish
+   - reboot
    ########################################################
 
   write_files:
diff --git a/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay.yaml b/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay.yaml
index a3c7284..0228ee8 100644
--- a/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay.yaml
+++ b/tcp_tests/templates/physical-mcp-ocata-offline-ovs/underlay.yaml
@@ -14,11 +14,13 @@
 {% set HOSTNAME_KVM01 = os_env('HOSTNAME_KVM01', 'kvm01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_KVM02 = os_env('HOSTNAME_KVM02', 'kvm02.' + DOMAIN_NAME) %}
 {% set HOSTNAME_KVM03 = os_env('HOSTNAME_KVM03', 'kvm03.' + DOMAIN_NAME) %}
-{% set HOSTNAME_KVM03 = os_env('HOSTNAME_KVM04', 'kvm04.' + DOMAIN_NAME) %}
-{% set HOSTNAME_KVM03 = os_env('HOSTNAME_KVM05', 'kvm05.' + DOMAIN_NAME) %}
-{% set HOSTNAME_KVM03 = os_env('HOSTNAME_KVM06', 'kvm06.' + DOMAIN_NAME) %}
+{% set HOSTNAME_KVM04 = os_env('HOSTNAME_KVM04', 'kvm04.' + DOMAIN_NAME) %}
+{% set HOSTNAME_KVM05 = os_env('HOSTNAME_KVM05', 'kvm05.' + DOMAIN_NAME) %}
+{% set HOSTNAME_KVM06 = os_env('HOSTNAME_KVM06', 'kvm06.' + DOMAIN_NAME) %}
 {% set HOSTNAME_CMP001 = os_env('HOSTNAME_CMP001', 'cmp001.' + DOMAIN_NAME) %}
 {% set HOSTNAME_CMP002 = os_env('HOSTNAME_CMP002', 'cmp002.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CMP003 = os_env('HOSTNAME_CMP003', 'cmp003.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CMP004 = os_env('HOSTNAME_CMP004', 'cmp004.' + DOMAIN_NAME) %}
 {% set HOSTNAME_GTW01 = os_env('HOSTNAME_GTW01', 'gtw01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_GTW02 = os_env('HOSTNAME_GTW02', 'gtw02.' + DOMAIN_NAME) %}
 {% set HOSTNAME_GTW03 = os_env('HOSTNAME_GTW03', 'gtw03.' + DOMAIN_NAME) %}
@@ -50,8 +52,16 @@
 {% set HOSTNAME_PRX01 = os_env('HOSTNAME_PRX01', 'prx01.' + DOMAIN_NAME) %}
 {% set HOSTNAME_PRX02 = os_env('HOSTNAME_PRX02', 'prx02.' + DOMAIN_NAME) %}
 {% set HOSTNAME_PRX03 = os_env('HOSTNAME_PRX03', 'prx03.' + DOMAIN_NAME) %}
-
-
+{% set HOSTNAME_RGW = os_env('HOSTNAME_RGW', 'rgw.' + DOMAIN_NAME) %}
+{% set HOSTNAME_RGW01 = os_env('HOSTNAME_RGW01', 'rgw01.' + DOMAIN_NAME) %}
+{% set HOSTNAME_RGW02 = os_env('HOSTNAME_RGW02', 'rgw02.' + DOMAIN_NAME) %}
+{% set HOSTNAME_RGW03 = os_env('HOSTNAME_RGW03', 'rgw03.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CMN01 = os_env('HOSTNAME_CMN01', 'cmn01.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CMN02 = os_env('HOSTNAME_CMN02', 'cmn02.' + DOMAIN_NAME) %}
+{% set HOSTNAME_CMN03 = os_env('HOSTNAME_CMN03', 'cmn03.' + DOMAIN_NAME) %}
+{% set HOSTNAME_OSD001 = os_env('HOSTNAME_OSD001', 'osd001.' + DOMAIN_NAME) %}
+{% set HOSTNAME_OSD002 = os_env('HOSTNAME_OSD002', 'osd002.' + DOMAIN_NAME) %}
+{% set HOSTNAME_OSD003 = os_env('HOSTNAME_OSD003', 'osd003.' + DOMAIN_NAME) %}
 
 {% set ETH0_IP_ADDRESS_APT = os_env('ETH0_IP_ADDRESS_ATP', '10.10.0.14') %}
 {% set ETH0_IP_ADDRESS_CFG01 = os_env('ETH0_IP_ADDRESS_CFG01', '10.10.0.15') %}
@@ -78,9 +88,21 @@
 {% set ETH0_IP_ADDRESS_KVM06 = os_env('ETH0_IP_ADDRESS_KVM06', '10.10.0.246') %}
 {% set ETH0_IP_ADDRESS_CMP001 = os_env('ETH0_IP_ADDRESS_CMP001', '10.10.0.101') %}
 {% set ETH0_IP_ADDRESS_CMP002 = os_env('ETH0_IP_ADDRESS_CMP002', '10.10.0.102') %}
+{% set ETH0_IP_ADDRESS_CMP003 = os_env('ETH0_IP_ADDRESS_CMP003', '10.10.0.103') %}
+{% set ETH0_IP_ADDRESS_CMP004 = os_env('ETH0_IP_ADDRESS_CMP004', '10.10.0.104') %}
 {% set ETH0_IP_ADDRESS_GTW01 = os_env('ETH0_IP_ADDRESS_GTW01', '10.10.0.224') %}
 {% set ETH0_IP_ADDRESS_GTW02 = os_env('ETH0_IP_ADDRESS_GTW02', '10.10.0.225') %}
 {% set ETH0_IP_ADDRESS_GTW02 = os_env('ETH0_IP_ADDRESS_GTW02', '10.10.0.226') %}
+{% set ETH0_IP_ADDRESS_RGW = os_env('ETH0_IP_ADDRESS_RGW', '10.10.0.75') %}
+{% set ETH0_IP_ADDRESS_RGW01 = os_env('ETH0_IP_ADDRESS_RGW01', '10.10.0.76') %}
+{% set ETH0_IP_ADDRESS_RGW02 = os_env('ETH0_IP_ADDRESS_RGW02', '10.10.0.77') %}
+{% set ETH0_IP_ADDRESS_RGW03 = os_env('ETH0_IP_ADDRESS_RGW03', '10.10.0.78') %}
+{% set ETH0_IP_ADDRESS_CMN01 = os_env('ETH0_IP_ADDRESS_CMN01', '10.10.0.66') %}
+{% set ETH0_IP_ADDRESS_CMN02 = os_env('ETH0_IP_ADDRESS_CMN02', '10.10.0.67') %}
+{% set ETH0_IP_ADDRESS_CMN03 = os_env('ETH0_IP_ADDRESS_CMN03', '10.10.0.68') %}
+{% set ETH0_IP_ADDRESS_OSD001 = os_env('ETH0_IP_ADDRESS_OSD001', '10.10.0.201') %}
+{% set ETH0_IP_ADDRESS_OSD002 = os_env('ETH0_IP_ADDRESS_OSD002', '10.10.0.202') %}
+{% set ETH0_IP_ADDRESS_OSD003 = os_env('ETH0_IP_ADDRESS_OSD003', '10.10.0.203') %}
 
 
 {% set ETH1_IP_ADDRESS_CFG01 = os_env('ETH1_IP_ADDRESS_CFG01', '10.11.0.15') %}
@@ -110,6 +132,16 @@
 {% set ETH1_IP_ADDRESS_GTW01 = os_env('ETH1_IP_ADDRESS_GTW01', '10.11.0.224') %}
 {% set ETH1_IP_ADDRESS_GTW02 = os_env('ETH1_IP_ADDRESS_GTW02', '10.11.0.225') %}
 {% set ETH1_IP_ADDRESS_GTW02 = os_env('ETH1_IP_ADDRESS_GTW02', '10.11.0.226') %}
+{% set ETH1_IP_ADDRESS_RGW = os_env('ETH1_IP_ADDRESS_RGW', '10.11.0.75') %}
+{% set ETH1_IP_ADDRESS_RGW01 = os_env('ETH1_IP_ADDRESS_RGW01', '10.11.0.76') %}
+{% set ETH1_IP_ADDRESS_RGW02 = os_env('ETH1_IP_ADDRESS_RGW02', '10.11.0.77') %}
+{% set ETH1_IP_ADDRESS_RGW03 = os_env('ETH1_IP_ADDRESS_RGW03', '10.11.0.78') %}
+{% set ETH1_IP_ADDRESS_CMN01 = os_env('ETH1_IP_ADDRESS_CMN01', '10.11.0.66') %}
+{% set ETH1_IP_ADDRESS_CMN02 = os_env('ETH1_IP_ADDRESS_CMN02', '10.11.0.67') %}
+{% set ETH1_IP_ADDRESS_CMN03 = os_env('ETH1_IP_ADDRESS_CMN03', '10.11.0.68') %}
+{% set ETH1_IP_ADDRESS_OSD001 = os_env('ETH1_IP_ADDRESS_OSD001', '10.11.0.201') %}
+{% set ETH1_IP_ADDRESS_OSD002 = os_env('ETH1_IP_ADDRESS_OSD002', '10.11.0.202') %}
+{% set ETH1_IP_ADDRESS_OSD002 = os_env('ETH1_IP_ADDRESS_OSD002', '10.11.0.203') %}
 
 {% set ETH2_IP_ADDRESS_CFG01 = os_env('ETH1_IP_ADDRESS_CFG01', '172.16.44.33') %}
 
@@ -145,12 +177,15 @@
             default_{{ HOSTNAME_KVM06 }}: {{ ETH1_IP_ADDRESS_KVM06 }}
             default_{{ HOSTNAME_CMP001 }}: {{ ETH1_IP_ADDRESS_CMP001 }}
             default_{{ HOSTNAME_CMP002 }}: {{ ETH1_IP_ADDRESS_CMP002 }}
+            default_{{ HOSTNAME_CMP003 }}: {{ ETH1_IP_ADDRESS_CMP003 }}
+            default_{{ HOSTNAME_CMP004 }}: {{ ETH1_IP_ADDRESS_CMP004 }}
             default_{{ HOSTNAME_GTW01 }}: {{ ETH1_IP_ADDRESS_GTW01 }}
             default_{{ HOSTNAME_GTW02 }}: {{ ETH1_IP_ADDRESS_GTW02 }}
+            default_{{ HOSTNAME_GTW03 }}: {{ ETH1_IP_ADDRESS_GTW03 }}
             default_{{ HOSTNAME_CTL }}: {{ ETH1_IP_ADDRESS_CTL }}
-            default_{{ HOSTNAME_CTL01 }}: {{ ETH1_IP_ADDRESS_CTL02 }}
-            default_{{ HOSTNAME_CTL02 }}: {{ ETH1_IP_ADDRESS_CTL03 }}
-            default_{{ HOSTNAME_CTL03 }}: {{ ETH1_IP_ADDRESS_CTL04 }}
+            default_{{ HOSTNAME_CTL01 }}: {{ ETH1_IP_ADDRESS_CTL01 }}
+            default_{{ HOSTNAME_CTL02 }}: {{ ETH1_IP_ADDRESS_CTL02 }}
+            default_{{ HOSTNAME_CTL03 }}: {{ ETH1_IP_ADDRESS_CTL03 }}
             default_{{ HOSTNAME_MSG }}: {{ ETH1_IP_ADDRESS_MSG }}
             default_{{ HOSTNAME_MSG01 }}: {{ ETH1_IP_ADDRESS_MSG02 }}
             default_{{ HOSTNAME_MSG02 }}: {{ ETH1_IP_ADDRESS_MSG03 }}
@@ -160,17 +195,27 @@
             default_{{ HOSTNAME_MON02 }}: {{ ETH1_IP_ADDRESS_MON02 }}
             default_{{ HOSTNAME_MON03 }}: {{ ETH1_IP_ADDRESS_MON03 }}
             default_{{ HOSTNAME_DBS }}: {{ ETH1_IP_ADDRESS_DBS }}
-            default_{{ HOSTNAME_DBS01 }}: {{ ETH1_IP_ADDRESS_DBS02 }}
-            default_{{ HOSTNAME_DBS02 }}: {{ ETH1_IP_ADDRESS_DBS03 }}
-            default_{{ HOSTNAME_DBS03 }}: {{ ETH1_IP_ADDRESS_DBS04 }}
+            default_{{ HOSTNAME_DBS01 }}: {{ ETH1_IP_ADDRESS_DBS01 }}
+            default_{{ HOSTNAME_DBS02 }}: {{ ETH1_IP_ADDRESS_DBS02 }}
+            default_{{ HOSTNAME_DBS03 }}: {{ ETH1_IP_ADDRESS_DBS03 }}
             default_{{ HOSTNAME_LOG }}: {{ ETH1_IP_ADDRESS_LOG }}
-            default_{{ HOSTNAME_LOG01 }}: {{ ETH1_IP_ADDRESS_LOG02 }}
-            default_{{ HOSTNAME_LOG02 }}: {{ ETH1_IP_ADDRESS_LOG03 }}
-            default_{{ HOSTNAME_LOG03 }}: {{ ETH1_IP_ADDRESS_LOG04 }}
+            default_{{ HOSTNAME_LOG01 }}: {{ ETH1_IP_ADDRESS_LOG01 }}
+            default_{{ HOSTNAME_LOG02 }}: {{ ETH1_IP_ADDRESS_LOG02 }}
+            default_{{ HOSTNAME_LOG03 }}: {{ ETH1_IP_ADDRESS_LOG03 }}
             default_{{ HOSTNAME_MTR }}: {{ ETH1_IP_ADDRESS_MTR }}
-            default_{{ HOSTNAME_MTR01 }}: {{ ETH1_IP_ADDRESS_MTR02 }}
-            default_{{ HOSTNAME_MTR02 }}: {{ ETH1_IP_ADDRESS_MTR03 }}
-            default_{{ HOSTNAME_MTR03 }}: {{ ETH1_IP_ADDRESS_MTR04 }}
+            default_{{ HOSTNAME_MTR01 }}: {{ ETH1_IP_ADDRESS_MTR01 }}
+            default_{{ HOSTNAME_MTR02 }}: {{ ETH1_IP_ADDRESS_MTR02 }}
+            default_{{ HOSTNAME_MTR03 }}: {{ ETH1_IP_ADDRESS_MTR03 }}
+            default_{{ HOSTNAME_RGW }}: {{ ETH1_IP_ADDRESS_RGW }}
+            default_{{ HOSTNAME_RGW01 }}: {{ ETH1_IP_ADDRESS_RGW01 }}
+            default_{{ HOSTNAME_RGW02 }}: {{ ETH1_IP_ADDRESS_RGW02 }}
+            default_{{ HOSTNAME_RGW03 }}: {{ ETH1_IP_ADDRESS_RGW03 }}
+            default_{{ HOSTNAME_CMN01 }}: {{ ETH1_IP_ADDRESS_CMN01 }}
+            default_{{ HOSTNAME_CMN02 }}: {{ ETH1_IP_ADDRESS_CMN02 }}
+            default_{{ HOSTNAME_CMN03 }}: {{ ETH1_IP_ADDRESS_CMN03 }}
+            default_{{ HOSTNAME_OSD001 }}: {{ ETH1_IP_ADDRESS_OSD001 }}
+            default_{{ HOSTNAME_OSD002 }}: {{ ETH1_IP_ADDRESS_OSD002 }}
+            default_{{ HOSTNAME_OSD003 }}: {{ ETH1_IP_ADDRESS_OSD003 }}
 
       admin-pool01:
         net: {{ os_env('DEPLOY_ADDRESS_POOL01', '10.10.0.0/16:16') }}
@@ -214,7 +259,16 @@
             default_{{ HOSTNAME_MTR01 }}: {{ ETH0_IP_ADDRESS_MTR02 }}
             default_{{ HOSTNAME_MTR02 }}: {{ ETH0_IP_ADDRESS_MTR03 }}
             default_{{ HOSTNAME_MTR03 }}: {{ ETH0_IP_ADDRESS_MTR04 }}
-
+            default_{{ HOSTNAME_RGW }}: {{ ETH0_IP_ADDRESS_RGW }}
+            default_{{ HOSTNAME_RGW01 }}: {{ ETH0_IP_ADDRESS_RGW01 }}
+            default_{{ HOSTNAME_RGW02 }}: {{ ETH0_IP_ADDRESS_RGW02 }}
+            default_{{ HOSTNAME_RGW03 }}: {{ ETH0_IP_ADDRESS_RGW03 }}
+            default_{{ HOSTNAME_CMN01 }}: {{ ETH0_IP_ADDRESS_CMN01 }}
+            default_{{ HOSTNAME_CMN02 }}: {{ ETH0_IP_ADDRESS_CMN02 }}
+            default_{{ HOSTNAME_CMN03 }}: {{ ETH0_IP_ADDRESS_CMN03 }}
+            default_{{ HOSTNAME_OSD001 }}: {{ ETH0_IP_ADDRESS_OSD001 }}
+            default_{{ HOSTNAME_OSD002 }}: {{ ETH0_IP_ADDRESS_OSD002 }}
+            default_{{ HOSTNAME_OSD003 }}: {{ ETH0_IP_ADDRESS_OSD003 }}
 
       public-pool01:
         net: {{ os_env('PUBLIC_ADDRESS_POOL01', '172.16.44.0/22:22') }}