vFW install scripts
[demo.git] / vnfs / vFW / scripts / v_sink_install.sh
1 #!/bin/bash
2
3 PROTECTED_NET_GW=$(cat /opt/config/protected_net_gw.txt)
4 UNPROTECTED_NET=$(cat /opt/config/unprotected_net.txt | cut -d'/' -f1)
5 REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
6 REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
7 DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
8 VSN_PRIVATE_IP_O=$(cat /opt/config/vsn_private_ip_0.txt)
9 VSN_PRIVATE_IP_1=$(cat /opt/config/vsn_private_ip_1.txt)
10 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
11
12
13 # Network configuration
14 if [[ $CLOUD_ENV == "openstack" ]]
15 then
16         echo 127.0.0.1 $(hostname) >> /etc/hosts
17
18         echo "auto eth1" >> /etc/network/interfaces
19         echo "iface eth1 inet static" >> /etc/network/interfaces
20         echo "    address $VSN_PRIVATE_IP_O" >> /etc/network/interfaces
21         echo "    netmask 255.255.255.0" >> /etc/network/interfaces
22
23         ifup eth1
24 fi
25
26 # Download required dependencies
27 add-apt-repository -y ppa:openjdk-r/ppa
28 apt-get update
29 apt-get install -y make wget openjdk-8-jdk apt-transport-https ca-certificates darkstat
30
31 # Configure and run darkstat
32 sed -i "s/START_DARKSTAT=.*/START_DARKSTAT=yes/g" /etc/darkstat/init.cfg
33 sed -i "s/INTERFACE=.*/INTERFACE=\"-i eth1\"/g" /etc/darkstat/init.cfg
34 /etc/init.d/darkstat start
35
36 # Download code for virtual sink
37 cd /opt
38 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vfw/$DEMO_ARTIFACTS_VERSION/v_sink_init.sh
39 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vfw/$DEMO_ARTIFACTS_VERSION/vsink.sh
40 chmod +x v_sink_init.sh
41 chmod +x vsink.sh
42
43 # Run instantiation script
44 mv vsink.sh /etc/init.d
45 update-rc.d vsink.sh defaults
46 ./v_sink_init.sh