remove the ext-port and data network dependency on the labs.
[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    extport=`grep "ext-port" deployment.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
35    sed --i "s@#ext-port: \"eth1\"@ext-port: \"$extport\"@g" ./bundles.yaml
36    datanet=`grep "dataNetwork" deployment.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
37    sed --i "s@#os-data-network: 10.4.8.0/21@os-data-network: $datanet@g" ./bundles.yaml
38    admnet=`grep "admNetwork" deployment.yaml | cut -d ' ' -f 4 | sed -e 's/ //'`
39    sed --i "s@10.4.1.1@$admnet@g" ./bundles.yaml
40 fi
41
42 case "$3" in
43      'intelpod9' )
44         # As per your lab vip address list be deafult uses 10.9.1.11 - 10.9.1.20
45          sed -i -- 's/10.4.1.1/10.9.1.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: 10.9.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.905"/g' ./bundles.yaml
50         # Provide the gateway MAC to route the traffic externally.
51          sed -i -- 's/#gateway-mac: "default"/gateway-mac: "default"/g' ./bundles.yaml
52          ;;
53      'attvirpod1' )
54         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
55          sed -i -- 's/10.4.1.1/192.168.10.1/g' ./bundles.yaml
56         # Choose the external port to go out from gateway to use.
57          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
58         ;;
59      'cengnlynxpod1' )
60         # Chose the hard drive(s) to use for CEPH OSD
61          sed -i -- 's|osd-devices: /srv|osd-devices: /dev/sdb|g' ./bundles.yaml
62         # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20
63          sed -i -- 's/10.4.1.1/10.120.0.1/g' ./bundles.yaml
64         # choose the correct interface to use for data network
65          sed -i -- 's/#os-data-network: 10.4.8.0\/21/os-data-network: 172.16.121.0\/24/g' ./bundles.yaml
66         # Choose the external port to go out from gateway to use.
67          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1.1202"/g' ./bundles.yaml
68         ;;
69      'juniperpod1' )
70          sed -i -- 's/10.4.1.1/172.16.50.1/g' ./bundles.yaml
71          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
72          ;;
73      'ravellodemopod' )
74          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth2"/g' ./bundles.yaml
75         ;;
76      'custom' )
77          sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml
78          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
79         ;;
80      'default' )
81          sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml
82          sed -i -- 's/#ext-port: "eth1"/ext-port: "eth1"/g' ./bundles.yaml
83         ;;
84 esac
85
86 # lets put the if seperateor as "," as this will save me from world.
87 IFS=","
88
89 for feature in $5; do
90     case "$feature" in
91         'ipv6' )
92              sed -i -- 's/#prefer-ipv6: true/prefer-ipv6: true/g' ./bundles.yaml
93             ;;
94         'dvr' )
95              sed -i -- 's/#enable-dvr: true/enable-dvr: true/g' ./bundles.yaml
96              sed -i -- 's/#l2-population: true/l2-population: true/g' ./bundles.yaml
97             ;;
98         'sfc' )
99              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-sfc"/g' ./bundles.yaml
100             ;;
101         'vpn' )
102              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-vpn"/g' ./bundles.yaml
103             ;;
104         'odl_l3' )
105              sed -i -- 's/profile: "openvswitch-odl-Be"/profile: "openvswitch-odl-beryllium-l3"/g' ./bundles.yaml
106             ;;
107         'dpdk' )
108              sed -i -- 's/#enable-dpdk: true/enable-dpdk: true/g' ./bundles.yaml
109              sed -i -- 's/#hugepages: "50%"/hugepages: "50%"/g' ./bundles.yaml
110             ;;
111         'lxd' )
112              sed -i -- 's/#- - nova-compute:lxd/- - nova-compute:lxd/g' ./bundles.yaml
113              sed -i -- 's/#- lxd:lxd/- lxd:lxd/g' ./bundles.yaml
114              sed -i -- 's/#virt-type: lxd/virt-type: lxd/g' ./bundles.yaml
115              # adding the lxd subordinate charm
116              echo "    lxd:" >> ./bundles.yaml
117              echo "      charm: local:xenial/lxd" >> ./bundles.yaml
118             ;;
119     esac
120 done
121
122 #changing the target to the openstack release we want to deploy.
123 sed -i -- "s|mitaka|$2|g" ./bundles.yaml
124
125 #update source if trusty is target distribution
126 case "$6" in
127     'trusty' )
128         sed -i -- "s|#source|source|g" ./bundles.yaml
129         ;;
130     'xenial' )
131         #changing the target to the ubuntu distro we want to deploy.
132         sed -i -- "s|trusty|$6|g" ./bundles.yaml
133         ;;
134 esac
135
136 echo "... Deployment Started ...."
137     juju-deployer -vW -d -t 3600 -c bundles.yaml $6-"$2"-nodes
138     juju-deployer -vW -d -t 7200 -r 5 -c bundles.yaml $6-"$2"
139