modified for right syntax.
[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 case "$3" in
33     'orangepod1' )
34         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
35          sed -i -- 's/10.4.1.1/192.168.1.2/g' ./bundles.yaml
36         # choose the correct interface to use for data network
37          sed -i -- 's/#os-data-network: 10.4.8.0\/21/os-data-network: 192.168.11.0\/24/g' ./bundles.yaml
38         # Choose the external port to go out from gateway to use.
39          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
40         # Use host for public API for Orange pod2
41         # sed -i -- 's/#os-public-hostname: api.public-fqdn/os-public-hostname: api.pod2.opnfv.fr/g' ./bundles.yaml
42          ;;
43     'orangepod2' )
44         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
45          sed -i -- 's/10.4.1.1/192.168.2.2/g' ./bundles.yaml
46         # choose the correct interface to use for data network
47          sed -i -- 's/#os-data-network: 10.4.8.0\/21/os-data-network: 192.168.12.0\/24/g' ./bundles.yaml
48         # Choose the external port to go out from gateway to use.
49          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
50         # Use host for public API for Orange pod2
51         # sed -i -- 's/#os-public-hostname: api.public-fqdn/os-public-hostname: api.pod2.opnfv.fr/g' ./bundles.yaml
52          ;;
53      'intelpod9' )
54         # As per your lab vip address list be deafult uses 10.9.1.11 - 10.9.1.20
55          sed -i -- 's/10.4.1.1/10.9.1.2/g' ./bundles.yaml
56         # choose the correct interface to use for data network
57          sed -i -- 's/#os-data-network: 10.4.8.0\/21/os-data-network: 10.9.12.0\/24/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.905"/g' ./bundles.yaml
60         # Provide the gateway MAC to route the traffic externally.
61          sed -i -- 's/#gateway-mac: "default"/gateway-mac: "default"/g' ./bundles.yaml
62          ;;
63      'intelpod6' )
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.6.1.2/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: 10.6.12.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: "eth5"/g' ./bundles.yaml
70         # Provide the gateway MAC to route the traffic externally.
71          sed -i -- 's/#gateway-mac: "default"/gateway-mac: "default"/g' ./bundles.yaml
72          ;;
73      'intelpod5' )
74         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
75          sed -i -- 's/10.4.1.1/10.5.1.2/g' ./bundles.yaml
76         # choose the correct interface to use for data network
77          sed -i -- 's/#os-data-network: 10.4.8.0\/21/os-data-network: 10.5.12.0\/24/g' ./bundles.yaml
78         # Choose the external port to go out from gateway to use.
79          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth5"/g' ./bundles.yaml
80         # Provide the gateway MAC to route the traffic externally.
81          sed -i -- 's/#gateway-mac: "default"/gateway-mac: "default"/g' ./bundles.yaml
82         ;;
83      'attvirpod1' )
84         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
85          sed -i -- 's/10.4.1.1/192.168.10.1/g' ./bundles.yaml
86         # Choose the external port to go out from gateway to use.
87          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
88         ;;
89      'cengnlynxpod1' )
90         # Chose the hard drive(s) to use for CEPH OSD
91          sed -i -- 's|osd-devices: /srv|osd-devices: /dev/sdb|g' ./bundles.yaml
92         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
93          sed -i -- 's/10.4.1.1/10.120.0.1/g' ./bundles.yaml
94         # choose the correct interface to use for data network
95          sed -i -- 's/#os-data-network: 10.4.8.0\/21/os-data-network: 172.16.121.0\/24/g' ./bundles.yaml
96         # Choose the external port to go out from gateway to use.
97          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1.1202"/g' ./bundles.yaml
98         ;;
99      'juniperpod1' )
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
102          ;;
103      'ravellodemopod' )
104          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
105         ;;
106      'custom' )
107          sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml
108          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
109         ;;
110      'default' )
111          sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml
112          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
113         ;;
114 esac
115
116 # lets put the if seperateor as "," as this will save me from world.
117 IFS=","
118
119 for feature in $5; do
120     case "$feature" in
121         'ipv6' )
122              sed -i -- 's/#prefer-ipv6: true/prefer-ipv6: true/g' ./bundles.yaml
123             ;;
124         'dvr' )
125              sed -i -- 's/#enable-dvr: true/enable-dvr: true/g' ./bundles.yaml
126              sed -i -- 's/#l2-population: true/l2-population: true/g' ./bundles.yaml
127             ;;
128         'sfc' )
129              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-sfc"/g' ./bundles.yaml
130             ;;
131         'vpn' )
132              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-vpn"/g' ./bundles.yaml
133             ;;
134         'odl_l3' )
135              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-l3"/g' ./bundles.yaml
136             ;;
137         'dpdk' )
138              sed -i -- 's/#enable-dpdk: true/enable-dpdk: true/g' ./bundles.yaml
139              sed -i -- 's/#hugepages: "50%"/hugepages: "50%"/g' ./bundles.yaml
140             ;;
141         'lxd' )
142              sed -i -- 's/#- - nova-compute:lxd/- - nova-compute:lxd/g' ./bundles.yaml
143              sed -i -- 's/#- lxd:lxd/- lxd:lxd/g' ./bundles.yaml
144              sed -i -- 's/#virt-type: lxd/virt-type: lxd/g' ./bundles.yaml
145              # adding the lxd subordinate charm
146              echo "    lxd:" >> ./bundles.yaml
147              echo "      charm: local:xenial/lxd" >> ./bundles.yaml
148             ;;
149     esac
150 done
151
152 #changing the target to the openstack release we want to deploy.
153 sed -i -- "s|mitaka|$2|g" ./bundles.yaml
154
155 #update source if trusty is target distribution
156 case "$6" in
157     'trusty' )
158         sed -i -- "s|#source|source|g" ./bundles.yaml
159         ;;
160     'xenial' )
161         #changing the target to the ubuntu distro we want to deploy.
162         sed -i -- "s|trusty|$6|g" ./bundles.yaml
163         ;;
164 esac
165
166 echo "... Deployment Started ...."
167         juju-deployer -vW -d -t 3600 -c bundles.yaml $6-"$2"-nodes
168         juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $6-"$2"
169