5 #need to put mutiple cases here where decide this bundle to deploy by default use the odl bundle.
6 # Below parameters are the default and we can according the release
18 jujuver=`juju --version`
21 opnfvrel=`grep release: deploy.yaml | cut -d ":" -f2`
22 openstack=`grep openstack: deploy.yaml | cut -d ":" -f2`
23 opnfvtype=`grep type: deploy.yaml | cut -d ":" -f2`
24 opnfvlab=`grep lab: deploy.yaml | cut -d ":" -f2`
25 opnfvsdn=`grep sdn: deploy.yaml | cut -d ":" -f2`
28 usage() { echo "Usage: $0 [-s <nosdn|odl|opencontrail>]
31 [-l <default|intelpod5>]
32 [-f <ipv6,dpdk,lxd,dvr>]
35 [-m <openstack|kubernetes>]
36 [-r <a|b>]" 1>&2 exit 1; }
38 while getopts ":s:t:o:l:h:r:f:d:a:m:" opt; do
56 opnfvfeature=${OPTARG}
75 #by default maas creates two VMs in case of three more VM needed.
77 maas_ip=`grep " ip_address" deployconfig.yaml | cut -d " " -f 10`
78 apikey=`grep maas-oauth: environments.yaml | cut -d "'" -f 2`
79 maas login maas http://${maas_ip}/MAAS/api/1.0 ${apikey}
81 nodeexist=`maas maas nodes list hostname=node3-control`
83 if [ $nodeexist != *node3* ]; then
84 sudo virt-install --connect qemu:///system --name node3-control --ram 8192 --cpu host --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node3-control
86 sudo virt-install --connect qemu:///system --name node4-control --ram 8192 --cpu host --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node4-control
88 node3controlmac=`grep "mac address" node3-control | head -1 | cut -d "'" -f 2`
89 node4controlmac=`grep "mac address" node4-control | head -1 | cut -d "'" -f 2`
91 sudo virsh -c qemu:///system define --file node3-control
92 sudo virsh -c qemu:///system define --file node4-control
94 controlnodeid=`maas maas nodes new autodetect_nodegroup='yes' name='node3-control' tags='control' hostname='node3-control' power_type='virsh' mac_addresses=$node3controlmac power_parameters_power_address='qemu+ssh://'$USER'@192.168.122.1/system' architecture='amd64/generic' power_parameters_power_id='node3-control' | grep system_id | cut -d '"' -f 4 `
96 maas maas tag update-nodes control add=$controlnodeid
98 controlnodeid=`maas maas nodes new autodetect_nodegroup='yes' name='node4-control' tags='control' hostname='node4-control' power_type='virsh' mac_addresses=$node4controlmac power_parameters_power_address='qemu+ssh://'$USER'@192.168.122.1/system' architecture='amd64/generic' power_parameters_power_id='node4-control' | grep system_id | cut -d '"' -f 4 `
100 maas maas tag update-nodes control add=$controlnodeid
105 #copy the files and create extra resources needed for HA deployment
106 # in case of default VM labs.
108 if [[ "$jujuver" > "2" ]]; then
109 if [ ! -f ./labconfig.yaml ] && [ -e ~/joid_config/labconfig.yaml ]; then
110 cp ~/joid_config/labconfig.yaml ./labconfig.yaml
112 if [ ! -f ./deployconfig.yaml ] && [ -e ~/joid_config/deployconfig.yaml ]; then
113 cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml
115 python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml
118 echo " MAAS not deployed please deploy MAAS first."
121 if [ ! -f ./environments.yaml ] && [ -e ~/.juju/environments.yaml ]; then
122 cp ~/.juju/environments.yaml ./environments.yaml
123 elif [ ! -f ./environments.yaml ] && [ -e ~/joid_config/environments.yaml ]; then
124 cp ~/joid_config/environments.yaml ./environments.yaml
126 #copy the script which needs to get deployed as part of ofnfv release
127 echo "...... deploying now ......"
128 echo " " >> environments.yaml
129 echo " enable-os-refresh-update: false" >> environments.yaml
130 echo " enable-os-upgrade: false" >> environments.yaml
131 echo " admin-secret: admin" >> environments.yaml
132 echo " default-series: $opnfvdistro" >> environments.yaml
133 cp environments.yaml ~/.juju/
134 cp environments.yaml ~/joid_config/
137 if [[ "$opnfvtype" = "ha" && "$opnfvlab" = "default" ]]; then
144 if [[ "$jujuver" > "2" ]]; then
145 juju model-config default-series=$opnfvdistro enable-os-refresh-update=false enable-os-upgrade=false
148 #case default deploy the opnfv platform:
149 ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro $opnfvmodel
152 #check whether charms are still executing the code even juju-deployer says installed.
156 while [ $retval -eq 0 ]; do
158 juju status > status.txt
159 if [ "$(grep -c "executing" status.txt )" -ge 1 ]; then
160 echo " still executing the reltionship within charms ..."
161 if [ $timeoutiter -ge 120 ]; then
164 timeoutiter=$((timeoutiter+1))
170 if [[ "$opnfvmodel" = "openstack" ]]; then
171 juju expose ceph-radosgw || true
172 #juju ssh ceph/0 \ 'sudo radosgw-admin user create --uid="ubuntu" --display-name="Ubuntu Ceph"'
174 echo "...... deployment finishing ......."
177 echo "...... deployment started ......"
182 echo "...... deployment finished ......."
184 if [[ "$opnfvmodel" = "openstack" ]]; then
185 ./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true
187 # creating heat domain after puching the public API into /etc/hosts
189 if [[ "$jujuver" > "2" ]]; then
190 status=`juju run-action heat/0 domain-setup`
193 status=`juju action do heat/0 domain-setup`
198 sudo ../juju/get-cloud-images || true
199 ../juju/joid-configure-openstack || true
202 if [[ "$opnfvmodel" = "kubernetes" ]]; then
206 echo "...... finished ......."