#!/bin/bash
+##############################################################################
+# Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
# Deploy script to install provisioning server for OPNFV Apex
# author: Dan Radez (dradez@redhat.com)
fi
vm_index=4
-ha_enabled="TRUE"
+#ha_enabled="TRUE"
+interactive="FALSE"
ping_site="8.8.8.8"
ntp_server="pool.ntp.org"
net_isolation_enabled="TRUE"
+post_config="TRUE"
+debug="FALSE"
declare -i CNT
declare UNDERCLOUD
DEPLOY_OPTIONS=""
RESOURCES=/var/opt/opnfv/stack
CONFIG=/var/opt/opnfv
-INSTACKENV=$CONFIG/instackenv.json
OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network"
# Netmap used to map networks to OVS bridge names
NET_MAP['admin_network']="brbm"
NET_MAP['public_network']="brbm2"
NET_MAP['storage_network']="brbm3"
-##LIBRARIES
-source $CONFIG/lib/common-functions.sh
-
##FUNCTIONS
##translates yaml into variables
##params: filename, prefix (ex. "config_")
for setting in ${common_optional_network_settings}; do
eval "setting_value=\${${enabled_network}_${setting}}"
if [ -z "${setting_value}" ]; then
- setting_value=$(eval find_${setting} ${nic_value})
+ if [ -n "$nic_value" ]; then
+ setting_value=$(eval find_${setting} ${nic_value})
+ else
+ setting_value=''
+ echo -e "${blue}INFO: Skipping Auto-detection, NIC not specified for ${enabled_network}. Attempting Auto-generation...${reset}"
+ fi
if [ -n "$setting_value" ]; then
eval "${enabled_network}_${setting}=${setting_value}"
echo -e "${blue}INFO: Auto-detection: ${enabled_network}_${setting}: ${setting_value}${reset}"
else
# if Auto-detection fails we can auto-generate with CIDR
eval "cidr=\${${enabled_network}_cidr}"
- setting_value=$(eval generate_${setting} ${cidr})
+ if [ -n "$cidr" ]; then
+ echo -e "${blue}INFO: Auto-generating: ${setting}${reset}"
+ setting_value=$(eval generate_${setting} ${cidr})
+ else
+ setting_value=''
+ echo -e "${red}ERROR: Auto-generation failed: required parameter CIDR missing for network ${enabled_network}${reset}"
+ fi
if [ -n "$setting_value" ]; then
eval "${enabled_network}_${setting}=${setting_value}"
echo -e "${blue}INFO: Auto-generated: ${enabled_network}_${setting}: ${setting_value}${reset}"
for setting in ${network_specific_settings}; do
eval "setting_value=\${${enabled_network}_${setting}}"
if [ -z "${setting_value}" ]; then
- setting_value=$(eval find_${setting} ${nic_value})
+ if [ -n "$nic_value" ]; then
+ setting_value=$(eval find_${setting} ${nic_value})
+ else
+ setting_value=''
+ echo -e "${blue}INFO: Skipping Auto-detection, NIC not specified for ${enabled_network}. Attempting Auto-generation...${reset}"
+ fi
if [ -n "$setting_value" ]; then
eval "${enabled_network}_${setting}=${setting_value}"
echo -e "${blue}INFO: Auto-detection: ${enabled_network}_${setting}: ${setting_value}${reset}"
else
eval "cidr=\${${enabled_network}_cidr}"
- setting_value=$(eval generate_${setting} ${cidr})
+ if [ -n "$cidr" ]; then
+ setting_value=$(eval generate_${setting} ${cidr})
+ else
+ setting_value=''
+ echo -e "${red}ERROR: Auto-generation failed: required parameter CIDR missing for network ${enabled_network}${reset}"
+ fi
if [ -n "$setting_value" ]; then
eval "${enabled_network}_${setting}=${setting_value}"
echo -e "${blue}INFO: Auto-generated: ${enabled_network}_${setting}: ${setting_value}${reset}"
for entry in $inventory; do
if echo $entry | grep -Eo "^nodes_node[0-9]+_" > /dev/null; then
this_node=$(echo $entry | grep -Eo "^nodes_node[0-9]+_")
- if [[ $inventory_list != *"$this_node"* ]]; then
+ if [[ "$inventory_list" != *"$this_node"* ]]; then
inventory_list+="$this_node "
fi
fi
node_total=$node_count
- if [[ "$node_total" -lt 5 && ha_enabled == "TRUE" ]]; then
+ if [[ "$node_total" -lt 5 && ( ha_enabled == "TRUE" || "$ha_enabled" == "true" ) ]]; then
echo -e "${red}ERROR: You must provide at least 5 nodes for HA baremetal deployment${reset}"
exit 1
elif [[ "$node_total" -lt 2 ]]; then
elif [ "$virtual" == "FALSE" ]; then
virsh_enabled_networks="admin_network public_network"
else
- virsh_enabled_neworks=$enabled_network_list
+ virsh_enabled_networks=$enabled_network_list
fi
for network in ${OPNFV_NETWORK_TYPES}; do
if [[ -z "$virtual" || "$virtual" == "FALSE" ]]; then
# bridge interfaces to correct OVS instances for baremetal deployment
for network in ${enabled_network_list}; do
+ if [[ "$network" != "admin_network" && "$network" != "public_network" ]]; then
+ continue
+ fi
this_interface=$(eval echo \${${network}_bridged_interface})
# check if this a bridged interface for this network
- if [[ -n "$this_interface" || "$this_interface" != "none" ]]; then
- ovs-vsctl list-ports ${NET_MAP[$network]} | grep ${this_interface} || ovs-vsctl add-port ${NET_MAP[$network]} ${this_interface}
+ if [[ ! -z "$this_interface" || "$this_interface" != "none" ]]; then
+ if ! attach_interface_to_ovs ${NET_MAP[$network]} ${this_interface} ${network}; then
+ echo -e "${red}ERROR: Unable to bridge interface ${this_interface} to bridge ${NET_MAP[$network]} for enabled network: ${network}${reset}"
+ exit 1
+ else
+ echo -e "${blue}INFO: Interface ${this_interface} bridged to bridge ${NET_MAP[$network]} for enabled network: ${network}${reset}"
+ fi
else
echo "${red}ERROR: Unable to determine interface to bridge to for enabled network: ${network}${reset}"
exit 1
# if the VM is not running update the authkeys and start it
if ! virsh list | grep instack > /dev/null; then
echo "Injecting ssh key to instack VM"
- virt-customize -c qemu:///system -d instack --run-command "mkdir /root/.ssh/" \
+ virt-customize -c qemu:///system -d instack --run-command "mkdir -p /root/.ssh/" \
--upload ~/.ssh/id_rsa.pub:/root/.ssh/authorized_keys \
--run-command "chmod 600 /root/.ssh/authorized_keys && restorecon /root/.ssh/authorized_keys" \
--run-command "cp /root/.ssh/authorized_keys /home/stack/.ssh/" \
##Set network-environment settings
##params: network-environment file to edit
function configure_network_environment {
+ local tht_dir nic_ext
+ tht_dir=/usr/share/openstack-tripleo-heat-templates/network
+ nic_ext=''
+
sed -i '/ControlPlaneSubnetCidr/c\\ ControlPlaneSubnetCidr: "'${admin_network_cidr##*/}'"' $1
sed -i '/ControlPlaneDefaultRoute/c\\ ControlPlaneDefaultRoute: '${admin_network_provisioner_ip}'' $1
sed -i '/ExternalNetCidr/c\\ ExternalNetCidr: '${public_network_cidr}'' $1
sed -i "/ExternalAllocationPools/c\\ ExternalAllocationPools: [{'start': '${public_network_usable_ip_range%%,*}', 'end': '${public_network_usable_ip_range##*,}'}]" $1
sed -i '/ExternalInterfaceDefaultRoute/c\\ ExternalInterfaceDefaultRoute: '${public_network_gateway}'' $1
+ sed -i '/EC2MetadataIp/c\\ EC2MetadataIp: '${admin_network_provisioner_ip}'' $1
+
+ # check for private network
+ if [[ ! -z "$private_network_enabled" && "$private_network_enabled" == "true" ]]; then
+ sed -i 's#^.*Network::Tenant.*$# OS::TripleO::Network::Tenant: '${tht_dir}'/tenant.yaml#' $1
+ sed -i 's#^.*Controller::Ports::TenantPort:.*$# OS::TripleO::Controller::Ports::TenantPort: '${tht_dir}'/ports/tenant.yaml#' $1
+ sed -i 's#^.*Compute::Ports::TenantPort:.*$# OS::TripleO::Compute::Ports::TenantPort: '${tht_dir}'/ports/tenant.yaml#' $1
+ sed -i "/TenantAllocationPools/c\\ TenantAllocationPools: [{'start': '${private_network_usable_ip_range%%,*}', 'end': '${private_network_usable_ip_range##*,}'}]" $1
+ sed -i '/TenantNetCidr/c\\ TenantNetCidr: '${private_network_cidr}'' $1
+ nic_ext+=_private
+ else
+ sed -i 's#^.*Network::Tenant.*$# OS::TripleO::Network::Tenant: '${tht_dir}'/noop.yaml#' $1
+ sed -i 's#^.*Controller::Ports::TenantPort:.*$# OS::TripleO::Controller::Ports::TenantPort: '${tht_dir}'/ports/noop.yaml#' $1
+ sed -i 's#^.*Compute::Ports::TenantPort:.*$# OS::TripleO::Compute::Ports::TenantPort: '${tht_dir}'/ports/noop.yaml#' $1
+ fi
+
+ # check for storage network
+ if [[ ! -z "$storage_network_enabled" && "$storage_network_enabled" == "true" ]]; then
+ sed -i 's#^.*Network::Storage.*$# OS::TripleO::Network::Storage: '${tht_dir}'/storage.yaml#' $1
+ sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1
+ sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/storage.yaml#' $1
+ sed -i "/StorageAllocationPools/c\\ StorageAllocationPools: [{'start': '${storage_network_usable_ip_range%%,*}', 'end': '${storage_network_usable_ip_range##*,}'}]" $1
+ sed -i '/StorageNetCidr/c\\ StorageNetCidr: '${storage_network_cidr}'' $1
+ nic_ext+=_storage
+ else
+ sed -i 's#^.*Network::Storage.*$# OS::TripleO::Network::Storage: '${tht_dir}'/noop.yaml#' $1
+ sed -i 's#^.*Controller::Ports::StoragePort:.*$# OS::TripleO::Controller::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1
+ sed -i 's#^.*Compute::Ports::StoragePort:.*$# OS::TripleO::Compute::Ports::StoragePort: '${tht_dir}'/ports/noop.yaml#' $1
+ fi
+
+ sed -i 's#^.*Controller::Net::SoftwareConfig:.*$# OS::TripleO::Controller::Net::SoftwareConfig: nics/controller'${nic_ext}'.yaml#' $1
+
+ # check for ODL L3
+ if [ "${deploy_options_array['sdn_l3']}" == 'true' ]; then
+ nic_ext+=_br-ex
+ fi
+
+ if [ "${deploy_options_array['sdn_controller']}" == 'onos' ]; then
+ nic_ext+=_no-public-ip
+ fi
+
+ # set nics appropriately
+ sed -i 's#^.*Compute::Net::SoftwareConfig:.*$# OS::TripleO::Compute::Net::SoftwareConfig: nics/compute'${nic_ext}'.yaml#' $1
+
}
##Copy over the glance images and instack json file
##params: none
function configure_undercloud {
echo
- echo "Copying configuration file and disk images to instack"
- scp ${SSH_OPTIONS[@]} $RESOURCES/overcloud-full.qcow2 "stack@$UNDERCLOUD":
+ echo "Copying configuration files to instack"
if [[ "$net_isolation_enabled" == "TRUE" ]]; then
configure_network_environment $CONFIG/network-environment.yaml
echo -e "${blue}Network Environment set for Deployment: ${reset}"
openstack-config --set undercloud.conf DEFAULT dhcp_end ${admin_network_dhcp_range##*,}
openstack-config --set undercloud.conf DEFAULT inspection_iprange ${admin_network_introspection_range}
openstack-config --set undercloud.conf DEFAULT undercloud_debug false
+
fi
+sudo sed -i '/CephClusterFSID:/c\\ CephClusterFSID: \\x27$(cat /proc/sys/kernel/random/uuid)\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
+sudo sed -i '/CephMonKey:/c\\ CephMonKey: \\x27'"\$(ceph-authtool --gen-print-key)"'\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
+sudo sed -i '/CephAdminKey:/c\\ CephAdminKey: \\x27'"\$(ceph-authtool --gen-print-key)"'\\x27' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml
+
openstack undercloud install &> apex-undercloud-install.log
sleep 30
sudo systemctl restart openstack-glance-api
# as well as glance api problem
echo -e "${blue}INFO: Sleeping 15 seconds while services come back from restart${reset}"
sleep 15
-#TODO Fill in the rest of the network-environment values for other networks
}
##preping it for deployment and launch the deploy
##params: none
function undercloud_prep_overcloud_deploy {
-
- if [[ ${#deploy_options_array[@]} -eq 0 || ${deploy_options_array['sdn_controller']} == 'opendaylight' ]]; then
- DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight.yaml"
- elif [ ${deploy_options_array['sdn_controller']} == 'opendaylight-external' ]; then
+ if [[ "${#deploy_options_array[@]}" -eq 0 || "${deploy_options_array['sdn_controller']}" == 'opendaylight' ]]; then
+ if [ "${deploy_options_array['sdn_l3']}" == 'true' ]; then
+ DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_l3.yaml"
+ elif [ "${deploy_options_array['sfc']}" == 'true' ]; then
+ DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sfc.yaml"
+ else
+ DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight.yaml"
+ fi
+ SDN_IMAGE=opendaylight
+ if [ "${deploy_options_array['sfc']}" == 'true' ]; then
+ SDN_IMAGE+=-sfc
+ fi
+ elif [ "${deploy_options_array['sdn_controller']}" == 'opendaylight-external' ]; then
DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight-external.yaml"
- elif [ ${deploy_options_array['sdn_controller']} == 'onos' ]; then
- echo -e "${red}ERROR: ONOS is currently unsupported...exiting${reset}"
- exit 1
- elif [ ${deploy_options_array['sdn_controller']} == 'opencontrail' ]; then
+ SDN_IMAGE=opendaylight
+ elif [ "${deploy_options_array['sdn_controller']}" == 'onos' ]; then
+ DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/onos.yaml"
+ SDN_IMAGE=opendaylight
+ elif [ "${deploy_options_array['sdn_controller']}" == 'opencontrail' ]; then
echo -e "${red}ERROR: OpenContrail is currently unsupported...exiting${reset}"
exit 1
+ elif [[ -z "${deploy_options_array['sdn_controller']}" || "${deploy_options_array['sdn_controller']}" == 'false' ]]; then
+ echo -e "${blue}INFO: SDN Controller disabled...will deploy nosdn scenario${reset}"
+ SDN_IMAGE=opendaylight
+ else
+ echo "${red}Invalid sdn_controller: ${deploy_options_array['sdn_controller']}${reset}"
+ echo "${red}Valid choices are opendaylight, opendaylight-external, onos, opencontrail, false, or null${reset}"
+ exit 1
fi
+ echo "Copying overcloud image to instack"
+ scp ${SSH_OPTIONS[@]} $RESOURCES/overcloud-full-${SDN_IMAGE}.qcow2 "stack@$UNDERCLOUD":overcloud-full.qcow2
+
+ # make sure ceph is installed
+ DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml"
+
+ # scale compute nodes according to inventory
+ total_nodes=$(ssh -T ${SSH_OPTIONS[@]} "root@$UNDERCLOUD" "cat /home/stack/instackenv.json | grep -c memory")
+
# check if HA is enabled
- if [[ "$ha_enabled" == "TRUE" ]]; then
- DEPLOY_OPTIONS+=" --control-scale 3 --compute-scale 2"
+ if [[ "$ha_enabled" == "TRUE" || "$ha_enabled" == "true" ]]; then
+ DEPLOY_OPTIONS+=" --control-scale 3"
+ compute_nodes=$((total_nodes - 3))
DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml"
+ else
+ compute_nodes=$((total_nodes - 1))
+ fi
+
+ if [ "$compute_nodes" -le 0 ]; then
+ echo -e "${red}ERROR: Invalid number of compute nodes: ${compute_nodes}. Check your inventory file.${reset}"
+ exit 1
+ else
+ echo -e "${blue}INFO: Number of compute nodes set for deployment: ${compute_nodes}${reset}"
+ DEPLOY_OPTIONS+=" --compute-scale ${compute_nodes}"
fi
if [[ "$net_isolation_enabled" == "TRUE" ]]; then
DEPLOY_OPTIONS+=" -e network-environment.yaml"
fi
- if [[ "$ha_enabled" == "TRUE" ]] || [[ "$net_isolation_enabled" == "TRUE" ]]; then
+ if [[ "$ha_enabled" == "TRUE" || "$ha_enabled" == "true" ]] || [[ "$net_isolation_enabled" == "TRUE" ]]; then
DEPLOY_OPTIONS+=" --ntp-server $ntp_server"
fi
DEPLOY_OPTIONS+=" --control-flavor control --compute-flavor compute"
fi
+ echo -e "${blue}INFO: Deploy options set:\n${DEPLOY_OPTIONS}${reset}"
+
ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
source stackrc
set -o errexit
echo "Configuring undercloud and discovering nodes"
openstack baremetal import --json instackenv.json
openstack baremetal configure boot
-openstack baremetal introspection bulk start
+#if [[ -z "$virtual" ]]; then
+# openstack baremetal introspection bulk start
+#fi
echo "Configuring flavors"
for flavor in baremetal control compute; do
echo -e "${blue}INFO: Updating flavor: \${flavor}${reset}"
neutron subnet-update \$(neutron subnet-list | grep -v id | grep -v \\\\-\\\\- | awk {'print \$2'}) --dns-nameserver 8.8.8.8
echo "Executing overcloud deployment, this should run for an extended period without output."
sleep 60 #wait for Hypervisor stats to check-in to nova
-openstack overcloud deploy --templates $DEPLOY_OPTIONS
+# save deploy command so it can be used for debugging
+cat > deploy_command << EOF
+openstack overcloud deploy --templates $DEPLOY_OPTIONS --timeout 90
+EOF
EOI
+ if [ "$interactive" == "TRUE" ]; then
+ if ! prompt_user "Overcloud Deployment"; then
+ echo -e "${blue}INFO: User requests exit${reset}"
+ exit 0
+ fi
+ fi
+
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+source stackrc
+set -o errexit
+openstack overcloud deploy --templates $DEPLOY_OPTIONS --timeout 90
+EOI
+
+ if [ "$debug" == 'TRUE' ]; then
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+source overcloudrc
+echo "Keystone Endpoint List:"
+keystone endpoint-list
+echo "Keystone Service List"
+keystone service-list
+cinder quota-show \$(openstack project list | grep admin | awk {'print \$2'})
+EOI
+ fi
+}
+
+##Post configuration after install
+##params: none
+function configure_post_install {
+ local opnfv_attach_networks ovs_ip ip_range net_cidr tmp_ip
+ opnfv_attach_networks="admin_network public_network"
+
+ echo -e "${blue}INFO: Post Install Configuration Running...${reset}"
+
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+source overcloudrc
+set -o errexit
+echo "Configuring Neutron external network"
+neutron net-create external --router:external=True
+neutron subnet-create --name external-net --disable-dhcp external --gateway ${public_network_gateway} --allocation-pool start=${public_network_floating_ip_range%%,*},end=${public_network_floating_ip_range##*,} ${public_network_cidr}
+EOI
+
+ echo -e "${blue}INFO: Checking if OVS bridges have IP addresses...${reset}"
+ for network in ${opnfv_attach_networks}; do
+ ovs_ip=$(find_ip ${NET_MAP[$network]})
+ tmp_ip=''
+ if [ -n "$ovs_ip" ]; then
+ echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} has IP address ${ovs_ip}${reset}"
+ else
+ echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} missing IP, will configure${reset}"
+ # use last IP of allocation pool
+ eval "ip_range=\${${network}_usable_ip_range}"
+ ovs_ip=${ip_range##*,}
+ eval "net_cidr=\${${network}_cidr}"
+ sudo ip addr add ${ovs_ip}/${net_cidr##*/} dev ${NET_MAP[$network]}
+ sudo ip link set up ${NET_MAP[$network]}
+ tmp_ip=$(find_ip ${NET_MAP[$network]})
+ if [ -n "$tmp_ip" ]; then
+ echo -e "${blue}INFO: OVS Bridge ${NET_MAP[$network]} IP set: ${tmp_ip}${reset}"
+ continue
+ else
+ echo -e "${red}ERROR: Unable to set OVS Bridge ${NET_MAP[$network]} with IP: ${ovs_ip}${reset}"
+ return 1
+ fi
+ fi
+ done
+
+ # for virtual, we NAT public network through instack
+ if [ "$virtual" == "TRUE" ]; then
+ if ! configure_undercloud_nat ${public_network_cidr}; then
+ echo -e "${red}ERROR: Unable to NAT undercloud with external net: ${public_network_cidr}${reset}"
+ exit 1
+ else
+ echo -e "${blue}INFO: Undercloud (instack VM) has been setup to NAT Overcloud public network${reset}"
+ fi
+ fi
+
+ # for sfc deployments we need the vxlan workaround
+ if [ "${deploy_options_array['sfc']}" == 'true' ]; then
+ ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
+source stackrc
+set -o errexit
+for node in \$(nova list | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"); do
+ssh -T ${SSH_OPTIONS[@]} "heat-admin@\$node" <<EOF
+sudo ifconfig br-int up
+sudo ip route add 123.123.123.0/24 dev br-int
+EOF
+done
+EOI
+ fi
}
display_usage() {
echo -e " -r|--resources : Directory to deployment resources. Optional. Defaults to /var/opt/opnfv/stack \n"
echo -e " -v|--virtual : Virtualize overcloud nodes instead of using baremetal. \n"
echo -e " --no-ha : disable High Availability deployment scheme, this assumes a single controller and single compute node \n"
- echo -e " --flat : disable Network Isolation and use a single flat network for the underlay network."
+ echo -e " --flat : disable Network Isolation and use a single flat network for the underlay network.\n"
+ echo -e " --no-post-config : disable Post Install configuration."
+ echo -e " --debug : enable debug output."
+ echo -e " --interactive : enable interactive deployment mode which requires user to confirm steps of deployment."
}
##translates the command line parameters into variables
echo "Underlay Network Isolation Disabled: using flat configuration"
shift 1
;;
+ --no-post-config )
+ post_config="FALSE"
+ echo "Post install configuration disabled"
+ shift 1
+ ;;
+ --debug )
+ debug="TRUE"
+ echo "Enable debug output"
+ shift 1
+ ;;
+ --interactive )
+ interactive="TRUE"
+ echo "Interactive mode enabled"
+ shift 1
+ ;;
*)
display_usage
exit 1
if [[ ! -z "$NETSETS" && "$net_isolation_enabled" == "FALSE" ]]; then
echo -e "${red}INFO: Single flat network requested. Ignoring any network settings!${reset}"
elif [[ -z "$NETSETS" && "$net_isolation_enabled" == "TRUE" ]]; then
- echo -e "${red}ERROR: You must provide a network_settings file with -n or use --flat to force a single flat network{reset}"
+ echo -e "${red}ERROR: You must provide a network_settings file with -n or use --flat to force a single flat network${reset}"
+ exit 1
fi
if [[ -n "$virtual" && -n "$INVENTORY_FILE" ]]; then
exit 1
fi
- if [[ ! -z "$DEPLOY_SETTINGS_FILE" && ! -f "$DEPLOY_SETTINGS_FILE" ]]; then
- echo -e "${red}ERROR: ${DEPLOY_SETTINGS_FILE} does not exist! Exiting...${reset}"
+ if [[ -z "$DEPLOY_SETTINGS_FILE" || ! -f "$DEPLOY_SETTINGS_FILE" ]]; then
+ echo -e "${red}ERROR: Deploy Settings: ${DEPLOY_SETTINGS_FILE} does not exist! Exiting...${reset}"
exit 1
fi
if [[ ! -z "$NETSETS" && ! -f "$NETSETS" ]]; then
- echo -e "${red}ERROR: ${NETSETS} does not exist! Exiting...${reset}"
+ echo -e "${red}ERROR: Network Settings: ${NETSETS} does not exist! Exiting...${reset}"
exit 1
fi
if [[ ! -z "$INVENTORY_FILE" && ! -f "$INVENTORY_FILE" ]]; then
- echo -e "{$red}ERROR: ${DEPLOY_SETTINGS_FILE} does not exist! Exiting...${reset}"
+ echo -e "{$red}ERROR: Inventory File: ${INVENTORY_FILE} does not exist! Exiting...${reset}"
exit 1
fi
echo -e "${red}ERROR: You must specify an inventory file for baremetal deployments! Exiting...${reset}"
exit 1
fi
+
+ if [[ "$net_isolation_enabled" == "FALSE" && "$post_config" == "TRUE" ]]; then
+ echo -e "${blue}INFO: Post Install Configuration will be skipped. It is not supported with --flat${reset}"
+ post_config="FALSE"
+ fi
+
+ ##LIBRARIES
+ # Do this after cli parse so that $CONFIG is set properly
+ source $CONFIG/lib/common-functions.sh
+ source $CONFIG/lib/installer/onos/onos_gw_mac_update.sh
+
}
##END FUNCTIONS
fi
configure_undercloud
undercloud_prep_overcloud_deploy
+ if [ "$post_config" == "TRUE" ]; then
+ if ! configure_post_install; then
+ echo -e "${red}ERROR:Post Install Configuration Failed, Exiting.${reset}"
+ exit 1
+ else
+ echo -e "${blue}INFO: Post Install Configuration Complete${reset}"
+ fi
+ fi
+ if [[ "${deploy_options_array['sdn_controller']}" == 'onos' ]]; then
+ if ! onos_update_gw_mac ${public_network_cidr} ${public_network_gateway}; then
+ echo -e "${red}ERROR:ONOS Post Install Configuration Failed, Exiting.${reset}"
+ exit 1
+ else
+ echo -e "${blue}INFO: ONOS Post Install Configuration Complete${reset}"
+ fi
+ fi
}
main "$@"