From 3514fec2ce01344df19df298f6a0d39a369ad26c Mon Sep 17 00:00:00 2001 From: Marco Platania Date: Tue, 14 Nov 2017 15:26:33 -0500 Subject: Fix streams in vLB/vDNS VNF - Fixed an issue that prevented vPacketGen to run more than 2 streams - Improved DNS query load balancing by rehashing port numbers in the streams Change-Id: Iec962301712df505569dc210770ecf1aaf6e5c5c Issue-ID: CERT-1 Signed-off-by: Marco Platania --- vnfs/vLB/scripts/run_streams_dns.sh | 50 ++++++++++++++++++++++++++++++--- vnfs/vLB/scripts/v_packetgen_install.sh | 5 ---- 2 files changed, 46 insertions(+), 9 deletions(-) (limited to 'vnfs') diff --git a/vnfs/vLB/scripts/run_streams_dns.sh b/vnfs/vLB/scripts/run_streams_dns.sh index cf95fa53..b73c9ee7 100755 --- a/vnfs/vLB/scripts/run_streams_dns.sh +++ b/vnfs/vLB/scripts/run_streams_dns.sh @@ -1,9 +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 100 -vppctl packet-gen enable-stream dns3 -vppctl packet-gen enable-stream dns4 -vppctl packet-gen enable-stream dns5 + +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 \ No newline at end of file diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh index ca2957a7..6dce05ec 100644 --- a/vnfs/vLB/scripts/v_packetgen_install.sh +++ b/vnfs/vLB/scripts/v_packetgen_install.sh @@ -56,7 +56,6 @@ cd /opt wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/v_packetgen_init.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vpacketgen.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/run_streams_dns.sh -wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vdnspacketgen_change_streams_ports.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 tar -zmxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz @@ -65,7 +64,6 @@ rm *.tar.gz chmod +x v_packetgen_init.sh chmod +x vpacketgen.sh chmod +x run_streams_dns.sh -chmod +x vdnspacketgen_change_streams_ports.sh # Install VPP export UBUNTU="xenial" @@ -93,7 +91,4 @@ then reboot fi -# Install a cron job that restart streams every minute. This allows to map streams to different vDNSs when we scale out the VNF -echo "* * * * * /opt/vdnspacketgen_change_streams_ports.sh" | crontab - ./v_packetgen_init.sh -- cgit 1.2.3-korg