From 1695a72d5680fae3cf35d6a6dbd64de5dd08daf3 Mon Sep 17 00:00:00 2001 From: Dan Radez Date: Thu, 26 May 2016 14:34:31 -0400 Subject: Updates to CONFIG, RESOURCES and LIB - removing the -r and -c parameters - relying on ENV vars for non-system locations - abstracting the apex-python-utils to a var Change-Id: I7ff1ca8b741c890647aee029c57e8342f0b5cb07 Signed-off-by: Dan Radez --- ci/clean.sh | 4 +++- ci/deploy.sh | 49 +++++++++++++++++++------------------------------ ci/util.sh | 4 +++- lib/common-functions.sh | 2 +- 4 files changed, 26 insertions(+), 33 deletions(-) diff --git a/ci/clean.sh b/ci/clean.sh index 42090069..08c0d53f 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -14,9 +14,11 @@ # Use default if no param passed CONFIG=${CONFIG:-'/var/opt/opnfv'} +RESOURCES=${RESOURCES:-"$CONFIG/images"} +LIB=${LIB:-"$CONFIG/lib"} ##LIBRARIES -source $CONFIG/lib/common-functions.sh +source $LIB/common-functions.sh vm_index=4 ovs_bridges="br-admin br-private br-public br-storage" diff --git a/ci/deploy.sh b/ci/deploy.sh index b5208272..1ca3bcd6 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -38,9 +38,11 @@ declare -A NET_MAP 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 # Netmap used to map networks to OVS bridge names @@ -51,6 +53,11 @@ NET_MAP['storage_network']="br-storage" ext_net_type="interface" ip_address_family=4 +# Libraries +source $LIB/common-functions.sh +source $LIB/utility-functions.sh +source $LIB/installer/onos/onos_gw_mac_update.sh + ##FUNCTIONS ##translates yaml into variables ##params: filename, prefix (ex. "config_") @@ -107,7 +114,7 @@ parse_setting_value() { ##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 -n $NETSETS -i $net_isolation_enabled); then echo -e "${blue}${output}${reset}" eval "$output" else @@ -119,7 +126,7 @@ parse_network_settings() { ##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 @@ -628,12 +635,12 @@ function configure_undercloud { 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 + if ! controller_nic_template=$(python3.4 -B $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 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 -d $CONFIG -f 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 @@ -1021,15 +1028,13 @@ EOI 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 " --no-ha : disable High Availability deployment scheme, this assumes a single controller and single compute node" + 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." @@ -1052,11 +1057,6 @@ parse_cmdline() { 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" @@ -1076,11 +1076,6 @@ parse_cmdline() { 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" @@ -1166,12 +1161,6 @@ parse_cmdline() { 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 diff --git a/ci/util.sh b/ci/util.sh index 67748c0b..b262c203 100755 --- a/ci/util.sh +++ b/ci/util.sh @@ -3,9 +3,11 @@ # @author Tim Rozet (trozet@redhat.com) CONFIG=${CONFIG:-'/var/opt/opnfv'} +RESOURCES=${RESOURCES:-"$CONFIG/images"} +LIB=${LIB:-"$CONFIG/lib"} VALID_CMDS="undercloud debug-stack -h --help" -source $CONFIG/lib/utility-functions.sh +source $LIB/utility-functions.sh resolve_cmd() { local given=$1 diff --git a/lib/common-functions.sh b/lib/common-functions.sh index dfac008e..244d7585 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -18,7 +18,7 @@ function find_ip { return 1 fi - python3.4 -B $CONFIG/lib/python/apex-python-utils.py find_ip -i $1 + python3.4 -B $LIB/python/apex-python-utils.py find_ip -i $1 } ##attach interface to OVS and set the network config correctly -- cgit 1.2.3-korg