summaryrefslogtreecommitdiffstats
path: root/vnfs
diff options
context:
space:
mode:
authorMarco Platania <platania@research.att.com>2018-03-21 10:11:32 -0400
committerMarco Platania <platania@research.att.com>2018-03-21 16:58:22 +0000
commitfe366e6d7ff18924cf33bd743e9674fa238f2b89 (patch)
treef54feae8c73e50a57f2cb7897147c2c018f0cd23 /vnfs
parent2b40259f1cfe6a52360e70f696d8efaeeb16d8fa (diff)
Add Heat templates and scripts for vLBMS
- Heat templates that install the vLBMS components - Installation scripts that install and configure the VNF components Change-Id: Ie1911a67b830d5543c96174fb915afd30d8daf0c Issue-ID: INT-447 Signed-off-by: Marco Platania <platania@research.att.com>
Diffstat (limited to 'vnfs')
-rw-r--r--vnfs/vLBMS/scripts/add_dns.sh23
-rw-r--r--vnfs/vLBMS/scripts/db_dnsdemo_onap_org24
-rw-r--r--vnfs/vLBMS/scripts/db_dnsdemo_openecomp_org24
-rw-r--r--vnfs/vLBMS/scripts/named.conf.local12
-rw-r--r--vnfs/vLBMS/scripts/named.conf.options39
-rw-r--r--vnfs/vLBMS/scripts/properties.conf4
-rw-r--r--vnfs/vLBMS/scripts/remove_dns.sh24
-rw-r--r--vnfs/vLBMS/scripts/run_health.sh10
-rw-r--r--vnfs/vLBMS/scripts/run_health_vdns.sh8
-rw-r--r--vnfs/vLBMS/scripts/run_streams.sh51
-rw-r--r--vnfs/vLBMS/scripts/set_gre_tunnel.sh15
-rw-r--r--vnfs/vLBMS/scripts/v_dns_init.sh5
-rw-r--r--vnfs/vLBMS/scripts/v_dns_install.sh109
-rw-r--r--vnfs/vLBMS/scripts/v_lb_init.sh84
-rw-r--r--vnfs/vLBMS/scripts/v_lb_install.sh127
-rw-r--r--vnfs/vLBMS/scripts/v_packetgen_init.sh102
-rw-r--r--vnfs/vLBMS/scripts/v_packetgen_install.sh107
-rw-r--r--vnfs/vLBMS/scripts/vdns.sh98
-rw-r--r--vnfs/vLBMS/scripts/vlb.sh98
-rw-r--r--vnfs/vLBMS/scripts/vpacketgen.sh99
20 files changed, 1063 insertions, 0 deletions
diff --git a/vnfs/vLBMS/scripts/add_dns.sh b/vnfs/vLBMS/scripts/add_dns.sh
new file mode 100644
index 00000000..63977635
--- /dev/null
+++ b/vnfs/vLBMS/scripts/add_dns.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+if [ ! "$#" -eq 1 ]
+then
+ echo "Usage: ./add_dns.sh [remote DNS server]"
+ exit
+fi
+
+DNS_IPADDR=$1
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
+GRE_IPADDR=$(cat /opt/config/gre_ipaddr.txt)
+
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR
+GRE=$(vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR)
+vppctl set int ip address $GRE $GRE_IPADDR"/32"
+vppctl set int state $GRE up
+
+# Update the number of vDNSs currently active
+FD="/opt/VES/evel/evel-library/code/VESreporting/active_dns.txt"
+CURR_DNS=$(cat $FD)
+let CURR_DNS=$CURR_DNS+1
+echo $CURR_DNS > $FD
diff --git a/vnfs/vLBMS/scripts/db_dnsdemo_onap_org b/vnfs/vLBMS/scripts/db_dnsdemo_onap_org
new file mode 100644
index 00000000..45da8164
--- /dev/null
+++ b/vnfs/vLBMS/scripts/db_dnsdemo_onap_org
@@ -0,0 +1,24 @@
+;
+; BIND data file for local loopback interface
+;
+$TTL 604800
+@ IN SOA dnsdemo.onap.org. admin.dnsdemo.onap.org. (
+ 3 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 604800 ) ; Negative Cache TTL
+; name servers - NS records
+ IN NS dnsdemo.onap.org.
+; name servers - A records
+dnsdemo.onap.org. IN A 10.0.100.100
+host1.dnsdemo.onap.org. IN A 10.0.100.101
+host2.dnsdemo.onap.org. IN A 10.0.100.102
+host3.dnsdemo.onap.org. IN A 10.0.100.103
+host4.dnsdemo.onap.org. IN A 10.0.100.104
+host5.dnsdemo.onap.org. IN A 10.0.100.105
+host6.dnsdemo.onap.org. IN A 10.0.100.106
+host7.dnsdemo.onap.org. IN A 10.0.100.107
+host8.dnsdemo.onap.org. IN A 10.0.100.108
+host9.dnsdemo.onap.org. IN A 10.0.100.109
+host10.dnsdemo.onap.org. IN A 10.0.100.110
diff --git a/vnfs/vLBMS/scripts/db_dnsdemo_openecomp_org b/vnfs/vLBMS/scripts/db_dnsdemo_openecomp_org
new file mode 100644
index 00000000..631614ac
--- /dev/null
+++ b/vnfs/vLBMS/scripts/db_dnsdemo_openecomp_org
@@ -0,0 +1,24 @@
+;
+; BIND data file for local loopback interface
+;
+$TTL 604800
+@ IN SOA dnsdemo.openecomp.org. admin.dnsdemo.openecomp.org. (
+ 3 ; Serial
+ 604800 ; Refresh
+ 86400 ; Retry
+ 2419200 ; Expire
+ 604800 ) ; Negative Cache TTL
+; name servers - NS records
+ IN NS dnsdemo.openecomp.org.
+; name servers - A records
+dnsdemo.openecomp.org. IN A 10.0.100.100
+host1.dnsdemo.openecomp.org. IN A 10.0.100.101
+host2.dnsdemo.openecomp.org. IN A 10.0.100.102
+host3.dnsdemo.openecomp.org. IN A 10.0.100.103
+host4.dnsdemo.openecomp.org. IN A 10.0.100.104
+host5.dnsdemo.openecomp.org. IN A 10.0.100.105
+host6.dnsdemo.openecomp.org. IN A 10.0.100.106
+host7.dnsdemo.openecomp.org. IN A 10.0.100.107
+host8.dnsdemo.openecomp.org. IN A 10.0.100.108
+host9.dnsdemo.openecomp.org. IN A 10.0.100.109
+host10.dnsdemo.openecomp.org. IN A 10.0.100.110
diff --git a/vnfs/vLBMS/scripts/named.conf.local b/vnfs/vLBMS/scripts/named.conf.local
new file mode 100644
index 00000000..94f8ad29
--- /dev/null
+++ b/vnfs/vLBMS/scripts/named.conf.local
@@ -0,0 +1,12 @@
+//
+// Do any local configuration here
+//
+
+// Consider adding the 1918 zones here, if they are not used in your
+// organization
+//include "/etc/bind/zones.rfc1918";
+
+zone "dnsdemo.onap.org" {
+ type master;
+ file "/etc/bind/zones/db.dnsdemo.onap.org"; # zone file path
+};
diff --git a/vnfs/vLBMS/scripts/named.conf.options b/vnfs/vLBMS/scripts/named.conf.options
new file mode 100644
index 00000000..1daa65c3
--- /dev/null
+++ b/vnfs/vLBMS/scripts/named.conf.options
@@ -0,0 +1,39 @@
+acl "trusted" {
+ x.x.x.x;
+};
+options {
+ directory "/var/cache/bind";
+
+ recursion no; # enables recursive queries
+ allow-recursion { trusted; }; # allows recursive queries from "trusted” clients i.e. LB only
+ listen-on { x.x.x.x; }; # ns1 IP address - listen on this address only
+ allow-transfer { none; }; # disable zone transfers by default
+
+ forwarders {
+ 8.8.8.8;
+ 8.8.4.4;
+ };
+
+
+ // If there is a firewall between you and nameservers you want
+ // to talk to, you may need to fix the firewall to allow multiple
+ // ports to talk. See http://www.kb.cert.org/vuls/id/800113
+
+ // If your ISP provided one or more IP addresses for stable
+ // nameservers, you probably want to use them as forwarders.
+ // Uncomment the following block, and insert the addresses replacing
+ // the all-0's placeholder.
+
+ // forwarders {
+ // 0.0.0.0;
+ // };
+
+ //========================================================================
+ // If BIND logs error messages about the root key being expired,
+ // you will need to update your keys. See https://www.isc.org/bind-keys
+ //========================================================================
+ dnssec-validation auto;
+
+ auth-nxdomain no; # conform to RFC1035
+ listen-on-v6 { any; };
+};
diff --git a/vnfs/vLBMS/scripts/properties.conf b/vnfs/vLBMS/scripts/properties.conf
new file mode 100644
index 00000000..03c54699
--- /dev/null
+++ b/vnfs/vLBMS/scripts/properties.conf
@@ -0,0 +1,4 @@
+script=/opt/run_health.sh
+output=status.txt
+vnfc=vLB
+primary=true
diff --git a/vnfs/vLBMS/scripts/remove_dns.sh b/vnfs/vLBMS/scripts/remove_dns.sh
new file mode 100644
index 00000000..1f6c6562
--- /dev/null
+++ b/vnfs/vLBMS/scripts/remove_dns.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [ ! "$#" -eq 1 ]
+then
+ echo "Usage: ./remove_dns.sh [remote DNS server]"
+ exit
+fi
+
+DNS_IPADDR=$1
+IP_TO_PKTGEN_NET=$(cat /opt/config/ip_to_pktgen_net.txt)
+IP_TO_DNS_NET=$(cat /opt/config/ip_to_dns_net.txt)
+
+vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR del
+vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR del
+
+# Update the number of vDNSs currently active
+FD="/opt/VES/evel/evel-library/code/VESreporting/active_dns.txt"
+CURR_DNS=$(cat $FD)
+let CURR_DNS=$CURR_DNS-1
+if [[ $CURR_DNS -lt 0 ]]
+then
+ CURR_DNS=0
+fi
+echo $CURR_DNS > $FD
diff --git a/vnfs/vLBMS/scripts/run_health.sh b/vnfs/vLBMS/scripts/run_health.sh
new file mode 100644
index 00000000..ed3b0423
--- /dev/null
+++ b/vnfs/vLBMS/scripts/run_health.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+SERVICE=$(cat /opt/config/service.txt)
+
+PID=$(pgrep $SERVICE)
+if [[ -z $PID ]]; then
+ echo "unhealthy" > status.txt
+else
+ echo "healthy" > status.txt
+fi
diff --git a/vnfs/vLBMS/scripts/run_health_vdns.sh b/vnfs/vLBMS/scripts/run_health_vdns.sh
new file mode 100644
index 00000000..8851fa98
--- /dev/null
+++ b/vnfs/vLBMS/scripts/run_health_vdns.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+PID=$(service bind9 status | grep active)
+if [[ -z $PID ]]; then
+ echo "unhealthy" > status.txt
+else
+ echo "healthy" > status.txt
+fi
diff --git a/vnfs/vLBMS/scripts/run_streams.sh b/vnfs/vLBMS/scripts/run_streams.sh
new file mode 100644
index 00000000..86f97b2e
--- /dev/null
+++ b/vnfs/vLBMS/scripts/run_streams.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+#Disable all the running streams
+vppctl packet-gen disable
+
+#Initial configuration: run only two streams
+vppctl packet-gen enable-stream dns1
+vppctl packet-gen enable-stream dns2
+
+sleep 180
+
+#Rehash port numbers and re-run five streams every minute
+while true; do
+ vppctl packet-gen disable
+ vppctl pac del dns1
+ vppctl pac del dns2
+ vppctl pac del dns3
+ vppctl pac del dns4
+ vppctl pac del dns5
+
+ #Update destination (vLB) IP
+ VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
+ IPADDR1=$(cat /opt/config/local_private_ipaddr.txt)
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
+ sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
+
+ #Update source ports (make them random)
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
+ sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
+
+ vppctl exec /opt/dns_streams/stream_dns1
+ vppctl exec /opt/dns_streams/stream_dns2
+ vppctl exec /opt/dns_streams/stream_dns3
+ vppctl exec /opt/dns_streams/stream_dns4
+ vppctl exec /opt/dns_streams/stream_dns5
+
+ #Resume stream execution
+ vppctl packet-gen enable-stream dns1
+ vppctl packet-gen enable-stream dns2
+ vppctl packet-gen enable-stream dns3
+ vppctl packet-gen enable-stream dns4
+ vppctl packet-gen enable-stream dns5
+
+ sleep 60
+done
diff --git a/vnfs/vLBMS/scripts/set_gre_tunnel.sh b/vnfs/vLBMS/scripts/set_gre_tunnel.sh
new file mode 100644
index 00000000..186a00d9
--- /dev/null
+++ b/vnfs/vLBMS/scripts/set_gre_tunnel.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+LB_PUBLIC_IP=$(cat /opt/config/lb_public_ipaddr.txt)
+LB_PRIVATE_IP=$(cat /opt/config/lb_private_ipaddr.txt)
+MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt)
+
+sed -i "s/x.x.x.x/"$LB_PUBLIC_IP"/g" /etc/bind/named.conf.options
+
+ip tunnel add gre123 mode gre remote $LB_PRIVATE_IP local $MY_PRIVATE_IP ttl 255
+ip link set gre123 up
+ip addr add $LB_PUBLIC_IP"/32" dev gre123
+route add default dev gre123
+ifconfig eth0 down
+
+service bind9 restart
diff --git a/vnfs/vLBMS/scripts/v_dns_init.sh b/vnfs/vLBMS/scripts/v_dns_init.sh
new file mode 100644
index 00000000..f891eb6e
--- /dev/null
+++ b/vnfs/vLBMS/scripts/v_dns_init.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+cd /opt
+./vlb-vnf-onap-distribution-$(cat /opt/config/demo_artifacts_version.txt)-SNAPSHOT/honeycomb &>/var/log/honeycomb.log &disown
+./set_gre_tunnel.sh
diff --git a/vnfs/vLBMS/scripts/v_dns_install.sh b/vnfs/vLBMS/scripts/v_dns_install.sh
new file mode 100644
index 00000000..38860e8e
--- /dev/null
+++ b/vnfs/vLBMS/scripts/v_dns_install.sh
@@ -0,0 +1,109 @@
+#!/bin/bash
+
+REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
+REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
+DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
+INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
+CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
+
+# Convert Network CIDR to Netmask
+cdr2mask () {
+ # Number of args to shift, 255..255, first non-255 byte, zeroes
+ set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+ [ $1 -gt 1 ] && shift $1 || shift
+ echo ${1-0}.${2-0}.${3-0}.${4-0}
+}
+
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+ echo 127.0.0.1 $(hostname) >> /etc/hosts
+
+ # Allow remote login as root
+ mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
+ cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
+
+ MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
+
+ IP=$(cat /opt/config/local_private_ipaddr.txt)
+ BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth1" >> /etc/network/interfaces
+ echo "iface eth1 inet static" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /etc/network/interfaces
+
+ IP=$(cat /opt/config/oam_private_ipaddr.txt)
+ BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth2" >> /etc/network/interfaces
+ echo "iface eth2 inet static" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /etc/network/interfaces
+fi
+
+# Download required dependencies
+echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
+echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
+apt-get update
+apt-get install --allow-unauthenticated -y wget openjdk-8-jdk bind9 bind9utils bind9-doc apt-transport-https ca-certificates maven
+sleep 1
+
+# Download vDNS demo code for DNS Server
+cd /opt
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/v_dns_init.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/vdns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/set_gre_tunnel.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/properties.conf -O /opt/config/properties.conf
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_health_vdns.sh -O /opt/run_health.sh
+
+sed -i 's/primary=.*/primary=false/g' /opt/config/properties.conf
+sed -i 's/vnfc=.*/vnfc=vDNS/g' /opt/config/properties.conf
+
+mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=https://nexus.onap.org/content/repositories/snapshots -Dartifact=org.onap.demo.vnf.vlb:vlb-vnf-onap-distribution:$DEMO_ARTIFACTS_VERSION-SNAPSHOT:tar.gz:hc -Dtransitive=false -Ddest=.
+tar -zmxvf vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT-hc.tar.gz
+rm vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT.tar.gz
+sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+sed -i 's/"netconf-tcp-binding-address": "127.0.0.1",/"netconf-tcp-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+
+chmod +x v_dns_init.sh
+chmod +x vdns.sh
+chmod +x set_gre_tunnel.sh
+
+# Download Bind config files
+cd /opt/config
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/db_dnsdemo_onap_org
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/named.conf.options
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/named.conf.local
+
+echo "bind9" > service.txt
+
+# Configure Bind
+modprobe ip_gre
+mkdir /etc/bind/zones
+sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
+mv db_dnsdemo_onap_org /etc/bind/zones/db.dnsdemo.onap.org
+mv named.conf.options /etc/bind/
+mv named.conf.local /etc/bind/
+sleep 1
+
+# Run instantiation script
+cd /opt
+mv vdns.sh /etc/init.d
+update-rc.d vdns.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+ sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+ grub-mkconfig -o /boot/grub/grub.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+ echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+ echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+ reboot
+fi
+
+./v_dns_init.sh
diff --git a/vnfs/vLBMS/scripts/v_lb_init.sh b/vnfs/vLBMS/scripts/v_lb_init.sh
new file mode 100644
index 00000000..072d3ae2
--- /dev/null
+++ b/vnfs/vLBMS/scripts/v_lb_init.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+# Start VPP
+systemctl start vpp
+sleep 1
+
+# Compute the network CIDR from the Netmask
+mask2cidr() {
+ nbits=0
+ IFS=.
+ for dec in $1 ; do
+ case $dec in
+ 255) let nbits+=8;;
+ 254) let nbits+=7;;
+ 252) let nbits+=6;;
+ 248) let nbits+=5;;
+ 240) let nbits+=4;;
+ 224) let nbits+=3;;
+ 192) let nbits+=2;;
+ 128) let nbits+=1;;
+ 0);;
+ *) echo "Error: $dec is not recognized"; exit 1
+ esac
+ done
+ echo "$nbits"
+}
+
+IPADDR1_MASK=$(ifconfig eth3 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
+IPADDR2_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR2_CIDR=$(mask2cidr $IPADDR2_MASK)
+
+# Configure VPP for vPacketGenerator
+IPADDR1=$(ifconfig eth3 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+IPADDR2=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth3 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+HWADDR2=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
+PKTGEN_IPADDR=$(cat /opt/config/pktgen_ipaddr.txt)
+PKTGEN_MAC=$(cat /opt/config/pktgen_mac.txt)
+VIP=$(cat /opt/config/vip.txt)
+
+ifconfig eth3 down
+ifconfig eth3 hw ether $FAKE_HWADDR1
+ip addr flush dev eth3
+ifconfig eth3 up
+vppctl tap connect tappub hwaddr $HWADDR1
+vppctl set int ip address tap-0 $VIP"/"$IPADDR1_CIDR
+vppctl set int state tap-0 up
+brctl addbr br0
+brctl addif br0 tappub
+brctl addif br0 eth3
+ifconfig br0 up
+
+ifconfig eth1 down
+ifconfig eth1 hw ether $FAKE_HWADDR2
+ip addr flush dev eth1
+ifconfig eth1 up
+vppctl tap connect tap111 hwaddr $HWADDR2
+vppctl set int ip address tap-1 $IPADDR2"/"$IPADDR2_CIDR
+vppctl set int state tap-1 up
+brctl addbr br1
+brctl addif br1 tap111
+brctl addif br1 eth1
+ifconfig br1 up
+sleep 1
+
+vppctl lb conf ip4-src-address $IPADDR2
+vppctl lb vip $IPADDR1"/32" encap gre4
+sleep 1
+
+vppctl set ip arp proxy $IPADDR1" - "$IPADDR1
+vppctl set interface proxy-arp tap-0 enable
+vppctl set ip arp tap-0 $PKTGEN_IPADDR $PKTGEN_MAC
+
+# Start Honeycomb and VES client
+cd /opt
+./vlb-vnf-onap-distribution-$(cat /opt/config/demo_artifacts_version.txt)-SNAPSHOT/honeycomb &>/var/log/honeycomb.log &disown
+
+cd /opt/VES/evel/evel-library/code/VESreporting/
+echo 0 > active_dns.txt
+./go-client.sh &>/dev/null &disown
diff --git a/vnfs/vLBMS/scripts/v_lb_install.sh b/vnfs/vLBMS/scripts/v_lb_install.sh
new file mode 100644
index 00000000..afcb0811
--- /dev/null
+++ b/vnfs/vLBMS/scripts/v_lb_install.sh
@@ -0,0 +1,127 @@
+#/bin/bash
+
+REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
+REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
+DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
+INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
+CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
+
+# Convert Network CIDR to Netmask
+cdr2mask () {
+ # Number of args to shift, 255..255, first non-255 byte, zeroes
+ set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+ [ $1 -gt 1 ] && shift $1 || shift
+ echo ${1-0}.${2-0}.${3-0}.${4-0}
+}
+
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+ echo 127.0.0.1 $(hostname) >> /etc/hosts
+
+ # Allow remote login as root
+ mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
+ cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
+
+ MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
+
+ IP=$(cat /opt/config/ip_to_dns_net.txt)
+ BITS=$(cat /opt/config/vlb_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth1" >> /etc/network/interfaces
+ echo "iface eth1 inet static" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /etc/network/interfaces
+
+ IP=$(cat /opt/config/oam_private_ipaddr.txt)
+ BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth2" >> /etc/network/interfaces
+ echo "iface eth2 inet static" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /etc/network/interfaces
+
+ IP=$(cat /opt/config/ip_to_pktgen_net.txt)
+ BITS=$(cat /opt/config/pktgen_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth3" >> /etc/network/interfaces
+ echo "iface eth3 inet static" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /etc/network/interfaces
+fi
+
+# Download required dependencies
+echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
+echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
+apt-get update
+apt-get install --allow-unauthenticated -y make gcc wget openjdk-8-jdk bridge-utils libcurl4-openssl-dev apt-transport-https ca-certificates maven
+sleep 1
+
+# Download vLB demo code for load balancer
+cd /opt
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/v_lb_init.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/vlb.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/add_dns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/remove_dns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/properties.conf -O /opt/config/properties.conf
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_health.sh
+wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/ves5/ves/$DEMO_ARTIFACTS_VERSION/ves-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/ves5/ves_vlb_reporting/$DEMO_ARTIFACTS_VERSION/ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+
+tar -zmxvf ves-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+mv ves-$DEMO_ARTIFACTS_VERSION VES
+tar -zmxvf ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+mv ves_vlb_reporting-$DEMO_ARTIFACTS_VERSION VESreporting_vLB
+mv VESreporting_vLB /opt/VES/evel/evel-library/code/VESreporting
+
+mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=https://nexus.onap.org/content/repositories/snapshots -Dartifact=org.onap.demo.vnf.vlb:vlb-vnf-onap-distribution:$DEMO_ARTIFACTS_VERSION-SNAPSHOT:tar.gz:hc -Dtransitive=false -Ddest=.
+tar -zmxvf vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT-hc.tar.gz
+sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+sed -i 's/"netconf-tcp-binding-address": "127.0.0.1",/"netconf-tcp-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+
+rm *.tar.gz
+
+chmod +x v_lb_init.sh
+chmod +x vlb.sh
+chmod +x /opt/VES/evel/evel-library/code/VESreporting/go-client.sh
+chmod +x add_dns.sh
+chmod +x remove_dns.sh
+
+echo "vpp" > config/service.txt
+
+# Install VPP
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
+rm /etc/apt/sources.list.d/99fd.io.list
+echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | tee -a /etc/apt/sources.list.d/99fd.io.list
+apt-get update
+apt-get install -y vpp vpp-dpdk-dkms vpp-lib vpp-dbg vpp-plugins vpp-dev
+sleep 1
+
+# Install VES
+cd /opt/VES/evel/evel-library/bldjobs/
+make clean
+make
+sleep 1
+
+# Run instantiation script
+cd /opt
+mv vlb.sh /etc/init.d
+update-rc.d vlb.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+ sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+ grub-mkconfig -o /boot/grub/grub.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+ echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+ echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+ reboot
+fi
+
+./v_lb_init.sh
diff --git a/vnfs/vLBMS/scripts/v_packetgen_init.sh b/vnfs/vLBMS/scripts/v_packetgen_init.sh
new file mode 100644
index 00000000..30707f0a
--- /dev/null
+++ b/vnfs/vLBMS/scripts/v_packetgen_init.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+# Start VPP
+systemctl start vpp
+sleep 1
+
+# Compute the network CIDR from the Netmask
+mask2cidr() {
+ nbits=0
+ IFS=.
+ for dec in $1 ; do
+ case $dec in
+ 255) let nbits+=8;;
+ 254) let nbits+=7;;
+ 252) let nbits+=6;;
+ 248) let nbits+=5;;
+ 240) let nbits+=4;;
+ 224) let nbits+=3;;
+ 192) let nbits+=2;;
+ 128) let nbits+=1;;
+ 0);;
+ *) echo "Error: $dec is not recognized"; exit 1
+ esac
+ done
+ echo "$nbits"
+}
+
+IPADDR1_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
+IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
+
+# Configure VPP for vPacketGenerator
+IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+HWADDR1=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
+FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
+VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
+VLB_MAC=$(cat /opt/config/vlb_mac.txt)
+GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
+
+ifconfig eth1 down
+ifconfig eth1 hw ether $FAKE_HWADDR1
+ip addr flush dev eth1
+ifconfig eth1 up
+vppctl tap connect tap111 hwaddr $HWADDR1
+vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
+vppctl set int state tap-0 up
+brctl addbr br0
+brctl addif br0 tap111
+brctl addif br0 eth1
+ifconfig br0 up
+vppctl ip route add 0.0.0.0/0 via $GW
+sleep 1
+
+# Set br0 with public IP and valid MAC so that Linux will have public network access
+ifconfig br0 hw ether $HWADDR1
+ifconfig br0 $IPADDR1 netmask $IPADDR1_MASK
+route add default gw $GW
+sleep 1
+vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
+
+# Install packet streams
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns6
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns7
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns8
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns9
+sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns10
+
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns6
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns7
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns8
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns9
+sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns10
+
+vppctl exec /opt/dns_streams/stream_dns1
+vppctl exec /opt/dns_streams/stream_dns2
+vppctl exec /opt/dns_streams/stream_dns3
+vppctl exec /opt/dns_streams/stream_dns4
+vppctl exec /opt/dns_streams/stream_dns5
+vppctl exec /opt/dns_streams/stream_dns6
+vppctl exec /opt/dns_streams/stream_dns7
+vppctl exec /opt/dns_streams/stream_dns8
+vppctl exec /opt/dns_streams/stream_dns9
+vppctl exec /opt/dns_streams/stream_dns10
+
+vppctl set int ip address pg0 $(cat /opt/config/pg_int.txt)"/"$IPADDR1_CIDR
+sleep 1
+
+# Start Honeycomb and enable traffic flows
+cd /opt
+./vlb-vnf-onap-distribution-$(cat /opt/config/demo_artifacts_version.txt)-SNAPSHOT/honeycomb &>/var/log/honeycomb.log &disown
+
+chmod +x run_streams_dns.sh
+./run_streams_dns.sh &>/dev/null &disown
diff --git a/vnfs/vLBMS/scripts/v_packetgen_install.sh b/vnfs/vLBMS/scripts/v_packetgen_install.sh
new file mode 100644
index 00000000..2f13fef2
--- /dev/null
+++ b/vnfs/vLBMS/scripts/v_packetgen_install.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
+REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
+DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
+INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
+CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
+
+# Convert Network CIDR to Netmask
+cdr2mask () {
+ # Number of args to shift, 255..255, first non-255 byte, zeroes
+ set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
+ [ $1 -gt 1 ] && shift $1 || shift
+ echo ${1-0}.${2-0}.${3-0}.${4-0}
+}
+
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+ echo 127.0.0.1 $(hostname) >> /etc/hosts
+
+ # Allow remote login as root
+ mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
+ cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
+
+ MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
+
+ IP=$(cat /opt/config/local_private_ipaddr.txt)
+ BITS=$(cat /opt/config/pktgen_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth1" >> /etc/network/interfaces
+ echo "iface eth1 inet static" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /etc/network/interfaces
+
+ IP=$(cat /opt/config/oam_private_ipaddr.txt)
+ BITS=$(cat /opt/config/onap_private_net_cidr.txt | cut -d"/" -f2)
+ NETMASK=$(cdr2mask $BITS)
+ echo "auto eth2" >> /etc/network/interfaces
+ echo "iface eth2 inet static" >> /etc/network/interfaces
+ echo " address $IP" >> /etc/network/interfaces
+ echo " netmask $NETMASK" >> /etc/network/interfaces
+ echo " mtu $MTU" >> /etc/network/interfaces
+fi
+
+# Download required dependencies
+echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
+echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
+apt-get update
+apt-get install --allow-unauthenticated -y make wget openjdk-8-jdk gcc libcurl4-openssl-dev python-pip bridge-utils apt-transport-https ca-certificates maven
+pip install jsonschema
+
+# Download vFirewall demo code for packet generator
+cd /opt
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/v_packetgen_init.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/vpacketgen.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_streams_dns.sh
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/properties.conf -O /opt/config/properties.conf
+wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlbms/$INSTALL_SCRIPT_VERSION/run_health.sh
+wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/vlb/vlb_dns_streams/$DEMO_ARTIFACTS_VERSION/vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+
+sed -i 's/primary=.*/primary=false/g' /opt/config/properties.conf
+sed -i 's/vnfc=.*/vnfc=vPacketGen/g' /opt/config/properties.conf
+
+tar -zmxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz
+mv vlb_dns_streams-$DEMO_ARTIFACTS_VERSION dns_streams
+
+mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DremoteRepositories=https://nexus.onap.org/content/repositories/snapshots -Dartifact=org.onap.demo.vnf.vlb:vlb-vnf-onap-distribution:$DEMO_ARTIFACTS_VERSION-SNAPSHOT:tar.gz:hc -Dtransitive=false -Ddest=.
+tar -zmxvf vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT-hc.tar.gz
+sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+sed -i 's/"netconf-tcp-binding-address": "127.0.0.1",/"netconf-tcp-binding-address": "0.0.0.0",/g' vlb-vnf-onap-distribution-$DEMO_ARTIFACTS_VERSION-SNAPSHOT/config/honeycomb.json
+
+rm *.tar.gz
+chmod +x v_packetgen_init.sh
+chmod +x vpacketgen.sh
+chmod +x run_streams_dns.sh
+
+echo "vpp" > config/service.txt
+
+# Install VPP
+export UBUNTU="xenial"
+export RELEASE=".stable.1707"
+rm /etc/apt/sources.list.d/99fd.io.list
+echo "deb [trusted=yes] https://nexus.fd.io/content/repositories/fd.io$RELEASE.ubuntu.$UBUNTU.main/ ./" | tee -a /etc/apt/sources.list.d/99fd.io.list
+apt-get update
+apt-get install -y vpp vpp-dpdk-dkms vpp-lib vpp-dbg vpp-plugins vpp-dev
+sleep 1
+
+# Run instantiation script
+cd /opt
+mv vpacketgen.sh /etc/init.d
+update-rc.d vpacketgen.sh defaults
+
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+ sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+ grub-mkconfig -o /boot/grub/grub.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+ echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+ echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+ reboot
+fi
+
+./v_packetgen_init.sh
diff --git a/vnfs/vLBMS/scripts/vdns.sh b/vnfs/vLBMS/scripts/vdns.sh
new file mode 100644
index 00000000..e3f6f111
--- /dev/null
+++ b/vnfs/vLBMS/scripts/vdns.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_dns_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/vnfs/vLBMS/scripts/vlb.sh b/vnfs/vLBMS/scripts/vlb.sh
new file mode 100644
index 00000000..5ab6c40e
--- /dev/null
+++ b/vnfs/vLBMS/scripts/vlb.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_lb_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/vnfs/vLBMS/scripts/vpacketgen.sh b/vnfs/vLBMS/scripts/vpacketgen.sh
new file mode 100644
index 00000000..1d00fd9c
--- /dev/null
+++ b/vnfs/vLBMS/scripts/vpacketgen.sh
@@ -0,0 +1,99 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./v_packetgen_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
+