diff options
-rwxr-xr-x | ci/03-maasdeploy.sh | 2 | ||||
-rwxr-xr-x | ci/cleanvm.sh | 6 | ||||
-rwxr-xr-x | ci/deploy.sh | 37 | ||||
-rwxr-xr-x | ci/openstack.sh | 20 | ||||
-rw-r--r-- | ci/tools.sh | 19 |
5 files changed, 60 insertions, 24 deletions
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index 6d33691e..5ed39341 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -671,4 +671,4 @@ fi # # End of scripts # -echo_info " .... MAAS deployment finished successfully ...." +echo_info "MAAS deployment finished successfully" diff --git a/ci/cleanvm.sh b/ci/cleanvm.sh index df069baf..a2609bd8 100755 --- a/ci/cleanvm.sh +++ b/ci/cleanvm.sh @@ -2,7 +2,9 @@ set -x -echo " Cleanup Started ..." +source tools.sh + +echo_info "Cleanup Started..." #use the below commands if you needs to delete the virtual machine # also along with environment destroy. @@ -20,4 +22,4 @@ do sudo rm -f /var/lib/libvirt/images/${vm}.qcow2 done -echo " Cleanup Finished ..." +echo_info "Cleanup Finished!" diff --git a/ci/deploy.sh b/ci/deploy.sh index 768f5e84..795babbf 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -2,6 +2,8 @@ set -ex +source tools.sh + #need to put multiple cases here where decide this bundle to deploy by default use the odl bundle. # Below parameters are the default and we can according the release @@ -111,7 +113,7 @@ createresource() { jq -r ".[] | select(.hostname == \"$node\").system_id") fi if [[ -z "$node_id" ]]; then - echo "Error: failed to create node $node ." + echo_error "Error: failed to create node $node ." exit 1 fi maas $PROFILE tag update-nodes control add=$node_id || true @@ -138,7 +140,7 @@ deploy() { python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml fi else - echo " MAAS not deployed please deploy MAAS first." + echo_error "MAAS not deployed please deploy MAAS first." fi fi @@ -153,7 +155,7 @@ deploy() { cp ~/joid_config/environments.yaml ./environments.yaml fi #copy the script which needs to get deployed as part of ofnfv release - echo "...... deploying now ......" + echo_info "Deploying now..." echo " " >> environments.yaml echo " enable-os-refresh-update: false" >> environments.yaml echo " enable-os-upgrade: false" >> environments.yaml @@ -184,19 +186,19 @@ check_status() { retval=0 timeoutiter=0 - echo -n "executing the relationship within charms ." + echo_info "Executing the relationships within charms..." while [ $retval -eq 0 ]; do if juju status | grep -q $waitstatus; then - echo -n '.' + echo_info "Still waiting for $waitstatus units" if [ $timeoutiter -ge 180 ]; then - echo 'timed out' + echo_error 'Timed out' retval=1 else sleep 30 fi timeoutiter=$((timeoutiter+1)) else - echo 'done' + echo_info 'Done executing the relationships' retval=1 fi done @@ -206,7 +208,7 @@ check_status() { #juju ssh ceph/0 \ 'sudo radosgw-admin user create --uid="ubuntu" --display-name="Ubuntu Ceph"' fi - echo "...... deployment finishing ......." + echo_info "Deployment finishing..." } # In the case of a virtual deployment @@ -214,15 +216,15 @@ if [ "$virtinstall" -eq 1 ]; then ./clean.sh || true fi -echo "...... deployment started ......" +echo_info "Deployment started" deploy check_status executing -echo "...... deployment finished ......." +echo_info "Deployment finished" -echo "...... configuring public access ......." +echo_info "Configuring public access" # translate bundle.yaml to json python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < bundles.yaml > bundles.json @@ -237,7 +239,7 @@ admin_gw=$(cat labconfig.json | jq --raw-output ".opnfv.spaces[] | select(.type= if ([ $admin_gw ] && [ $admin_gw != "null" ]); then # set default gateway to public api gateway for cnt in $cnt_list; do - echo "changing default gw on $cnt" + echo_info "Changing default gateway on $cnt" if ([ $public_api_gw ] && [ $public_api_gw != "null" ]); then juju ssh $cnt "sudo ip r d default && sudo ip r a default via $public_api_gw"; juju ssh $cnt "gw_dev=\$(ip r l | grep 'via $public_api_gw' | cut -d \ -f5) &&\ @@ -250,9 +252,10 @@ if ([ $admin_gw ] && [ $admin_gw != "null" ]); then done fi -echo "...... configure ......." - +// Configuring deployment if ([ $opnfvmodel == "openstack" ]); then + echo_info "Configuring OpenStack deployment" + ./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true # creating heat domain after pushing the public API into /etc/hosts @@ -272,12 +275,14 @@ if ([ $opnfvmodel == "openstack" ]); then fi elif ([ $opnfvmodel == "kubernetes" ]); then + echo_info "Configuring Kubernetes deployment" + ./k8.sh fi # expose the juju gui-url to login into juju gui -echo " ...... JUJU GUI can be access using the below URL ...... " +echo_info "Juju GUI can be accessed using the following URL and credentials:" juju gui --show-credentials --no-browser -echo "...... finished ......." +echo "Finished deployment and configuration" diff --git a/ci/openstack.sh b/ci/openstack.sh index 9020fd7c..98ebb145 100755 --- a/ci/openstack.sh +++ b/ci/openstack.sh @@ -1,5 +1,4 @@ #!/bin/bash -ex - ############################################################################## # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -7,6 +6,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +set -ex + +source tools.sh + #./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true opnfvsdn=$1 @@ -84,6 +87,8 @@ keystoneIp() { # create external network and subnet in openstack create_openrc() { + echo_info "Creating the openrc (OpenStack client environment scripts)" + mkdir -m 0700 -p cloud keystoneIp=$(keystoneIp) if [[ "$jujuver" < "2" ]]; then @@ -150,7 +155,9 @@ export OS_AUTH_URL=$4 EOF } -if ([ $API_FQDN ] && [ $API_FQDN != "null" ] && [ $API_FQDN != "None"]); then +if ([ $API_FQDN ] && [ $API_FQDN != "null" ] && [ $API_FQDN != "None" ]); then + echo_info "OS domain name was specified - injecting API FQDN to nodes" + # Push api fqdn local ip to all /etc/hosts if [[ "$jujuver" < "2" ]]; then API_FQDN=$(juju get keystone | python -c "import yaml; import sys;\ @@ -187,13 +194,13 @@ create_openrc . ~/joid_config/admin-openrc -echo "...... deploy public api proxy ......" - if ([ "$opnfvlab" == "orangepod1" ] \ || [ "$opnfvlab" == "intelpod6" ]) \ && [ "$opnfvsdn" == "nosdn" ] \ && [ "$API_FQDN" != "None" ]; then # only for first test phase if [ -e ./labconfig.yaml ]; then + echo_info "Deploying public API proxy" + PUB_API_MASK=$(grep floating-ip-range ./labconfig.yaml |cut -d/ -f2) PUB_API_NET=$(grep floating-ip-range ./labconfig.yaml |cut -d, -f4) PUB_API_IP=$(grep public-api-ip ./labconfig.yaml |cut -d: -f2) @@ -218,10 +225,11 @@ if ([ "$opnfvlab" == "orangepod1" ] \ juju run --unit nodes/0 "sudo ip l set dev br-ex up" || true python genPublicAPIProxyBundle.py -l labconfig.yaml >> bundles.yaml juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$opnfvos" || true + + echo_info "Public API proxy deployed!" fi fi -echo "...... deploy end public api proxy ......" ## ## removing the swift API endpoint which is created by radosgw. @@ -238,6 +246,8 @@ echo "...... deploy end public api proxy ......" ## Create external subnet Network ## +echo_info "Creating external network with neutron" + if [ "onos" == "$opnfvsdn" ]; then launch_eth neutron net-show ext-net > /dev/null 2>&1 || neutron net-create ext-net \ diff --git a/ci/tools.sh b/ci/tools.sh index 4eed361b..ecb2e806 100644 --- a/ci/tools.sh +++ b/ci/tools.sh @@ -7,6 +7,8 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +# include only once +[ ! -z "$_tools_included" ] && return || readonly _tools_included=true ####################################### # Echo printing in yellow bold color @@ -24,3 +26,20 @@ function echo_info { ( echo "${@:1:($#-1)}" -e "$yellow_bold${@: -1}$color_off"; ) } + +####################################### +# Echo error +# Arguments: +# Same as for echo +# Returns: +# None +####################################### +function echo_error { ( + # don't clutter the script output with the xtrace of the echo command + { set +x; } 2> /dev/null + + red_bold='\033[1;31m' + color_off='\033[0m' + >&2 echo "${@:1:($#-1)}" -e "$red_bold${@: -1}$color_off"; + ) +} |