xextended the external port to the 5 mac address in case gateway
[joid.git] / ci / 01-deploybundle.sh
1 #!/bin/bash
2 #placeholder for deployment script.
3 set -ex
4
5 #    ./01-deploybundle.sh $opnfvtype $openstack $opnfvlab $opnfvsdn $opnfvfeature $opnfvdistro
6
7     #copy and download charms
8     cp $4/fetch-charms.sh ./fetch-charms.sh
9     #modify the ubuntu series wants to deploy
10     sed -i -- "s|distro=trusty|distro=$6|g" ./fetch-charms.sh
11     sh ./fetch-charms.sh $6
12
13
14 case "$1" in
15     'nonha' )
16         cp $4/juju-deployer/ovs-$4-nonha.yaml ./bundles.yaml
17         ;;
18     'ha' )
19         cp $4/juju-deployer/ovs-$4-ha.yaml ./bundles.yaml
20         ;;
21     'tip' )
22         cp $4/juju-deployer/ovs-$4-tip.yaml ./bundles.yaml
23         cp common/source/* ./
24         sed -i -- "s|branch: master|branch: stable/$2|g" ./*.yaml
25         ;;
26     * )
27         cp $4/juju-deployer/ovs-$4-nonha.yaml ./bundles.yaml
28         ;;
29 esac
30
31
32 #read the value from deployment.yaml
33 if [ -e ~/.juju/deployment.yaml ]; then
34
35    cp ~/.juju/deployment.yaml ./deployment.yaml
36
37    if [ -e ~/.juju/deployment.yaml ]; then
38       cp ~/.juju/deployconfig.yaml ./deployconfig.yaml
39
40       extport=`grep "ext-port" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //' | tr ',' ' '`
41       sed --i "s@#ext-port: \"eth1\"@ext-port: \"$extport\"@g" ./bundles.yaml
42
43       datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
44       sed --i "s@#os-data-network: 10.4.8.0/21@os-data-network: $datanet@g" ./bundles.yaml
45
46       admnet=`grep "admNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
47       sed --i "s@10.4.1.1@$admnet@g" ./bundles.yaml
48
49       cephdisk=`grep "disk" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
50       sed --i "s@osd-devices: /srv@osd-devices: $cephdisk@g" ./bundles.yaml
51    fi
52 fi
53
54 case "$3" in
55      'attvirpod1' )
56         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
57          sed -i -- 's/10.4.1.1/192.168.10.1/g' ./bundles.yaml
58         # Choose the external port to go out from gateway to use.
59          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
60         ;;
61      'cengnlynxpod1' )
62         # Chose the hard drive(s) to use for CEPH OSD
63          sed -i -- 's|osd-devices: /srv|osd-devices: /dev/sdb|g' ./bundles.yaml
64         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
65          sed -i -- 's/10.4.1.1/10.120.0.1/g' ./bundles.yaml
66         # choose the correct interface to use for data network
67          sed -i -- 's/#os-data-network: 10.4.8.0\/21/os-data-network: 172.16.121.0\/24/g' ./bundles.yaml
68         # Choose the external port to go out from gateway to use.
69          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1.1202"/g' ./bundles.yaml
70         ;;
71      'juniperpod1' )
72          sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
73          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
74          ;;
75      'ravellodemopod' )
76          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
77         ;;
78      'default' )
79          sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml
80          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
81         ;;
82 esac
83
84 # lets put the if seperateor as "," as this will save me from world.
85 IFS=","
86
87 for feature in $5; do
88     case "$feature" in
89         'ipv6' )
90              sed -i -- 's/#prefer-ipv6: true/prefer-ipv6: true/g' ./bundles.yaml
91             ;;
92         'dvr' )
93              sed -i -- 's/#enable-dvr: true/enable-dvr: true/g' ./bundles.yaml
94              sed -i -- 's/#l2-population: true/l2-population: true/g' ./bundles.yaml
95             ;;
96         'sfc' )
97              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-sfc"/g' ./bundles.yaml
98             ;;
99         'vpn' )
100              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-vpn"/g' ./bundles.yaml
101             ;;
102         'odl_l3' )
103              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-l3"/g' ./bundles.yaml
104             ;;
105         'dpdk' )
106              sed -i -- 's/#enable-dpdk: true/enable-dpdk: true/g' ./bundles.yaml
107              sed -i -- 's/#hugepages: "50%"/hugepages: "50%"/g' ./bundles.yaml
108             ;;
109         'lxd' )
110              sed -i -- 's/#- - nova-compute:lxd/- - nova-compute:lxd/g' ./bundles.yaml
111              sed -i -- 's/#- lxd:lxd/- lxd:lxd/g' ./bundles.yaml
112              sed -i -- 's/#virt-type: lxd/virt-type: lxd/g' ./bundles.yaml
113              # adding the lxd subordinate charm
114              echo "    lxd:" >> ./bundles.yaml
115              echo "      charm: local:xenial/lxd" >> ./bundles.yaml
116             ;;
117     esac
118 done
119
120 #changing the target to the openstack release we want to deploy.
121 sed -i -- "s|mitaka|$2|g" ./bundles.yaml
122
123 #update source if trusty is target distribution
124 case "$6" in
125     'trusty' )
126         sed -i -- "s|#source|source|g" ./bundles.yaml
127         ;;
128     'xenial' )
129         #changing the target to the ubuntu distro we want to deploy.
130         sed -i -- "s|trusty|$6|g" ./bundles.yaml
131         ;;
132 esac
133
134 echo "... Deployment Started ...."
135     juju-deployer -vW -d -t 3600 -c bundles.yaml $6-"$2"-nodes
136     juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $6-"$2"
137