+++ /dev/null
-03-maasdeploy.sh
\ No newline at end of file
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
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
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
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;
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
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/
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
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
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
#
# 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']
./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
cp $labfile ./labconfig.yaml
fi
- ./00-maasdeploy.sh custom
+ ./03-maasdeploy.sh custom
fi
fi
# 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
if ([ $opnfvsdn == "ocl" ]); 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
#
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
#
# 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']
#
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'
#
#
# 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']
opnfvdistro=$3
opnfvos=$4
-jujuver=`juju --version`
-
if [ -f ./deployconfig.yaml ];then
EXTERNAL_NETWORK=`grep floating-ip-range deployconfig.yaml | cut -d ' ' -f 4 `
## 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
}
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`