2 #placeholder for deployment script.
5 # ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro
15 jujuver=`juju --version`
16 maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'`
18 if [[ "$opnfvmodel" = "openstack" ]]; then
19 #copy and download charms
20 ./$opnfvsdn/fetch-charms.sh $opnfvdistro
23 ./kubernetes/fetch-charms.sh $opnfvdistro
26 #check whether charms are still executing the code even juju-deployer says installed.
32 echo -n "executing the reltionship within charms ."
33 while [ $retval -eq 0 ]; do
34 if juju status | grep -q $waitstatus; then
36 if [ $timeoutiter -ge 240 ]; then
42 timeoutiter=$((timeoutiter+1))
48 echo "...... deployment finishing ......."
51 #read the value from deployconfig.yaml
54 MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //')
55 API_SERVERMAAS="http://$MAAS_IP/MAAS/"
56 if [[ "$maasver" > "2" ]]; then
57 API_KEY=`sudo maas-region apikey --username=ubuntu || true`
59 API_KEY=`sudo maas-region-admin apikey --username=ubuntu || true`
63 if [[ "$API_KEY" = "" ]]; then
64 if [[ "$maasver" > "2" ]]; then
65 API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'`
67 API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region-admin apikey --username=ubuntu'`
71 maas login $PROFILE $API_SERVERMAAS $API_KEY
73 if [[ "$opnfvmodel" = "openstack" ]]; then
74 if [ -e ./deployconfig.yaml ]; then
75 extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '`
76 datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
77 admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
78 cephdisk=`grep "ceph-disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
79 osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
82 if [[ "$maasver" > "2" ]]; then
83 workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
85 workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
88 for v in ${workmutiple[@]}; do
89 if (( $v > $max )); then max=$v; fi;
93 if [ "$max" -lt 4 ];then
95 elif [ "$max" -lt 33 ]; then
97 elif [ "$max" -lt 73 ]; then
102 sed -i "s/worker_multiplier: 1.0/worker_multiplier: ${workmutiple}/g" default_deployment_config.yaml
104 if [ "$opnfvlab" != "default" ]; then
105 sed -i "s/cpu_pin_set: all/cpu_pin_set: 2-${max},^${max}/g" default_deployment_config.yaml
107 sed -i "s/cpu_pin_set: all/cpu_pin_set: 1/g" default_deployment_config.yaml
113 sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
114 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
117 sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
121 # lets put the if separator as "," as this will save me from world.
124 for feature in $opnfvfeature; do
125 if [ "$fea" == "" ]; then
132 if [[ "$opnfvmodel" = "openstack" ]]; then
133 #update source if trusty is target distribution
134 var=os-$opnfvsdn-$fea-$opnfvtype"-"$opnfvdistro"_"$openstack
136 if ([ $osdomname ] && [ $osdomname != "null" ] && [ $osdomname != "None"]); then
140 var=k8-$opnfvsdn-$fea-baremetal-core
143 if [[ "$opnfvmodel" = "openstack" ]]; then
144 #lets generate the bundle for all target using genBundle.py
145 python genBundle.py -l deployconfig.yaml -s $var > bundles.yaml
147 #lets generate the bundle for k8 target using genK8Bundle.py
148 python genK8Bundle.py -l deployconfig.yaml -s $var > bundles.yaml
151 #keep the back in cloud for later debugging.
152 pastebinit bundles.yaml || true
154 if [[ "$jujuver" < "2" ]]; then
155 echo "... Deployment Started ...."
156 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack"-nodes
157 count=`juju status nodes --format=short | grep nodes | wc -l`
159 while [ $c -lt $count ]; do
160 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
161 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
162 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
163 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
167 juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $opnfvdistro-"$openstack" || true
169 # with JUJU 2.0 bundles has to be deployed only once.
170 juju deploy bundles.yaml --debug
172 check_status allocating
173 # seeing issue related to number of open files.
174 count=`juju status nodes --format=short | grep nodes | wc -l`
176 while [ $c -lt $count ]; do
177 juju ssh nodes/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
178 juju ssh nodes-compute/$c 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p' || true
179 juju ssh nodes/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
180 juju ssh nodes-compute/$c 'echo 2048 | sudo tee /proc/sys/fs/inotify/max_user_instances' || true
185 if [ "$opnfvsdn" = "ocl" ]
187 ROLES="contrail-controller contrail-analytics contrail-analyticsdb"
188 TAG="ubuntu16.04-4.0.0.0-20.tar.gz"
192 FILE="${ROLE}-${TAG}"
195 curl -o $FILE http://artifacts.opnfv.org/ovno/containers/$FILE
197 juju attach $ROLE ${ROLE}="./$FILE"
200 #lets gather the status of deployment once juju-deployer completed.
201 juju status --format=tabular