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 # TODO: make sure this function run with the same parameters used in 03-maasdeploy.sh
78 PROFILE=${PROFILE:-ubuntu}
79 MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //')
80 API_SERVER="http://$MAAS_IP/MAAS/api/2.0"
81 API_KEY=`sudo maas-region apikey --username=ubuntu`
82 maas login $PROFILE $API_SERVER $API_KEY
84 for node in node3-control node4-control
86 node_id=$(maas $PROFILE machines read | \
87 jq -r "select(.[].hostname == \"$node\")[0].system_id")
88 if [[ -z "$node_id" ]]; then
89 sudo virt-install --connect qemu:///system --name $node \
90 --ram 8192 --cpu host --vcpus 4 \
91 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default \
92 --network bridge=virbr0,model=virtio \
93 --network bridge=virbr0,model=virtio \
94 --boot network,hd,menu=off \
95 --noautoconsole --vnc --print-xml | tee _node.xml
96 node_mac=$(grep "mac address" _node.xml | head -1 | cut -d "'" -f 2)
97 sudo virsh -c qemu:///system define --file _node.xml
100 maas $PROFILE nodes new autodetect_nodegroup='yes' name=$node \
101 tags='control' hostname=$name power_type='virsh' \
102 mac_addresses=$node3controlmac \
103 power_parameters_power_address="qemu+ssh://$USER@192.168.122.1/system" \
104 architecture='amd64/generic' power_parameters_power_id='node3-control'
105 node_id=$(maas $PROFILE machines read | \
106 jq -r "select(.[].hostname == \"$node\")[0].system_id")
108 if [[ -z "$node_id" ]]; then
109 echo "Error: failed to create node $node ."
112 maas $PROFILE tag update-nodes control add=$node_id || true
116 #copy the files and create extra resources needed for HA deployment
117 # in case of default VM labs.
119 if [[ "$jujuver" > "2" ]]; then
120 if [ ! -f ./labconfig.yaml ] && [ -e ~/joid_config/labconfig.yaml ]; then
121 cp ~/joid_config/labconfig.yaml ./labconfig.yaml
123 if [ ! -f ./deployconfig.yaml ] && [ -e ~/joid_config/deployconfig.yaml ]; then
124 cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml
126 python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml
129 echo " MAAS not deployed please deploy MAAS first."
132 if [ ! -f ./environments.yaml ] && [ -e ~/.juju/environments.yaml ]; then
133 cp ~/.juju/environments.yaml ./environments.yaml
134 elif [ ! -f ./environments.yaml ] && [ -e ~/joid_config/environments.yaml ]; then
135 cp ~/joid_config/environments.yaml ./environments.yaml
137 #copy the script which needs to get deployed as part of ofnfv release
138 echo "...... deploying now ......"
139 echo " " >> environments.yaml
140 echo " enable-os-refresh-update: false" >> environments.yaml
141 echo " enable-os-upgrade: false" >> environments.yaml
142 echo " admin-secret: admin" >> environments.yaml
143 echo " default-series: $opnfvdistro" >> environments.yaml
144 cp environments.yaml ~/.juju/
145 cp environments.yaml ~/joid_config/
148 if [[ "$opnfvtype" = "ha" && "$opnfvlab" = "default" ]]; then
155 if [[ "$jujuver" > "2" ]]; then
156 juju model-config default-series=$opnfvdistro enable-os-refresh-update=false enable-os-upgrade=false
159 #case default deploy the opnfv platform:
160 ./02-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro $opnfvmodel
163 #check whether charms are still executing the code even juju-deployer says installed.
168 echo -n "executing the reltionship within charms ."
169 while [ $retval -eq 0 ]; do
171 if juju status | grep -q "executing"; then
173 if [ $timeoutiter -ge 120 ]; then
177 timeoutiter=$((timeoutiter+1))
184 if [[ "$opnfvmodel" = "openstack" ]]; then
185 juju expose ceph-radosgw || true
186 #juju ssh ceph/0 \ 'sudo radosgw-admin user create --uid="ubuntu" --display-name="Ubuntu Ceph"'
188 echo "...... deployment finishing ......."
191 echo "...... deployment started ......"
196 echo "...... deployment finished ......."
198 if [[ "$opnfvmodel" = "openstack" ]]; then
199 ./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true
201 # creating heat domain after puching the public API into /etc/hosts
203 if [[ "$jujuver" > "2" ]]; then
204 status=`juju run-action heat/0 domain-setup`
207 status=`juju action do heat/0 domain-setup`
212 sudo ../juju/get-cloud-images || true
213 ../juju/joid-configure-openstack || true
216 if [[ "$opnfvmodel" = "kubernetes" ]]; then
220 echo "...... finished ......."