Merge "Remove -a build flag"
[multicloud/k8s.git] / kud / tests / vFW / sink
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -o nounset
12 set -o pipefail
13 set -o xtrace
14 set -o errexit
15
16 # install_dependencies() - Install required dependencies
17 function install_dependencies {
18     apt-get update
19     apt install -y wget darkstat net-tools
20
21     # Configure and run Darkstat
22     sed -i "s/START_DARKSTAT=.*/START_DARKSTAT=yes/g;s/INTERFACE=.*/INTERFACE=\"-i eth1\"/g" /etc/darkstat/init.cfg
23
24     systemctl restart darkstat
25 }
26
27 # install_vfw_scripts() -
28 function install_vfw_scripts {
29     pushd /opt
30     wget -q https://git.onap.org/demo/plain/vnfs/vFW/scripts/{v_sink_init,vsink}.sh
31     chmod +x *.sh
32
33     mv vsink.sh /etc/init.d
34     update-rc.d vsink.sh defaults
35     systemctl start sink
36     popd
37 }
38
39 mkdir -p /opt/config/
40 echo "$protected_net_cidr"         > /opt/config/protected_net_cidr.txt
41 echo "$vfw_private_ip_0"           > /opt/config/fw_ipaddr.txt
42 echo "$vsn_private_ip_0"           > /opt/config/sink_ipaddr.txt
43 echo "$demo_artifacts_version"     > /opt/config/demo_artifacts_version.txt
44 echo "$protected_net_gw"           > /opt/config/protected_net_gw.txt
45 echo "$protected_private_net_cidr" > /opt/config/unprotected_net.txt
46
47 install_dependencies
48 install_vfw_scripts