red=$(tput setaf 1 || echo "")
green=$(tput setaf 2 || echo "")
-vm_index=4
interactive="FALSE"
ping_site="8.8.8.8"
ntp_server="pool.ntp.org"
SSH_OPTIONS=(-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o LogLevel=error)
DEPLOY_OPTIONS=""
-RESOURCES=${RESOURCES:-'/var/opt/opnfv/images'}
CONFIG=${CONFIG:-'/var/opt/opnfv'}
+RESOURCES=${RESOURCES:-"$CONFIG/images"}
+LIB=${LIB:-"$CONFIG/lib"}
OPNFV_NETWORK_TYPES="admin_network private_network public_network storage_network"
+
VM_CPUS=4
VM_RAM=8
+VM_COMPUTES=2
+
# Netmap used to map networks to OVS bridge names
NET_MAP['admin_network']="br-admin"
NET_MAP['private_network']="br-private"
ext_net_type="interface"
ip_address_family=4
+# Libraries
+lib_files=(
+$LIB/common-functions.sh
+$LIB/utility-functions.sh
+$LIB/installer/onos/onos_gw_mac_update.sh
+)
+for lib_file in ${lib_files[@]}; do
+ if ! source $lib_file; then
+ echo -e "${red}ERROR: Failed to source $lib_file${reset}"
+ exit 1
+ fi
+done
+
##FUNCTIONS
##translates yaml into variables
##params: filename, prefix (ex. "config_")
##parses network settings yaml into globals
parse_network_settings() {
local output
- if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse_net_settings -n $NETSETS -i $net_isolation_enabled); then
+ if output=$(python3.4 -B $LIB/python/apex-python-utils.py parse-net-settings -s $NETSETS -i $net_isolation_enabled -e $CONFIG/network-environment.yaml); then
echo -e "${blue}${output}${reset}"
eval "$output"
else
##parses deploy settings yaml into globals
parse_deploy_settings() {
local output
- if output=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py parse-deploy-settings -f $DEPLOY_SETTINGS_FILE); then
+ if output=$(python3.4 -B $LIB/python/apex-python-utils.py parse-deploy-settings -f $DEPLOY_SETTINGS_FILE); then
echo -e "${blue}${output}${reset}"
eval "$output"
else
EOF
# next create the virtual machines and add their definitions to the file
+ if [ ha_enabled == "False" ]; then
+ # 1 controller + computes
+ # zero based so just pass compute count
+ vm_index=$VM_COMPUTES
+ else
+ # 3 controller + computes
+ # zero based so add 2 to compute count
+ vm_index=$((2+$VM_COMPUTES))
+ fi
+
for i in $(seq 0 $vm_index); do
if ! virsh list --all | grep baremetal${i} > /dev/null; then
define_vm baremetal${i} network 41 'admin_network' $vcpus $ramsize
--baremetal-interface $4
}
-##Set network-environment settings
-##params: network-environment file to edit
-function configure_network_environment {
- local tht_dir
- tht_dir=/usr/share/openstack-tripleo-heat-templates/network
-
- 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
- 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#^.*Network::Ports::StorageVipPort:.*$# OS::TripleO::Network::Ports::StorageVipPort: '${tht_dir}'/ports/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
- else
- sed -i 's#^.*Network::Storage:.*$# OS::TripleO::Network::Storage: '${tht_dir}'/noop.yaml#' $1
- sed -i 's#^.*Network::Ports::StorageVipPort:.*$# OS::TripleO::Network::Ports::StorageVipPort: '${tht_dir}'/ports/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
-
- # check for ODL L3
- if [ "${deploy_options_array['sdn_l3']}" == 'true' ]; then
- ext_net_type=br-ex
- fi
-
-}
##Copy over the glance images and instackenv json file
##params: none
function configure_undercloud {
echo
echo "Copying configuration files to Undercloud"
if [[ "$net_isolation_enabled" == "TRUE" ]]; then
- configure_network_environment $CONFIG/network-environment.yaml
echo -e "${blue}Network Environment set for Deployment: ${reset}"
- cat $CONFIG/network-environment.yaml
- scp ${SSH_OPTIONS[@]} $CONFIG/network-environment.yaml "stack@$UNDERCLOUD":
- if ! controller_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+ cat /tmp/network-environment.yaml
+ scp ${SSH_OPTIONS[@]} /tmp/network-environment.yaml "stack@$UNDERCLOUD":
+
+ # check for ODL L3/ONOS
+ if [ "${deploy_options_array['sdn_l3']}" == 'True' ]; then
+ ext_net_type=br-ex
+ fi
+
+ if ! controller_nic_template=$(python3.4 -B $LIB/python/apex-python-utils.py nic-template -t $CONFIG/nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
echo -e "${red}ERROR: Failed to generate controller NIC heat template ${reset}"
exit 1
fi
- if ! compute_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+ if ! compute_nic_template=$(python3.4 -B $LIB/python/apex-python-utils.py nic-template -t $CONFIG/nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
echo -e "${red}ERROR: Failed to generate compute NIC heat template ${reset}"
exit 1
fi
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
+ elif [ "${deploy_options_array['sfc']}" == 'True' ]; then
DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sfc.yaml"
- elif [ "${deploy_options_array['vpn']}" == 'true' ]; then
+ elif [ "${deploy_options_array['vpn']}" == 'True' ]; then
DEPLOY_OPTIONS+=" -e /usr/share/openstack-tripleo-heat-templates/environments/opendaylight_sdnvpn.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
+ if [ "${deploy_options_array['sfc']}" == 'True' ]; then
SDN_IMAGE+=-sfc
if [ ! -f $RESOURCES/overcloud-full-${SDN_IMAGE}.qcow2 ]; then
echo "${red} $RESOURCES/overcloud-full-${SDN_IMAGE}.qcow2 is required to execute an SFC deployment."
fi
# for sfc deployments we need the vxlan workaround
- if [ "${deploy_options_array['sfc']}" == 'true' ]; then
+ if [ "${deploy_options_array['sfc']}" == 'True' ]; then
ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" <<EOI
source stackrc
set -o errexit
display_usage() {
echo -e "Usage:\n$0 [arguments] \n"
- echo -e " -c|--config : Directory to configuration files. Optional. Defaults to /var/opt/opnfv/ \n"
- echo -e " -d|--deploy-settings : Full path to deploy settings yaml file. Optional. Defaults to null \n"
- echo -e " -i|--inventory : Full path to inventory yaml file. Required only for baremetal \n"
- echo -e " -n|--net-settings : Full path to network settings file. Optional. \n"
- echo -e " -p|--ping-site : site to use to verify IP connectivity. Optional. Defaults to 8.8.8.8 \n"
- 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.\n"
+ echo -e " -d|--deploy-settings : Full path to deploy settings yaml file. Optional. Defaults to null"
+ echo -e " -i|--inventory : Full path to inventory yaml file. Required only for baremetal"
+ echo -e " -n|--net-settings : Full path to network settings file. Optional."
+ echo -e " -p|--ping-site : site to use to verify IP connectivity. Optional. Defaults to 8.8.8.8"
+ echo -e " -v|--virtual : Virtualize overcloud nodes instead of using baremetal."
+ echo -e " --flat : disable Network Isolation and use a single flat network for the underlay network."
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."
display_usage
exit 0
;;
- -c|--config)
- CONFIG=$2
- echo "Deployment Configuration Directory Overridden to: $2"
- shift 2
- ;;
-d|--deploy-settings)
DEPLOY_SETTINGS_FILE=$2
echo "Deployment Configuration file: $2"
echo "Using $2 as the ping site"
shift 2
;;
- -r|--resources)
- RESOURCES=$2
- echo "Deployment Resources Directory Overridden to: $2"
- shift 2
- ;;
-v|--virtual)
virtual="TRUE"
echo "Executing a Virtual Deployment"
shift 1
;;
- --no-ha )
- ha_enabled="False"
- vm_index=1
- echo "HA Deployment Disabled"
- shift 1
- ;;
--flat )
net_isolation_enabled="FALSE"
echo "Underlay Network Isolation Disabled: using flat configuration"
echo "Amount of RAM per VM set to $VM_RAM"
shift 2
;;
+ --virtual-computes )
+ VM_COMPUTES=$2
+ echo "Virtual Compute nodes set to $VM_COMPUTES"
+ shift 2
+ ;;
*)
display_usage
exit 1
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/utility-functions.sh
- source $CONFIG/lib/installer/onos/onos_gw_mac_update.sh
-
}
##END FUNCTIONS