2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
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 ##############################################################################
16 # install_dependencies() - Install required dependencies
17 function install_dependencies {
19 apt-get install -y -qq wget openjdk-8-jre bridge-utils net-tools bsdmainutils
22 # install_vpp() - Install VPP
23 function install_vpp {
24 local RELEASE=".stable.1609"
27 apt-get install -y -qq apt-transport-https
28 echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$(lsb_release -c -s).main/ ./" | tee -a /etc/apt/sources.list.d/99fd.io.list
30 apt-get install -y -qq vpp vpp-lib vpp-plugins vpp-dpdk-dkms
34 local repo_url="https://nexus.onap.org/content/repositories/staging/org/onap/demo/vnf/"
37 wget -q -O tmp_file.tar.gz "${repo_url}/${file_subpath}"
38 sha1=$(wget ${repo_url}/${file_subpath}.sha1 -q -O -)
39 if [[ $(sha1sum tmp_file.tar.gz | awk '{print $1}') != "$sha1" ]]; then
40 echo "The downloaded file is corrupted"
43 tar -zmxf tmp_file.tar.gz
47 # install_vfw_scripts() -
48 function install_vfw_scripts {
49 local version=$(cat /opt/config/demo_artifacts_version.txt)
52 wget -q https://git.onap.org/demo/plain/vnfs/vFW/scripts/{v_packetgen_init,vpacketgen,run_traffic_fw_demo}.sh
55 _untar_url "sample-distribution/${version}/sample-distribution-${version}-hc.tar.gz"
56 mv sample-distribution-$version honeycomb
58 _untar_url "vfw/vfw_pg_streams/$version/vfw_pg_streams-$version-demo.tar.gz"
59 mv vfw_pg_streams-$version pg_streams
61 sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' /opt/honeycomb/config/honeycomb.json
63 # TODO(electrocucaracha) Fix it in upstream
64 sed -i 's/start vpp/systemctl start vpp/g' v_packetgen_init.sh
65 sed -i 's|/opt/honeycomb/sample-distribution-\$VERSION/honeycomb|/opt/honeycomb/honeycomb|g' v_packetgen_init.sh
66 mv vpacketgen.sh /etc/init.d/
67 update-rc.d vpacketgen.sh defaults
68 systemctl start packetgen
73 echo "$protected_net_cidr" > /opt/config/protected_net_cidr.txt
74 echo "$vfw_private_ip_0" > /opt/config/fw_ipaddr.txt
75 echo "$vsn_private_ip_0" > /opt/config/sink_ipaddr.txt
76 echo "$demo_artifacts_version" > /opt/config/demo_artifacts_version.txt
78 echo 'vm.nr_hugepages = 1024' >> /etc/sysctl.conf