summaryrefslogtreecommitdiffstats
path: root/vagrant/create_onap.sh
blob: e201d5004eb01f5126a392f50f7e75cd84f88459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
set -ex

source /vagrant/openrc
cp /demo/heat/OpenECOMP/* .

# Parameters used across all ONAP components
pub_net=$(openstack network list -f value|grep public | cut -f1 -d' ')
sed -i "s/public_net_id:.*/public_net_id: $pub_net/" onap_openstack.env
sed -i "s/ubuntu_1404_image:.*/ubuntu_1404_image: ubuntu1404/" onap_openstack.env
sed -i "s/ubuntu_1604_image:.*/ubuntu_1604_image: ubuntu1604/" onap_openstack.env
sed -i "s/flavor_small:.*/flavor_small: m1.small/" onap_openstack.env
sed -i "s/flavor_medium:.*/flavor_medium: m1.medium/" onap_openstack.env
sed -i "s/flavor_large:.*/flavor_large: m1.large/" onap_openstack.env
sed -i "s/flavor_xlarge:.*/flavor_xlarge: m1.xlarge/" onap_openstack.env
rm -rf onap onap.pub
ssh-keygen  -t rsa -N ''  -f onap
cp onap onap.pub /vagrant
pub_key=$(cat onap.pub)
sed -i "s,pub_key:.*,pub_key: $pub_key," onap_openstack.env
tenant=$(openstack project list -f value | grep " admin" | cut -f1 -d' ')
sed -i  "s/openstack_tenant_id:.*/openstack_tenant_id: $tenant/" onap_openstack.env
sed -i  "s/openstack_username:.*/openstack_username: admin/" onap_openstack.env
sed -i  "s/openstack_api_key:.*/openstack_api_key: apikey/" onap_openstack.env
sed -i  "s,horizon_url:.*,horizon_url: http://192.168.0.10/dashboard," onap_openstack.env
sed -i  "s,keystone_url:.*,keystone_url: http://192.168.0.10/identity/,"  onap_openstack.env

# Network parameters
sed -i  "s/external_dns:.*/external_dns: 8.8.8.8/" onap_openstack.env

openstack stack create -t onap_openstack.yaml -e onap_openstack.env ONAP

sleep 180
vms=$(grep "_vm:" onap_openstack.yaml | cut -f1 -d"_")
sudo rm -rf /vagrant/hosts
for vm in $vms
do
    ip=$(openstack server list --name $vm -f yaml | grep Networks | cut -f2 -d",")
    echo "$ip $vm.api.simpledemo.openecomp.org" >> /vagrant/hosts
done