diff options
l--------- | ci/00-maasdeploy.sh | 1 | ||||
-rwxr-xr-x | ci/01-bootstrap.sh | 21 | ||||
-rwxr-xr-x | ci/02-deploybundle.sh | 22 | ||||
-rwxr-xr-x | ci/03-maasdeploy.sh | 20 | ||||
-rwxr-xr-x | ci/clean.sh | 62 | ||||
-rwxr-xr-x | ci/cleanmaas.sh | 10 | ||||
-rw-r--r-- | ci/depMAAS.py | 9 | ||||
-rwxr-xr-x | ci/deploy.sh | 15 | ||||
-rw-r--r-- | ci/genBundle.py | 8 | ||||
-rw-r--r-- | ci/genDeploymentConfig.py | 9 | ||||
-rw-r--r-- | ci/genK8Bundle.py | 3 | ||||
-rw-r--r-- | ci/genMAASConfig.py | 9 | ||||
-rwxr-xr-x | ci/openstack.sh | 32 |
13 files changed, 40 insertions, 181 deletions
diff --git a/ci/00-maasdeploy.sh b/ci/00-maasdeploy.sh deleted file mode 120000 index 33b6f4dd..00000000 --- a/ci/00-maasdeploy.sh +++ /dev/null @@ -1 +0,0 @@ -03-maasdeploy.sh
\ No newline at end of file diff --git a/ci/01-bootstrap.sh b/ci/01-bootstrap.sh index 88f87dd5..e45c2ee0 100755 --- a/ci/01-bootstrap.sh +++ b/ci/01-bootstrap.sh @@ -2,21 +2,6 @@ set -ex -#export JUJU_DEV_FEATURE_FLAGS=address-allocation - -jujuver=`juju --version` - -if [[ "$jujuver" < "2" ]]; then - juju bootstrap --debug --to bootstrap.maas --agent-version 1.25.5 - sleep 5 - #disable juju gui until xenial charms are in charm store. - juju deploy cs:juju-gui-130 --to 0 - - JUJU_REPOSITORY= - juju set-constraints tags= - -else - controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` - cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` - juju bootstrap $controllername $cloudname --debug --to bootstrap.maas -fi +controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` +cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` +juju bootstrap $controllername $cloudname --debug --to bootstrap.maas diff --git a/ci/02-deploybundle.sh b/ci/02-deploybundle.sh index 5a72445e..d86d1e0e 100755 --- a/ci/02-deploybundle.sh +++ b/ci/02-deploybundle.sh @@ -12,9 +12,6 @@ opnfvfeature=$5 opnfvdistro=$6 opnfvmodel=$7 -jujuver=`juju --version` -maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'` - if [[ "$opnfvmodel" = "openstack" ]]; then #copy and download charms ./$opnfvsdn/fetch-charms.sh $opnfvdistro @@ -54,19 +51,10 @@ check_status() { PROFILE=maas MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //') API_SERVERMAAS="http://$MAAS_IP:5240/MAAS/" -if [[ "$maasver" > "2" ]]; then - API_KEY=`sudo maas-region apikey --username=ubuntu || true` -else - API_KEY=`sudo maas-region-admin apikey --username=ubuntu || true` -fi - +API_KEY=`sudo maas-region apikey --username=ubuntu || true` if [[ "$API_KEY" = "" ]]; then - if [[ "$maasver" > "2" ]]; then - API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'` - else - API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region-admin apikey --username=ubuntu'` - fi + API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'` fi maas login $PROFILE $API_SERVERMAAS $API_KEY @@ -80,11 +68,7 @@ if [[ "$opnfvmodel" = "openstack" ]]; then osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'` fi - if [[ "$maasver" > "2" ]]; then - workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '` - else - workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '` - fi + workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '` max=0 for v in ${workmutiple[@]}; do if (( $v > $max )); then max=$v; fi; diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index bc0c2cbb..09f497b5 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -58,10 +58,6 @@ sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvi python-congressclient gsutil charm-tools pastebinit python-jinja2 sshpass \ openssh-server vlan ipmitool jq expect snap -y -#sudo apt-get install snap -y -#sudo snap install maas --classic -#sudo snap install juju --classic - sudo -H pip install --upgrade pip @@ -224,14 +220,6 @@ sudo cat ~maas/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys sudo cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys # -# MAAS deploy -# - -installmaas(){ - sudo apt-get install maas maas-region-controller -y -} - -# # MAAS config # https://insights.ubuntu.com/2016/01/23/maas-setup-deploying-openstack-on-maas-1-9-with-juju/ # http://blog.naydenov.net/2016/01/nodes-networking-deploying-openstack-on-maas-1-9-with-juju/ @@ -688,12 +676,8 @@ if [ -e ./labconfig.json ]; then fi # Add the cloud and controller credentials for MAAS for that lab. -jujuver=`juju --version` - -if [[ "$jujuver" > "2" ]]; then - addcloud - addcredential -fi +addcloud +addcredential # # End of scripts diff --git a/ci/clean.sh b/ci/clean.sh index 5005b594..1f3ef54f 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -2,52 +2,22 @@ set -ex -jujuver=`juju --version` - -if [[ "$jujuver" > "2" ]]; then - if [ ! -d labconfig.yaml ]; then - cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true - if [ -d $HOME/joid_config/deployconfig.yaml ]; then - cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true - else - python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml - fi - fi -else - if [ ! -d environments.yaml ]; then - cp ~/joid_config/environments.yaml ./environments.yaml || true - cp ~/.juju/environments.yaml ./environments.yaml || true - fi -fi - - -if [[ "$jujuver" > "2" ]]; then - controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` - cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` - juju destroy-controller $controllername --destroy-all-models -y || true -# juju kill-controller $controllername --timeout 10s -y || true - rm -rf precise - rm -rf trusty - rm -rf xenial - rm -rf ~/joid_config/admin-openrc - sleep 10 - sudo sysctl -w vm.drop_caches=3 -elif [ -d $HOME/.juju/environments ]; then - echo " " > status.txt - juju status &>>status.txt || true - if [ "$(grep -c "environment is not bootstrapped" status.txt )" -ge 1 ]; then - echo " environment is not bootstrapped ..." +if [ ! -d labconfig.yaml ]; then + cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true + if [ -d $HOME/joid_config/deployconfig.yaml ]; then + cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true else - echo " environment is bootstrapped ..." - jujuenv=`juju status | grep environment | cut -d ":" -f 2` - juju destroy-environment $jujuenv -y || true + python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml fi - rm -rf precise - rm -rf trusty - rm -rf xenial - rm -rf $HOME/.juju/j* - rm -rf $HOME/.juju/.deployer-store-cache - rm -rf $HOME/.juju/environments - rm -rf $HOME/.juju/ssh - sudo sysctl -w vm.drop_caches=3 fi + +controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` +cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml` +juju destroy-controller $controllername --destroy-all-models -y || true +#juju kill-controller $controllername --timeout 10s -y || true +rm -rf precise +rm -rf trusty +rm -rf xenial +rm -rf ~/joid_config/admin-openrc +sleep 10 +sudo sysctl -w vm.drop_caches=3 diff --git a/ci/cleanmaas.sh b/ci/cleanmaas.sh index 41a74196..bcb4e443 100755 --- a/ci/cleanmaas.sh +++ b/ci/cleanmaas.sh @@ -2,10 +2,6 @@ set -ex -maasver=$(apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/^[ ]*//') - -if [[ "$maasver" > "2" ]]; then - echo "removing existing maas ..." - sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y - sudo rm -rf /var/lib/maas -fi +echo "removing existing maas ..." +sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y +sudo rm -rf /var/lib/maas diff --git a/ci/depMAAS.py b/ci/depMAAS.py index 5592bc46..3a16b1e4 100644 --- a/ci/depMAAS.py +++ b/ci/depMAAS.py @@ -31,14 +31,7 @@ labconfig_file = options.lab # # Set Path and configs path # - -# Capture our current directory -jujuver = subprocess.check_output(["juju", "--version"]) - -if LooseVersion(jujuver) >= LooseVersion('2'): - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas_tpl' -else: - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas2/maas_tpl' +TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas_tpl' HOME = os.environ['HOME'] USER = os.environ['USER'] diff --git a/ci/deploy.sh b/ci/deploy.sh index a6a1b182..560807f7 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -227,7 +227,7 @@ deploy() { ./cleanvm.sh || true if [ "$virtinstall" -eq 1 ]; then - ./00-maasdeploy.sh virtual + ./03-maasdeploy.sh virtual else if [ -z "$labfile" ]; then if [ ! -e ./labconfig.yaml ]; then @@ -248,7 +248,7 @@ deploy() { cp $labfile ./labconfig.yaml fi - ./00-maasdeploy.sh custom + ./03-maasdeploy.sh custom fi fi @@ -318,8 +318,6 @@ juju status --format=tabular # 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 -jujuver=`juju --version` - # Configuring deployment if ([ $opnfvmodel == "openstack" ]); then echo_info "Configuring OpenStack deployment" @@ -327,13 +325,8 @@ if ([ $opnfvmodel == "openstack" ]); then ./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true # creating heat domain after pushing the public API into /etc/hosts - if [[ "$jujuver" > "2" ]]; then - status=`juju run-action heat/0 domain-setup` - echo $status - else - status=`juju action do heat/0 domain-setup` - echo $status - fi + status=`juju run-action heat/0 domain-setup` + echo $status sudo ../juju/get-cloud-images || true ../juju/joid-configure-openstack || true diff --git a/ci/genBundle.py b/ci/genBundle.py index 1bd09bb0..ffe9cb8f 100644 --- a/ci/genBundle.py +++ b/ci/genBundle.py @@ -35,13 +35,7 @@ labconfig_file = options.lab # scenarioconfig_file = 'default_deployment_config.yaml' -# Capture our current directory -jujuver = subprocess.check_output(["juju", "--version"]) - -if LooseVersion(jujuver) >= LooseVersion('2'): - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundle_tpl' -else: - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/bundle_tpl' +TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundle_tpl' # # Prepare variables diff --git a/ci/genDeploymentConfig.py b/ci/genDeploymentConfig.py index 0a21fffa..0d3a1c95 100644 --- a/ci/genDeploymentConfig.py +++ b/ci/genDeploymentConfig.py @@ -30,14 +30,7 @@ labconfig_file = options.lab # # Set Path and configs path # - -# Capture our current directory -jujuver = subprocess.check_output(["juju", "--version"]) - -if LooseVersion(jujuver) >= LooseVersion('2'): - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2' -else: - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl' +TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2' HOME = os.environ['HOME'] USER = os.environ['USER'] diff --git a/ci/genK8Bundle.py b/ci/genK8Bundle.py index 2f0b63d5..f0198d77 100644 --- a/ci/genK8Bundle.py +++ b/ci/genK8Bundle.py @@ -35,9 +35,6 @@ labconfig_file = options.lab # scenarioconfig_file = 'default_deployment_config.yaml' -# Capture our current directory -jujuver = subprocess.check_output(["juju", "--version"]) - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundlek8_tpl' # diff --git a/ci/genMAASConfig.py b/ci/genMAASConfig.py index 9417f71c..8a3f5571 100644 --- a/ci/genMAASConfig.py +++ b/ci/genMAASConfig.py @@ -31,14 +31,7 @@ labconfig_file = options.lab # # Set Path and configs path # - -# Capture our current directory -jujuver = subprocess.check_output(["juju", "--version"]) - -if LooseVersion(jujuver) >= LooseVersion('2'): - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas2/maas_tpl' -else: - TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas_tpl' +TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas2/maas_tpl' HOME = os.environ['HOME'] USER = os.environ['USER'] diff --git a/ci/openstack.sh b/ci/openstack.sh index a32bb998..a7d91fb6 100755 --- a/ci/openstack.sh +++ b/ci/openstack.sh @@ -17,8 +17,6 @@ opnfvlab=$2 opnfvdistro=$3 opnfvos=$4 -jujuver=`juju --version` - if [ -f ./deployconfig.yaml ];then EXTERNAL_NETWORK=`grep floating-ip-range deployconfig.yaml | cut -d ' ' -f 4 ` @@ -49,38 +47,22 @@ update_gw_mac() { ## get gateway mac EXTNET_GW_MAC=$(juju ssh nova-compute/0 "arp -a ${EXTNET_GW} | grep -Eo '([0-9a-fA-F]{2})(([/\s:-][0-9a-fA-F]{2}){5})'") ## set external gateway mac in onos - if [[ "$jujuver" < "2" ]]; then - juju set onos-controller gateway-mac=$EXTNET_GW_MAC - else - juju config onos-controller gateway-mac=$EXTNET_GW_MAC - fi + juju config onos-controller gateway-mac=$EXTNET_GW_MAC } unitAddress() { - if [[ "$jujuver" < "2" ]]; then - juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"services\"][\"$1\"][\"units\"][\"$1/$2\"][\"public-address\"]" 2> /dev/null - else - juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"public-address\"]" 2> /dev/null - fi + juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"public-address\"]" 2> /dev/null } unitMachine() { - if [[ "$jujuver" < "2" ]]; then - juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"services\"][\"$1\"][\"units\"][\"$1/$2\"][\"machine\"]" 2> /dev/null - else - juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"machine\"]" 2> /dev/null - fi + juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"machine\"]" 2> /dev/null } keystoneIp() { if [ $(juju status keystone --format=short | grep " keystone"|wc -l) == 1 ];then unitAddress keystone 0 else - if [[ "$jujuver" < "2" ]]; then - juju get keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)['settings']['vip']['value']" | cut -d " " -f 1 - else - juju config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)['settings']['vip']['value']" | cut -d " " -f 1 - fi + juju config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)['settings']['vip']['value']" | cut -d " " -f 1 fi } @@ -90,11 +72,7 @@ create_openrc() { mkdir -m 0700 -p cloud keystoneIp=$(keystoneIp) - if [[ "$jujuver" < "2" ]]; then - adminPasswd=$(juju get keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null) - else - adminPasswd=$(juju config keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null) - fi + adminPasswd=$(juju config keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null) v3api=`juju config keystone preferred-api-version` |