2 #placeholder for deployment script.
5 # ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro
15 if [[ "$opnfvmodel" = "openstack" ]]; then
16 #copy and download charms
17 ./$opnfvsdn/fetch-charms.sh $opnfvdistro
20 ./kubernetes/fetch-charms.sh $opnfvdistro
23 #check whether charms are still executing the code even juju-deployer says installed.
30 echo -n "executing the reltionship within charms ."
31 while [ $retval -eq 0 ]; do
32 if juju status | grep -q $waitstatus; then
34 if [ $timeoutiter -ge $waittime ]; then
40 timeoutiter=$((timeoutiter+1))
46 echo "...... deployment finishing ......."
49 #read the value from deployconfig.yaml
52 MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //')
53 API_SERVERMAAS="http://$MAAS_IP:5240/MAAS/"
54 API_KEY=`sudo maas-region apikey --username=ubuntu || true`
56 if [[ "$API_KEY" = "" ]]; then
57 API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'`
60 maas login $PROFILE $API_SERVERMAAS $API_KEY
62 if [[ "$opnfvmodel" = "openstack" ]]; then
63 if [ -e ./deployconfig.yaml ]; then
64 extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '`
65 datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
66 cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
67 admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
68 osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
71 workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
73 for v in ${workmutiple[@]}; do
74 if (( $v > $max )); then max=$v; fi;
78 if [ "$max" -lt 4 ];then
80 elif [ "$max" -lt 33 ]; then
82 elif [ "$max" -lt 73 ]; then
87 sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml
89 if [ "$opnfvlab" != "default" ]; then
90 sed -i "s/cpu_pin_set: all/cpu_pin_set: 2-${max},^${max}/g" default_deployment_config.yaml
92 sed -i "s/cpu_pin_set: all/cpu_pin_set: 1/g" default_deployment_config.yaml
95 cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
100 sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
101 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
104 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
108 # lets put the if separator as "," as this will save me from world.
111 for feature in $opnfvfeature; do
112 if [ "$fea" == "" ]; then
119 if [[ "$opnfvmodel" = "openstack" ]]; then
120 #update source if trusty is target distribution
121 var=os-$opnfvsdn-$fea-$opnfvtype"-"$opnfvdistro"_"$openstack
124 var=k8-$opnfvsdn-$fea-baremetal-core
127 if [[ "$opnfvmodel" = "openstack" ]]; then
128 #lets generate the bundle for all target using genBundle.py
129 python genBundle.py -l deployconfig.yaml -s $var > bundles.yaml
131 #lets generate the bundle for k8 target using genK8Bundle.py
132 python genK8Bundle.py -l deployconfig.yaml -s $var > bundles.yaml
135 #keep the back in cloud for later debugging.
136 pastebinit bundles.yaml || true
138 # with JUJU 2.0 bundles has to be deployed only once.
139 juju deploy bundles.yaml --debug
141 check_status allocating 220
143 # need to revisit later if not needed we will remove the below.
145 # seeing issue related to number of open files.
146 count=`juju status nodes --format=short | grep nodes | wc -l`
148 while [ $c -lt $count ]; do
149 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
150 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
151 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
152 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
157 if [ "$opnfvsdn" = "ocl" ]
159 TAG="ubuntu16.04-4.1.1.0-103.tar.gz"
161 for ROLE in contrail-controller contrail-analytics contrail-analyticsdb
163 FILE="${ROLE}-${TAG}"
166 curl -o $FILE http://artifacts.opnfv.org/ovno/containers/$FILE
168 juju attach $ROLE ${ROLE}="./$FILE"
171 #lets gather the status of deployment once juju-deployer completed.
172 juju status --format=tabular