Update TryMCP deployment scripts

* drop global network params, which can be delivired with ISO;
* show OpenStack UI endpoints with creds;
* set error level for scripts;

Change-Id: I86617a03c8027e8b46a43c4093ec781d1359cc32
Related-Prod: PROD-30834
diff --git a/predefine-vm/README.rst b/predefine-vm/README.rst
index 03aef1f..2438818 100644
--- a/predefine-vm/README.rst
+++ b/predefine-vm/README.rst
@@ -29,12 +29,6 @@
       Optional, default: false
     * VM_MGM_NETWORK_NAME - Name for deploy management network. Optional, default: 'mgm_network'
     * VM_CTL_NETWORK_NAME - Name for control network. Optional, default: 'ctl_network'
-    * VM_MGM_NETWORK_GATEWAY - NAT-Service network gateway for deploy management network.
-      Optional, default: '192.168.15.1'
-    * VM_MGM_NETWORK_MASK - Network mask for deploy management network. Optional, default: '255.255.255.0'
-    * VM_CTL_NETWORK_GATEWAY - Host-only based network gateway for control network.
-      Optional, default: '192.168.56.1'
-    * VM_CTL_NETWORK_MASK - Network mask for control network. Optional, default: '255.255.255.0'
 
 Script will check that disk and config-drive are present and then define needed networks and spawn virtual machine.
 Start VM with ``virsh start <VM_NAME>``. Then check that VM is up and running.
@@ -75,10 +69,6 @@
     * VM_CTL_BRIDGE_DISABLE
     * VM_MGM_NETWORK_NAME
     * VM_CTL_NETWORK_NAME
-    * VM_MGM_NETWORK_GATEWAY
-    * VM_MGM_NETWORK_MASK
-    * VM_CTL_NETWORK_GATEWAY
-    * VM_CTL_NETWORK_MASK
 
 Also once you setup cfg01 setup the next parameter: export CREATE_NEWORKS=false
 This parameter will disable network recreation, which can be needed in case of changing network setup.
diff --git a/predefine-vm/define-slave-vm.sh b/predefine-vm/define-slave-vm.sh
index 246bf6d..1f4e8c8 100755
--- a/predefine-vm/define-slave-vm.sh
+++ b/predefine-vm/define-slave-vm.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -e
+
 functionsFile="$(pwd)/functions.sh"
 
 if [[ ! -f ${functionsFile} ]]; then
@@ -116,3 +118,11 @@
 
 virsh define $(pwd)/${SLAVE_VM_NAME}-vm.xml
 virsh autostart ${SLAVE_VM_NAME}
+
+openstackAIOFile=$(isoinfo -i ${VM_CONFIG_DISK} -J -f | grep -w "setup_aio.yml")
+openstackScheme=$(isoinfo -i ${VM_CONFIG_DISK} -J -x ${openstackAIOFile} | grep -w 'cluster_public_protocol' | cut -f 2 -d ':' | tr -d ' ')
+openstackAddress=$(isoinfo -i ${VM_CONFIG_DISK} -J -x ${allocationDataFile} | grep -w 'aio_node_address' | cut -f 2 -d ':' | tr -d ' ')
+secretsFile=$(isoinfo -i ${VM_CONFIG_DISK} -J -f | grep -w "infra/secrets.yml")
+openstackPassword=$(isoinfo -i ${VM_CONFIG_DISK} -J -x ${secretsFile} | grep -w 'keystone_admin_password_generated' | cut -f 2 -d ':' | tr -d ' ')
+echo "Once OpenStack deploy job is finished successfully OpenStack UI will be available on: ${openstackScheme}://${openstackAddress}:8078"
+echo "Login creds are: admin / ${openstackPassword}"
diff --git a/predefine-vm/define-vm.sh b/predefine-vm/define-vm.sh
index 5435607..b7c5198 100755
--- a/predefine-vm/define-vm.sh
+++ b/predefine-vm/define-vm.sh
@@ -1,4 +1,6 @@
-#!/bin/bash -xe
+#!/bin/bash
+
+set -e
 
 functionsFile="$(pwd)/functions.sh"
 
diff --git a/predefine-vm/env_vars.sh b/predefine-vm/env_vars.sh
index 8b744ab..ff29cbf 100644
--- a/predefine-vm/env_vars.sh
+++ b/predefine-vm/env_vars.sh
@@ -7,11 +7,6 @@
 export RECREATE_NETWORKS_IF_EXISTS=${RECREATE_NETWORKS_IF_EXISTS:-false}
 export VM_MEM_KB=${VM_MEM_KB:-"12589056"}
 export VM_CPUS=${VM_CPUS:-"4"}
-# optional params if you won't use bridge on host
-export VM_MGM_NETWORK_GATEWAY=${VM_MGM_NETWORK_GATEWAY:-"192.168.56.1"}
-export VM_MGM_NETWORK_MASK=${VM_MGM_NETWORK_MASK:-"255.255.255.0"}
-export VM_CTL_NETWORK_GATEWAY=${VM_CTL_NETWORK_GATEWAY:-"192.168.57.1"}
-export VM_CTL_NETWORK_MASK=${VM_CTL_NETWORK_MASK:-"255.255.255.0"}
 # optional params if you want enable slave vm
 export SLAVE_VM_MEM_KB=${SLAVE_VM_MEM_KB:-"16777216"}
 export SLAVE_VM_CPUS=${SLAVE_VM_CPUS:-"4"}
diff --git a/predefine-vm/functions.sh b/predefine-vm/functions.sh
index ec51f6d..ed2ad0f 100644
--- a/predefine-vm/functions.sh
+++ b/predefine-vm/functions.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -e
+
 envFile="$(pwd)/env_vars.sh"
 if [[ ! -f ${envFile} ]]; then
   echo "ERROR: Can not find 'env_vars' libfile (${envFile}), check your mcp/mcp-common-scripts repo."
@@ -162,6 +164,7 @@
 EOF
   fi
 
+  local allocationDataFile=$(isoinfo -i ${VM_CONFIG_DISK} -J -f | grep -w "allocation_data.yml")
   if [[ "${VM_MGM_BRIDGE_DISABLE}" =~ [Ff]alse ]]; then
       create_bridge_network "${VM_MGM_NETWORK_NAME}" "${VM_MGM_BRIDGE_NAME}"
       cat <<EOF >> $(pwd)/${vmName}-vm.xml
@@ -172,7 +175,9 @@
     </interface>
 EOF
   else
-      create_host_network "${VM_MGM_NETWORK_NAME}" "${VM_MGM_NETWORK_GATEWAY}" "${VM_MGM_NETWORK_MASK}" true
+      local vmMgmNetworkGateway=$(isoinfo -i ${VM_CONFIG_DISK} -J -x ${allocationDataFile} | grep -w 'deploy_network_gateway' | cut -f 2 -d ':' | tr -d ' ')
+      local vmMgmNetworkMask=$(isoinfo -i ${VM_CONFIG_DISK} -J -x ${allocationDataFile} | grep -w 'deploy_network_netmask' | cut -f 2 -d ':' | tr -d ' ')
+      create_host_network "${VM_MGM_NETWORK_NAME}" "${vmMgmNetworkGateway}" "${vmMgmNetworkMask}" true
       cat <<EOF >> $(pwd)/${vmName}-vm.xml
     <interface type='network'>
       <source network='$VM_MGM_NETWORK_NAME'/>
@@ -192,7 +197,9 @@
     </interface>
 EOF
   else
-      create_host_network "${VM_CTL_NETWORK_NAME}" "${VM_CTL_NETWORK_GATEWAY}" "${VM_CTL_NETWORK_MASK}"
+      local vmCtlNetworkGateway=$(isoinfo -i ${VM_CONFIG_DISK} -J -x ${allocationDataFile} | grep -w 'infra_config_address' | cut -f 2 -d ':' | tr -d ' ' | sed -r "s/\.[[:digit:]]+$/\.1/g")
+      local vmCtlNetworkMask=$(isoinfo -i ${VM_CONFIG_DISK} -J -x ${allocationDataFile} | grep -w 'control_network_netmask' | cut -f 2 -d ':' | tr -d ' ')
+      create_host_network "${VM_CTL_NETWORK_NAME}" "${vmCtlNetworkGateway}" "${vmCtlNetworkMask}"
       cat <<EOF >> $(pwd)/${vmName}-vm.xml
     <interface type='network'>
       <source network='$VM_CTL_NETWORK_NAME'/>