diff options
Diffstat (limited to 'vnfs/vLB/scripts')
-rw-r--r-- | vnfs/vLB/scripts/.DS_Store | bin | 0 -> 8196 bytes | |||
-rw-r--r-- | vnfs/vLB/scripts/add_dns.sh | 21 | ||||
-rw-r--r-- | vnfs/vLB/scripts/db_dnsdemo_openecomp_org | 24 | ||||
-rw-r--r-- | vnfs/vLB/scripts/dnsclient.sh | 6 | ||||
-rw-r--r-- | vnfs/vLB/scripts/dnsmembership.sh | 5 | ||||
-rw-r--r-- | vnfs/vLB/scripts/named.conf.local | 12 | ||||
-rw-r--r-- | vnfs/vLB/scripts/named.conf.options | 39 | ||||
-rw-r--r-- | vnfs/vLB/scripts/remove_dns.sh | 24 | ||||
-rwxr-xr-x | vnfs/vLB/scripts/run_streams_dns.sh | 9 | ||||
-rw-r--r-- | vnfs/vLB/scripts/set_gre_tunnel.sh | 21 | ||||
-rwxr-xr-x | vnfs/vLB/scripts/v_dns_init.sh | 5 | ||||
-rwxr-xr-x | vnfs/vLB/scripts/v_lb_init.sh | 52 | ||||
-rw-r--r-- | vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh | 97 | ||||
-rw-r--r-- | vnfs/vLB/scripts/vdns.sh | 98 | ||||
-rw-r--r-- | vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh | 53 | ||||
-rw-r--r-- | vnfs/vLB/scripts/vlb.sh | 98 | ||||
-rw-r--r-- | vnfs/vLB/scripts/vpacketgenfordnsdemo.sh | 99 |
17 files changed, 663 insertions, 0 deletions
diff --git a/vnfs/vLB/scripts/.DS_Store b/vnfs/vLB/scripts/.DS_Store Binary files differnew file mode 100644 index 00000000..b7b2ad39 --- /dev/null +++ b/vnfs/vLB/scripts/.DS_Store diff --git a/vnfs/vLB/scripts/add_dns.sh b/vnfs/vLB/scripts/add_dns.sh new file mode 100644 index 00000000..04dfc771 --- /dev/null +++ b/vnfs/vLB/scripts/add_dns.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ ! "$#" -eq 1 ] +then + echo "Usage: ./add_dns.sh [remote DNS server]" + exit +fi + +DNS_IPADDR=$1 +MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt) +MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt) + +vppctl lb as $MY_PUBLIC_IP"/32" $DNS_IPADDR +GRE=$(vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR) +vppctl set int state $GRE up + +# Update the number of vDNSs currently active +FD="/opt/VES/code/evel_training/VESreporting/active_dns.txt" +CURR_DNS=$(cat $FD) +let CURR_DNS=$CURR_DNS+1 +echo $CURR_DNS > $FD diff --git a/vnfs/vLB/scripts/db_dnsdemo_openecomp_org b/vnfs/vLB/scripts/db_dnsdemo_openecomp_org new file mode 100644 index 00000000..631614ac --- /dev/null +++ b/vnfs/vLB/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/vLB/scripts/dnsclient.sh b/vnfs/vLB/scripts/dnsclient.sh new file mode 100644 index 00000000..1de11ed8 --- /dev/null +++ b/vnfs/vLB/scripts/dnsclient.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +LB_OAM_INT=$(cat /opt/config/lb_oam_int.txt) +PID=$(cat /opt/config/local_private_ipaddr.txt) + +java -jar dns-client-1.0.0.jar $PID $LB_OAM_INT 8888 10 0 diff --git a/vnfs/vLB/scripts/dnsmembership.sh b/vnfs/vLB/scripts/dnsmembership.sh new file mode 100644 index 00000000..073216b3 --- /dev/null +++ b/vnfs/vLB/scripts/dnsmembership.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt) + +java -jar dns-manager-1.0.0.jar $MY_PUBLIC_IP 8888 10 3 0 diff --git a/vnfs/vLB/scripts/named.conf.local b/vnfs/vLB/scripts/named.conf.local new file mode 100644 index 00000000..1b5c9f01 --- /dev/null +++ b/vnfs/vLB/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.openecomp.org" { + type master; + file "/etc/bind/zones/db.dnsdemo.openecomp.org"; # zone file path +}; diff --git a/vnfs/vLB/scripts/named.conf.options b/vnfs/vLB/scripts/named.conf.options new file mode 100644 index 00000000..1daa65c3 --- /dev/null +++ b/vnfs/vLB/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/vLB/scripts/remove_dns.sh b/vnfs/vLB/scripts/remove_dns.sh new file mode 100644 index 00000000..1d505abe --- /dev/null +++ b/vnfs/vLB/scripts/remove_dns.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +if [ ! "$#" -eq 1 ] +then + echo "Usage: ./add_dns.sh [remote DNS server]" + exit +fi + +DNS_IPADDR=$1 +MY_PUBLIC_IP=$(cat /opt/config/local_public_ipaddr.txt) +MY_PRIVATE_IP=$(cat /opt/config/local_private_ipaddr.txt) + +vppctl lb as $MY_PUBLIC_ID"/32" $DNS_IPADDR del +vppctl create gre tunnel src $MY_PRIVATE_IP dst $DNS_IPADDR del + +# Update the number of vDNSs currently active +FD="/opt/VES/code/evel_training/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/vLB/scripts/run_streams_dns.sh b/vnfs/vLB/scripts/run_streams_dns.sh new file mode 100755 index 00000000..4d4e5432 --- /dev/null +++ b/vnfs/vLB/scripts/run_streams_dns.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +vppctl packet-gen disable +vppctl packet-gen enable-stream dns1 +vppctl packet-gen enable-stream dns2 +sleep 300 +vppctl packet-gen enable-stream dns3 +vppctl packet-gen enable-stream dns4 +vppctl packet-gen enable-stream dns5 diff --git a/vnfs/vLB/scripts/set_gre_tunnel.sh b/vnfs/vLB/scripts/set_gre_tunnel.sh new file mode 100644 index 00000000..2fa6c64e --- /dev/null +++ b/vnfs/vLB/scripts/set_gre_tunnel.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ ! "$#" -eq 1 ] +then + echo "Usage: ./set_gre_tunnel.sh [LB public IP address]" + exit +fi + +LB_PUBLIC_IP=$1 +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"/24" dev gre123 +ifconfig eth0 down +route add default dev gre123 + +service bind9 restart diff --git a/vnfs/vLB/scripts/v_dns_init.sh b/vnfs/vLB/scripts/v_dns_init.sh new file mode 100755 index 00000000..51ddba75 --- /dev/null +++ b/vnfs/vLB/scripts/v_dns_init.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd /opt/FDclient +./dnsclient.sh &>/dev/null &disown +cd ~ diff --git a/vnfs/vLB/scripts/v_lb_init.sh b/vnfs/vLB/scripts/v_lb_init.sh new file mode 100755 index 00000000..d130c1ec --- /dev/null +++ b/vnfs/vLB/scripts/v_lb_init.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Start VPP +start vpp +sleep 1 + +# Configure VPP for vPacketGenerator +IPADDR1=$(ifconfig eth0 | 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 eth0 | 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 | grep default | awk '{print $2}') + +ifconfig eth0 down +ifconfig eth0 hw ether $FAKE_HWADDR1 +ip addr flush dev eth0 +ifconfig eth0 up +vppctl tap connect tappub hwaddr $HWADDR1 +vppctl set int ip address tap-0 $IPADDR1"/24" +vppctl set int state tap-0 up +brctl addbr br0 +brctl addif br0 tappub +brctl addif br0 eth0 +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"/24" +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 +vppctl ip route add 0.0.0.0/0 via $GW +sleep 1 + +cd /opt/FDserver +./dnsmembership.sh &>/dev/null &disown + +# Start VES client +cd /opt/VES/code/evel_training/VESreporting/ +echo 0 > active_dns.txt +./go-client.sh &>/dev/null &disown diff --git a/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh new file mode 100644 index 00000000..ba7f56ca --- /dev/null +++ b/vnfs/vLB/scripts/v_packetgen_for_dns_demo_init.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +# Start VPP +start vpp +sleep 1 + +# Configure VPP for vPacketGenerator +IPADDR1=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) +HWADDR1=$(ifconfig eth0 | 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) +GW=$(route | grep default | awk '{print $2}') + +ifconfig eth0 down +ifconfig eth0 hw ether $FAKE_HWADDR1 +ip addr flush dev eth0 +ifconfig eth0 up +vppctl tap connect tap111 hwaddr $HWADDR1 +vppctl set int ip address tap-0 $IPADDR1"/24" +vppctl set int state tap-0 up +brctl addbr br0 +brctl addif br0 tap111 +brctl addif br0 eth0 +ifconfig br0 up +vppctl ip route add 0.0.0.0/0 via $GW +sleep 1 + + +#Let's 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 255.255.255.0 +route add default gw $GW + +#Adding static arp entry for VPP so that it will be able to send packets to default GW +ping -c 1 $VLB_IPADDR &>/dev/null &disown +sleep 3 + +GW_MAC=$(arp -n | grep -w $GW | tr -s ' ' | cut -d' ' -f3) +VLB_MAC=$(arp -n | grep -w $VLB_IPADDR | tr -s ' ' | cut -d' ' -f3) + +#if VLB in our network, we will use its mac +if [ ! -z "$VLB_MAC" ]; then +vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC +fi + +# in any case let's add arp entry for default gw +vppctl set ip arp tap-0 $GW $GW_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_dns* + +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 +sleep 1 + +# Start HoneyComb +echo "" > /var/lib/honeycomb/persist/context/data.json +echo "" > /var/lib/honeycomb/persist/config/data.json +/opt/honeycomb/sample-distribution-1.0.0/honeycomb &>/dev/null &disown +sleep 20 + +# Enable traffic flows +cd /opt +chmod +x run_streams_dns.sh +#./run_streams_dns.sh &>/dev/null &disown + diff --git a/vnfs/vLB/scripts/vdns.sh b/vnfs/vLB/scripts/vdns.sh new file mode 100644 index 00000000..e3f6f111 --- /dev/null +++ b/vnfs/vLB/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/vLB/scripts/vdnspacketgen_change_streams_ports.sh b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh new file mode 100644 index 00000000..9bd77162 --- /dev/null +++ b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +#Disable all streams via Honeycomb (so that it will in consistent state) +curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"pg-streams":{"pg-stream": []}}' "http://localhost:8183/restconf/config/sample-plugin:sample-plugin/pg-streams" + +vppctl pac del dns1 +vppctl pac del dns2 +vppctl pac del dns3 +vppctl pac del dns4 +vppctl pac del dns5 +vppctl pac del dns6 +vppctl pac del dns7 +vppctl pac del dns8 +vppctl pac del dns9 +vppctl pac del dns10 + + +#Update destination (vLB) IP +VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt) +IPADDR1=$(ifconfig br0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) +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 + +#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 +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
\ No newline at end of file diff --git a/vnfs/vLB/scripts/vlb.sh b/vnfs/vLB/scripts/vlb.sh new file mode 100644 index 00000000..5ab6c40e --- /dev/null +++ b/vnfs/vLB/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/vLB/scripts/vpacketgenfordnsdemo.sh b/vnfs/vLB/scripts/vpacketgenfordnsdemo.sh new file mode 100644 index 00000000..427e5337 --- /dev/null +++ b/vnfs/vLB/scripts/vpacketgenfordnsdemo.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_for_dns_demo_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 + |